Browse Source

tools (TI-68K Developer Utilities): integrate ttdos2ebk, ttebkgen, ttunebk and ttasm2exec.

git-svn-id: file:///var/svn/tigccpp/trunk@1366 9552661e-59e3-4036-b4f2-dbe53926924f
debrouxl 14 years ago
parent
commit
8f5a77708e

+ 6 - 6
tigcc/tools/Makefile

@@ -42,10 +42,10 @@ docs:
 	echo "-----------------------------------------------------------------------------" >> tooldocs.txt
 	bin/ttchecksum$(EXEEXT) >> tooldocs.txt || true
 	echo "-----------------------------------------------------------------------------" >> tooldocs.txt
-	#bin/ttdos2ebk$(EXEEXT) >> tooldocs.txt || true
-	#echo "-----------------------------------------------------------------------------" >> tooldocs.txt
-	#bin/ttebkgen$(EXEEXT) >> tooldocs.txt || true
-	#echo "-----------------------------------------------------------------------------" >> tooldocs.txt
+	bin/ttdos2ebk$(EXEEXT) >> tooldocs.txt || true
+	echo "-----------------------------------------------------------------------------" >> tooldocs.txt
+	bin/ttebkgen$(EXEEXT) >> tooldocs.txt || true
+	echo "-----------------------------------------------------------------------------" >> tooldocs.txt
 	bin/ttextract$(EXEEXT) >> tooldocs.txt || true
 	echo "-----------------------------------------------------------------------------" >> tooldocs.txt
 	bin/ttinfo$(EXEEXT) >> tooldocs.txt || true
@@ -64,8 +64,8 @@ docs:
 	echo "-----------------------------------------------------------------------------" >> tooldocs.txt
 	bin/ttunarchive$(EXEEXT) >> tooldocs.txt || true
 	echo "-----------------------------------------------------------------------------" >> tooldocs.txt
-	#bin/ttunebk$(EXEEXT) >> tooldocs.txt || true
-	#echo "-----------------------------------------------------------------------------" >> tooldocs.txt
+	bin/ttunebk$(EXEEXT) >> tooldocs.txt || true
+	echo "-----------------------------------------------------------------------------" >> tooldocs.txt
 	bin/ttunpack$(EXEEXT) >> tooldocs.txt || true
 	echo "-----------------------------------------------------------------------------" >> tooldocs.txt
 	echo tooldocs.txt generated.

+ 1 - 1
tigcc/tools/bin2oth.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       bin2oth.c
 * initial date:    22/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/buildall

@@ -1,5 +1,5 @@
 #!/bin/sh
-for a in ttbin2hex ttbin2oth ttbin2str ttextract ttstrip ttarchive ttpack ttunpack tthelp ttinfo ttchecksum ttbin2bin ttsplit ttppggen tttiler ttunarchive tthex2bin ttsetname ; # ttdos2ebk ttebkgen ttunebk
+for a in ttbin2hex ttbin2oth ttbin2str ttextract ttstrip ttarchive ttpack ttunpack tthelp ttinfo ttchecksum ttbin2bin ttsplit ttppggen tttiler ttunarchive tthex2bin ttsetname ttdos2ebk ttebkgen ttunebk ;
 do
 ./buildone $a
 if [ $? -ne 0 ]; then

+ 2 - 2
tigcc/tools/buildall.bat

@@ -24,8 +24,8 @@ for %%a in (%ttsct%) do call buildone.bat %%a
 set ttsct=tttiler ttunarchive tthex2bin ttsetname
 for %%a in (%ttsct%) do call buildone.bat %%a
 
-REM set ttsct=ttdos2ebk ttebkgen ttunebk
-REM for %%a in (%ttsct%) do call buildone.bat %%a
+set ttsct=ttdos2ebk ttebkgen ttunebk
+for %%a in (%ttsct%) do call buildone.bat %%a
 
 @echo on
 

+ 6 - 6
tigcc/tools/builddocs

@@ -25,10 +25,10 @@ bin/ttbin2bin >> tooldocs.txt
 echo "-----------------------------------------------------------------------------" >> tooldocs.txt
 bin/ttchecksum >> tooldocs.txt
 echo "-----------------------------------------------------------------------------" >> tooldocs.txt
-#bin/ttdos2ebk >> tooldocs.txt
-#echo "-----------------------------------------------------------------------------" >> tooldocs.txt
-#bin/ttebkgen >> tooldocs.txt
-#echo "-----------------------------------------------------------------------------" >> tooldocs.txt
+bin/ttdos2ebk >> tooldocs.txt
+echo "-----------------------------------------------------------------------------" >> tooldocs.txt
+bin/ttebkgen >> tooldocs.txt
+echo "-----------------------------------------------------------------------------" >> tooldocs.txt
 bin/ttextract >> tooldocs.txt
 echo "-----------------------------------------------------------------------------" >> tooldocs.txt
 bin/ttinfo >> tooldocs.txt
@@ -47,8 +47,8 @@ bin/tttiler >> tooldocs.txt
 echo "-----------------------------------------------------------------------------" >> tooldocs.txt
 bin/ttunarchive >> tooldocs.txt
 echo "-----------------------------------------------------------------------------" >> tooldocs.txt
-#bin/ttunebk >> tooldocs.txt
-#echo "-----------------------------------------------------------------------------" >> tooldocs.txt
+bin/ttunebk >> tooldocs.txt
+echo "-----------------------------------------------------------------------------" >> tooldocs.txt
 bin/ttunpack >> tooldocs.txt
 echo "-----------------------------------------------------------------------------" >> tooldocs.txt
 

+ 6 - 6
tigcc/tools/builddocs.bat

@@ -25,10 +25,10 @@ bin/ttbin2bin.exe >> tooldocs.txt
 echo ----------------------------------------------------------------------------- >> tooldocs.txt
 bin/ttchecksum.exe >> tooldocs.txt
 echo ----------------------------------------------------------------------------- >> tooldocs.txt
-REM bin/ttdos2ebk.exe >> tooldocs.txt
-REM echo ----------------------------------------------------------------------------- >> tooldocs.txt
-REM bin/ttebkgen.exe >> tooldocs.txt
-REM echo ----------------------------------------------------------------------------- >> tooldocs.txt
+bin/ttdos2ebk.exe >> tooldocs.txt
+echo ----------------------------------------------------------------------------- >> tooldocs.txt
+bin/ttebkgen.exe >> tooldocs.txt
+echo ----------------------------------------------------------------------------- >> tooldocs.txt
 bin/ttextract.exe >> tooldocs.txt
 echo ----------------------------------------------------------------------------- >> tooldocs.txt
 bin/ttinfo.exe >> tooldocs.txt
@@ -47,8 +47,8 @@ bin/tttiler.exe >> tooldocs.txt
 echo ----------------------------------------------------------------------------- >> tooldocs.txt
 bin/ttunarchive.exe >> tooldocs.txt
 echo ----------------------------------------------------------------------------- >> tooldocs.txt
-REM bin/ttunebk.exe >> tooldocs.txt
-REM echo ----------------------------------------------------------------------------- >> tooldocs.txt
+bin/ttunebk.exe >> tooldocs.txt
+echo ----------------------------------------------------------------------------- >> tooldocs.txt
 bin/ttunpack.exe >> tooldocs.txt
 echo ----------------------------------------------------------------------------- >> tooldocs.txt
 

+ 1 - 1
tigcc/tools/buildone

@@ -30,7 +30,7 @@ echo compilation failed
 exit 1
 fi
 
-if [ type upx >/dev/null 2>/dev/null ] ; then
+if type upx >/dev/null 2>/dev/null ; then
 echo compressing file
 upx --best $out >/dev/null 2>/dev/null
 else

+ 1 - 1
tigcc/tools/packhead.h

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       packhead.h
 * initial date:    14/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/revtools.h

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       revtools.h
 * initial date:    23/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/strhead.h

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       strhead.h
 * initial date:    13/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 360 - 0
tigcc/tools/tooldocs.txt

@@ -0,0 +1,360 @@
+#############################################################################
+SHORT USAGE INFORMATION of included PCTOOLS                                  
+-----------------------------------------------------------------------------
+NOTE: tooldocs.txt will be automatically generated by calling each tool      
+      without any commandline parameter.                                     
+      Don't modify this document by hand. You will loose your changes        
+      when builddocs(.bat) will be run again                                 
+#############################################################################
+
+TTArchive 1.11 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:58:54
+
+Usage: ttarchive [flags] <cfgfile> <varname> [folder]
+
+       -89            .... generate TI89 variable
+       -92            .... generate TI92p variable
+       -v             .... verbose (unsets -quiet)
+       -quiet         ...  don't output standard messages (unsets -v)
+       -e <extension> .... use special extension
+
+       cfgfile        .... configuration file to use
+       varname        .... on-calc variable name of output
+       folder         .... on-calc destination folder (OPTIONAL)
+
+       generates an archive file. The contents of the archive
+       have to be specified in a configfile where each line contains
+       one file which should be added to the archive.
+       An archive file can hold compressed or uncompressed entries.
+       If an entry should be compressed add tag "compress" at the
+       end of the config line.
+
+       [-------- format of one line in the configfile --------]
+       <file_to_store> <varname> <attr1> <attr2> [compress]
+
+       file_to_store ... name including path to inputfile
+       varname       ... name used to find data in archive (max. 8 chars)
+       attr1 attr2   ... misc. attributes which may be queried from program
+                           (0..65536)
+       compress      ... if this tag is set on the end of the line the
+                         given inputfile will be compressed before adding
+                         it to the archive
+
+-----------------------------------------------------------------------------
+
+TTBin2Str 1.8 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:58:53
+
+Usage: ttbin2str <-s89 | -s92> <infile> <name> [folder]
+
+       -s89  ....  generate TI89 string
+       -s92  ....  generate TI92 string
+       -f    ....  don't print a warning if the string contains at least one 0x00
+       (strings containing 0x00 may prove problematic to transfer using TI-Connect)
+
+       enwraps any file into a TI89 or TI92 string variable
+-----------------------------------------------------------------------------
+
+TTBin2Hex 1.10 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:58:51
+
+Usage: ttbin2hex [flags] <infile> <outfile>
+
+       -quiet      ....  don't output standard messages
+       -slash      ....  append backslash at end of line
+       -c <count>  ....  number of items per line
+       -b1         ....  generate unsigned char array
+       -b2         ....  generate unsigned int  array
+       -b4         ....  generate unsigned long array
+       -a <name>   ....  generate an array with given name
+       -ss <nr>    ....  skip number of bytes at begin of inputfile
+       -se <nr>    ....  skip number of bytes at end of inputfile
+       -lb <nr>    ....  insert an additionally linebreak every nr items
+       infile      ....  name of infile
+       outfile     ....  name of outfile (use "-" for stdout)
+
+       converts binary file to C array data
+
+-----------------------------------------------------------------------------
+
+TTBin2OTH 1.11 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:58:52
+
+Usage: ttbin2oth [flags] <-89 | -92> <extension> <infile> <varname> [folder]
+
+       -quiet    ...  don't output standard messages
+       -strip    ...  MUST be set if the input is already a TI file
+                      (generates a temporary file called bin2oth.tmp for
+                      the stripped inputfile)
+       -89       ...  generate a TI89 file
+       -92       ...  generate a TI92p file
+
+       extension ...  on-calc extension (up to 4 characters)
+       varname   ...  on-calc variable name (up to 8 characters)
+       folder    ...  on-calc destination folder (OPTIONAL)
+
+       enwraps file into a custom TI89 or TI92p variable with given <extension>
+       NOTE1: the extension length may vary between 1 and 4 characters
+       NOTE2: the output filename is generated by taking the given varname and
+              appending ".89y" or ".9xy" to it.
+       NOTE3: if a generated file CAN'T BE UPLOADED, you are probably using a
+              reserved AMS name for your variable. Just try another name in
+              this case.
+
+-----------------------------------------------------------------------------
+
+TTBin2Bin 1.7 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:59:00
+
+Usage: ttbin2bin [-quiet] <infile>
+
+       quiet  ... don't output standard messages
+
+       converts TI89 binary to TI92p binary or TI92p binary to TI89 binary
+       by just patching the header information. the generated outputfile
+       will have the same name, but a different extension.
+       NOTE1: this should be only applied to datafiles or executables
+              which uses no compiled in calc depending constants
+       NOTE2: the program auto-detects the infile type by the extension
+              if the extension starts with '.89' it will treated as 
+              TI89 inputfile. if it starts with '.9x' it will be treated
+              as TI92p inputfile.
+
+-----------------------------------------------------------------------------
+
+TTChecksum 1.7 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:58:59
+
+Usage: ttchecksum <infile>
+
+       corrects the checksum of 89z/89s/89y/9xz/9xs/9xy calculator files.
+
+       NOTE: if the embedded filelength doesn't match the real filelength
+             (for example: caused by an invalid FTP transfer) the file
+             cannot be corrected.
+-----------------------------------------------------------------------------
+
+TTDos2EBK 1.9 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:59:04
+
+Usage: ttdos2ebk [-v] <infile> <outfile>
+
+       -v ... print verbose messages
+
+       converts a plain dos text to an ebook conform text
+       by discarding all 0x0D and by handling the following
+       inlined metatags:
+
+       <mt ff>     ... inserts a form feed
+       <mt hr>     ... inserts a horizontal ruler
+       <mt left>   ... text alignment left
+       <mt right>  ... text alignment right
+       <mt center> ... text alignment right
+
+       and the following preprocessing metatags:
+
+       <mt r=on>   ... replace single 0x0A by space ON
+       <mt r=off>  ... replace single 0x0A by space OFF
+       <mt c=on>   ... collapse spaces ON
+       <mt c=off>  ... collapse spaces OFF
+       <mt t=on>   ... metatag translation ON
+       <mt t=off>  ... metatag translation OFF
+-----------------------------------------------------------------------------
+
+TTEbkGen 1.10 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:59:04
+
+Usage: ttebkgen [flags] <infile> <varname> "description"
+
+-t titlefile ... own title image - see Note (8)
+-89          ... generate ONLY TI89 ebook
+-92          ... generate ONLY TI92p ebook
+-v           ... verbose (unsets -quiet)
+-quiet       ... don't output standard messages (unsets -v)
+-keepfiles   ... keep all temporary generated files (for debugging only)
+
+the infile must contain the complete text of the final ebook.
+split points must be marked within the inputfile with tag
+<--split--> on a single line.
+NOTES:
+ (1) the maximum uncompressed size of a ebook part is 65518 bytes.
+ (2) the final size of the ebook cannot extend 65608 bytes
+     (including PC header infos)
+ (3) if a part is too long, define more splitpoints in the infile
+ (4) if the complete text will not fit into one ebook, split
+     the text into two or more ebooks
+ (5) varname is used as outfile name and as varname on the calculator
+ (6) don't forget to enclose the description in quotes !!
+ (7) just the first 19 character of the description are used
+ (8) titlefile must be a 4-grayscale pic with 160x100 pixels in binary form
+     generated with ImageStudio (not compressed binary)
+
+-----------------------------------------------------------------------------
+
+TTExtract 1.8 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:58:53
+
+Usage: ttextract [flags] <infile> <outfile> <starttoken> [<endtoken>]
+
+       -quiet .... don't output standard messages (unsets -v)
+       -v     .... output additional messages (unsets -quiet)
+       -sh    .... treat start token as hexcode
+       -eh    .... treat end token as hexcode
+
+       Extract part of infile which starts right after the start token.
+       If an endtoken is given it ends just before the end token.
+       NOTE1: If you use -sh or -eh the given tokens have to be plain
+              hexcodes WITHOUT any prefix like "0x" or "0h"
+       NOTE2: if you want the extracted data to be correct, you have to
+              use -fno-unit-at-a-time, as long as this switch is
+              supported by GCC
+
+-----------------------------------------------------------------------------
+
+TTInfo 1.6 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:58:59
+
+Usage: ttinfo <infile>
+
+       prints infos about a 89z/89s/89y/9xz/9xs/9xy file
+-----------------------------------------------------------------------------
+
+TTPack 1.9 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:58:56
+
+Usage: ttpack [-<flags>] <infile> <outfile>
+       -quiet    don't output standard messages (unsets v)
+       -hti      treat input as hex textinput
+       -hto      generate hex textoutput
+       -fdelta   use delta-lz77 -- shortens some files
+       e<val>    force escape bits
+       r<val>    restrict lz search range
+       n         no RLE/LZ length optimization
+       s         full statistics
+       v         verbose (unsets -quiet)
+       p<val>    force extralzposbits
+       m<val>    max len 5..7 (2*2^5..2*2^7)
+-----------------------------------------------------------------------------
+
+TTPPGGen 1.8 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:59:00
+
+Usage: ttppggen [flags] <infile> <varname>
+
+-quiet  ... don't output standard messages
+-nowarn ... optional flag to turn off signature missmatch warning
+
+infile  ... a valid 89z or 9xz program (NOSTUB or kernel-dependent)
+varname ... name of output ppg (without extension)
+
+NOTE: the type of file (89y or 9xy) which will be generated depends
+      on the extension of the given infile
+
+-----------------------------------------------------------------------------
+
+TTSetName 1.2 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:59:03
+
+Usage: ttsetname [flags] file
+
+       -quit          ...  don't output standard messages
+       -name   string ...  set oncalc name to given string (max. 8 chars)
+       -folder string ...  set oncalc folder to given string (max. 8 chars)
+
+       sets oncalc name and folder of given TI89/TI92p file
+-----------------------------------------------------------------------------
+
+TTSplit 1.7 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:59:00
+
+Usage: ttsplit [flags] <-t | -b> <offsetfile> <infile>
+       -t          ...  treat offsets as linenumbers (starting at 1)
+       -b          ...  treat offsets as byteoffsets (starting at 0)
+       -s <string> ...  use inline split tag instead of offset file
+       -v          ...  output additionally messages
+
+offsets are read from file offsetfile, which must contain offsets only
+in ascending numbers (maximum: 999 offsets). each offset is treated as
+the start of a new file. the first offset is the start of the second (!!!)
+file and so on.
+The outputfile names are generated from the inputfilename using
+the following pattern:
+<inputname>p<nr>.<inputextension>
+nr ranges from 000 to 999
+
+-----------------------------------------------------------------------------
+
+TTStrip 1.8 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:58:54
+
+Usage: ttstrip [-quiet] <infile> <outfile>
+
+       -quiet ... don't output standard messages
+
+       extracts the raw binary content of a TI file by stripping
+       the header and trailing checksum which are only necessary
+       for the link software to send the data to the calc.
+       NOTE: after stripping these informations it is no longer
+       possible to distinguish between a TI89 and a TI92p file.
+       So be careful!
+
+-----------------------------------------------------------------------------
+
+TTTiler 1.7 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:59:02
+
+Usage: tttiler [-h|-v|-ht|-vt] <infile> <width> <height> <t_width> <t_height> <entries> <outfile> (array_name)
+       -h         ... tile from left to right and up to down
+       -v         ... tile from up   to down  and left to right
+       -ht        ... like -h, but generates complete test program
+       -vt        ... like -v, but generates complete test program
+       infile     ... binary image file generated with ImageStudio
+       width      ... width  of infile in pixel
+       height     ... height of infile in pixel
+       t_width    ... width  of one tile in pixel (<=32)
+       t_height   ... height of one tile in pixel
+       entries    ... number of data fields per line (0<entries<=20)
+       outfile    ... output filename (use - as name for output to stdout)
+       array_name ... optional name of array to generate
+
+       splits binary image file generated with ImageStudio in single
+       sprites (tiles) and generates C source code
+       including the necessary macros to access them.
+
+NOTE:  only 8, 16 and 32 pixel wide tiles are generated.
+       If the tilewidth is not exactly one of these widths,
+       the sprites are filled up to the right with empty pixels
+NOTE2: the width of the input file have to be a multiple of 8
+       otherwise ImageStudio and tttiler will not treat it correctly
+
+-----------------------------------------------------------------------------
+
+TTUnArchive 1.3 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:59:03
+
+Usage: ttunarchive <infile> [<entry_number> <outfile>]
+
+       extracts one entry of an TTArchive into a file
+       (entry_number starts with 0). If no entry number
+       and outfile are given, ttunarchive lists only
+       the contents of the TTArchive
+
+-----------------------------------------------------------------------------
+
+TTUnEbk 1.3 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:59:06
+
+Usage: ttunebk <infile> <outfile>
+
+       exports the complete text of an ebook to a plain textfile
+
+-----------------------------------------------------------------------------
+
+TTUnpack 1.8 - TI-68k Developer Utilities v1.40
+(c) thomas.nussbaumer@gmx.net Dec 30 2009 20:58:58
+
+Usage: ttunpack [-<flags>] <infile> <outfile>
+       -hti      treat input as hex-text input
+       -hto      generate hex-text output
+       -t        just test (generates no outfile)
+-----------------------------------------------------------------------------

+ 1 - 1
tigcc/tools/tt.h

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       tt.h
 * initial date:    13/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/ttarchive.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttarchive.c
 * initial date:    16/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/ttarchive.h

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttarchive.h
 * initial date:    20/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 48 - 0
tigcc/tools/ttasm2exec.pl

@@ -0,0 +1,48 @@
+#!/usr/bin/perl -W
+use strict;
+
+# Trivial program to convert a TI-68k assembly file (.??z) to a TI-BASIC Exec string.
+# Copyright (C) 2009 Lionel Debroux.
+
+package main;
+    my $length;
+    my $filecontents;
+    my $unpackedfilecontents;
+
+    (   ($#ARGV == 0) # A single argument...
+     && (($ARGV[0] =~ m#.89z$#) || ($ARGV[0] =~ m#.9xz$#) || ($ARGV[0] =~ m#.v2z$#)) # ... which ends with {89z,9xz,v2z} and ...
+     && (-f $ARGV[0]) # ... which is a path representing an actual file.
+    )
+    or die "Usage: ttasm2exec.pl <infile.{89z,9xz,v2z}>\n";
+
+    open(INFILE, $ARGV[0]) or die "Can't open $ARGV[0]: $!";
+    read(INFILE, $filecontents, -s INFILE);
+    close(INFILE);
+
+    if ((index ($filecontents, "**TI89**") != 0) && (index ($filecontents, "**TI92P*") != 0)) {
+        die "$ARGV[0] doesn't seem to be a file suitable for TI-68k calculators";
+    }
+
+    do {
+        use bytes;
+        # Get file size in bytes.
+        $length = length($filecontents);
+        print "Input file is $length bytes long (of which 91 bytes will be stripped).\n";
+
+        if ($length <= 93) { # 86 bytes for the header, 2 size bytes, 2 bytes for the empty relocation, 1 byte for the tag and 2 bytes for the trailing checksum.
+            die "$ARGV[0] is too short to be a valid ASM file";
+        }
+        $length -= 90;
+        
+        $filecontents = substr($filecontents, 88, $length);
+
+        $length *= 2; # Number of hex digits is twice that of bytes.
+
+        $unpackedfilecontents = unpack ("H[$length]", $filecontents);
+        if (rindex($unpackedfilecontents, "f3") != $length - 2) {
+            warn "$ARGV[0] doesn't seem to be an assembly file, the Exec string that will be generated is unlikely to work !";
+        }
+        $length = length($unpackedfilecontents);
+        $unpackedfilecontents = substr($unpackedfilecontents, 0, $length - 2);
+        print "Exec \"$unpackedfilecontents\"\n";
+    } while (0);

+ 1 - 1
tigcc/tools/ttbin2bin.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttbin2bin.c
 * initial date:    21/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/ttbin2hex.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttbin2hex.c
 * initial date:    13/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/ttbin2oth.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttbin2oth.c
 * initial date:    14/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/ttbin2str.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttbin2str.c
 * initial date:    13/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/ttchecksum.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttchecksum.c
 * initial date:    21/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 581 - 0
tigcc/tools/ttdos2ebk.c

@@ -0,0 +1,581 @@
+/******************************************************************************
+*
+* project name:    TI-68k Developer Utilities
+* file name:       ttdos2ebk.c
+* initial date:    20/08/2000
+* author:          thomas.nussbaumer@gmx.net
+* description:     prepares a text file for ebook
+*
+******************************************************************************/
+
+/*
+  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 ttdos2ebk 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
+*/
+
+// if EMBEDDED_USE is defined, than we use this sourcefile from within another
+// sourcefile
+
+#ifndef EMBEDDED_USE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "ttversion.h"
+#include "revtools.h"
+#include "ttebkmeta.h"
+
+#ifdef FILE_REVISION
+#undef FILE_REVISION
+#endif
+#define FILE_REVISION "1.9"
+
+
+//=============================================================================
+// print the usage
+//=============================================================================
+void PrintUsage() {
+    fprintf(USAGE_OUT, "Usage: ttdos2ebk [-v] <infile> <outfile>\n\n"\
+                       "       -v ... print verbose messages\n\n"\
+                       "       converts a plain dos text to an ebook conform text\n"\
+                       "       by discarding all 0x0D and by handling the following\n"\
+                       "       inlined metatags:\n\n"\
+                       "       <mt ff>     ... inserts a form feed\n"\
+                       "       <mt hr>     ... inserts a horizontal ruler\n"\
+                       "       <mt left>   ... text alignment left\n"\
+                       "       <mt right>  ... text alignment right\n"\
+                       "       <mt center> ... text alignment right\n\n"\
+                       "       and the following preprocessing metatags:\n\n"\
+                       "       <mt r=on>   ... replace single 0x0A by space ON\n"\
+                       "       <mt r=off>  ... replace single 0x0A by space OFF\n"\
+                       "       <mt c=on>   ... collapse spaces ON\n"\
+                       "       <mt c=off>  ... collapse spaces OFF\n"\
+                       "       <mt t=on>   ... metatag translation ON\n"\
+                       "       <mt t=off>  ... metatag translation OFF\n");
+}
+
+#endif
+
+#define DEFAULT_COLLAPSE   1
+#define DEFAULT_REPLACE    1
+#define DEFAULT_TRANSLATE  1
+#define DEFAULT_DBLSPACE   0
+
+
+typedef struct {
+   char*         metatag;
+   unsigned char sbcc;
+} ConvEntry;
+
+//#define CONV_ENTRIES  13
+#define IDX_TRANS_OFF 10
+#define IDX_TRANS_ON   9
+
+//-----------------------------------------------------------------------------
+// mapping table for meta tags
+//-----------------------------------------------------------------------------
+ConvEntry ctable[] = {
+    {"<mt ff>",      SBCC_FF },
+    {"<mt hr>",      SBCC_HR },
+    {"<mt left>",    SBCC_LEFT },
+    {"<mt right>",   SBCC_RIGHT },
+    {"<mt center>",  SBCC_CENTER },
+    {"<mt r=on>",    SBCC_REPLACE_ON },
+    {"<mt r=off>",   SBCC_REPLACE_OFF },
+    {"<mt c=on>",    SBCC_COLLAPSE_ON },
+    {"<mt c=off>",   SBCC_COLLAPSE_OFF },
+    {"<mt t=on>",    SBCC_TRANS_ON },
+    {"<mt t=off>",   SBCC_TRANS_OFF },
+    {"<mt ds=on>",   SBCC_DOUBLESPACE_ON },
+    {"<mt ds=off>",  SBCC_DOUBLESPACE_OFF },
+    {0,0}};
+
+
+//=============================================================================
+// reads 1 line from src into dest and appends a zero
+//=============================================================================
+long ReadLine(char* src, char* dest, char* end) {
+     long icount = 0;
+     while (*src != 0x0A && src < end && icount < 4094) *dest++ = *src++,icount++;
+     *dest=0;
+     return icount;
+}
+
+int state_translate = DEFAULT_TRANSLATE;
+
+
+//=============================================================================
+// handles metatag replacement for one line
+//=============================================================================
+void TranslateLine(char* src,char* dest) {
+    int i=0;
+    char* tmp;
+
+    strcpy(dest,src);
+
+    while (ctable[i].metatag) {
+        if (state_translate || i==IDX_TRANS_ON || i==IDX_TRANS_OFF) {
+            char* location = strstr(dest,ctable[i].metatag);
+
+            if (location) {
+                if (i == IDX_TRANS_OFF || i == IDX_TRANS_ON) {
+                    if (i==IDX_TRANS_OFF)     state_translate = 0;
+                    else if (i==IDX_TRANS_ON) state_translate = 1;
+                    tmp = location + strlen(ctable[i].metatag);
+                }
+                else {
+                    *location   = CCI;
+                    *(location+1) = ctable[i].sbcc;
+                    tmp = location + strlen(ctable[i].metatag);
+                    location+=2;
+                }
+                while (*tmp) *location++ = *tmp++;
+                *location = 0;
+                i--;
+            }
+        }
+        i++;
+    }
+}
+
+
+//=============================================================================
+// replaces all meta tags of within a buffer
+//=============================================================================
+long Translate(char* src,char* dest,long ilength) {
+    char  b[4096];
+    char  b2[4096];
+    long           len,clen,ilen = 0;
+    char* end = src + ilength;
+
+    while (src < end) {
+        len  = ReadLine(src,b,end);
+        TranslateLine(b,b2);
+        clen = strlen(b2);
+        memcpy(dest,b2,clen);
+        dest += clen;
+        *dest++ = 0x0A;
+        ilen += clen + 1;
+        src += len + 1;
+        //printf("%s\n",b2);
+    }
+
+    return ilen;
+}
+
+
+//=============================================================================
+// copies a maximum of length bytes from src to dest, but skipping 0x0D bytes
+//
+// returns number of bytes copied
+//=============================================================================
+long RemoveAll0D(char* src, char* dest,long length) {
+     long i;
+     long cnt = 0;
+
+     for (i=0;i<length;i++) {
+         unsigned char c = *src++;
+         if (c != 0x0D) {
+             *dest++ = c;
+              cnt++;
+         }
+     }
+     return cnt;
+}
+
+
+//=============================================================================
+// handles complete preprocessing including space collapsing and break
+// replacement
+//=============================================================================
+long Preprocess(char* src,char* dest,long length,int verbose) {
+    long i;
+    long space_count = 0;
+    long break_count = 0;
+
+    long collapse_count = 0;
+    long replace_count  = 0;
+
+    int state_replace  = DEFAULT_REPLACE;
+    int state_collapse = DEFAULT_COLLAPSE;
+    int state_dblspace = DEFAULT_DBLSPACE;
+
+    int removed_codes = 0;
+    char* orig_dest = dest;
+
+    for (i=0;i<length;i++) {
+        unsigned char c = *src++;
+
+        if (c == 0x0A) {
+            break_count++;
+            if (space_count) {
+                if (state_collapse) {
+                    *dest++ = ' ';
+                    collapse_count += space_count - 1;
+                }
+                else {
+                    while (space_count--) *dest++ = ' ';
+                }
+                space_count = 0;
+            }
+            continue;
+        }
+
+        if (c == ' ') {
+            space_count++;
+            if (state_dblspace) space_count++; // NEW
+            if (break_count) {
+                if (state_replace) {
+                    if (break_count == 1) {
+                       space_count++;
+                       if (state_dblspace) space_count++; // NEW
+                       replace_count++;
+                    }
+                    else {
+                        while (break_count--) *dest++ = 0x0A;
+                    }
+                }
+                else {
+                    while (break_count--) *dest++ = 0x0A;
+                }
+                break_count = 0;
+            }
+            continue;
+        }
+
+        if (c == CCI) {
+            c = *src++;
+            i++;
+            switch(c) {
+                case SBCC_DOUBLESPACE_ON:
+                    removed_codes++;
+                    state_dblspace = 1;
+                    break;
+                case SBCC_DOUBLESPACE_OFF:
+                    removed_codes++;
+                    state_dblspace = 0;
+                    break;
+                case SBCC_COLLAPSE_ON:
+                    removed_codes++;
+                    if (space_count) {
+                        if (state_collapse) {
+                            *dest++ = ' ';
+                            collapse_count += space_count - 1;
+                        }
+                        else {
+                            while (space_count--) *dest++ = ' ';
+                        }
+                        space_count = 0;
+                    }
+                    state_collapse = 1;
+                    break;
+                case SBCC_COLLAPSE_OFF:
+                    removed_codes++;
+                    if (space_count) {
+                        if (state_collapse) {
+                            *dest++ = ' ';
+                            collapse_count += space_count - 1;
+                        }
+                        else {
+                            while (space_count--) *dest++ = ' ';
+                        }
+                        space_count = 0;
+                    }
+                    state_collapse = 0;
+                    break;
+                case SBCC_REPLACE_ON:
+                    removed_codes++;
+                    if (break_count) {
+                        if (state_replace) {
+                            if (break_count == 1) {
+                                space_count++;
+                                if (state_dblspace) space_count++; // NEW
+                                replace_count++;
+                            }
+                            else {
+                                while (break_count--) *dest++ = 0x0A;
+                            }
+                        }
+                        else {
+                            while (break_count--) *dest++ = 0x0A;
+                        }
+                        break_count = 0;
+                    }
+                    state_replace  = 1;
+                    break;
+                case SBCC_REPLACE_OFF:
+                    removed_codes++;
+                    if (break_count) {
+                        if (state_replace) {
+                            if (break_count == 1) {
+                                space_count++;
+                                if (state_dblspace) space_count++; // NEW
+                                replace_count++;
+                            }
+                            else {
+                                while (break_count--) *dest++ = 0x0A;
+                            }
+                        }
+                        else {
+                            while (break_count--) *dest++ = 0x0A;
+                        }
+                        break_count = 0;
+                    }
+                    state_replace  = 0;
+                    break;
+                default:
+                    *dest++ = CCI;
+                    *dest++ = c;
+                    break;
+            }
+            continue;
+        }
+
+        //------------------------------------------------------
+        // If we'll come here we have to flush spaces and breaks
+        //------------------------------------------------------
+
+        if (break_count) {
+            if (state_replace) {
+                if (break_count == 1) {
+                   space_count++;
+                   if (state_dblspace) space_count++; // NEW
+                   replace_count++;
+                }
+                else {
+                    while (break_count--) *dest++ = 0x0A;
+                }
+            }
+            else {
+                while (break_count--) *dest++ = 0x0A;
+            }
+            break_count = 0;
+        }
+
+        if (space_count) {
+            if (state_collapse) {
+                *dest++ = ' ';
+                collapse_count += space_count - 1;
+            }
+            else {
+                while (space_count--) *dest++ = ' ';
+            }
+            space_count = 0;
+        }
+
+        *dest++ = c;
+    }
+
+
+    //-----------------------------------------------
+    // once more a little bit flushing
+    //-----------------------------------------------
+    if (break_count) {
+        if (state_replace) {
+            if (break_count == 1) {
+               space_count++;
+               if (state_dblspace) space_count++; // NEW
+               replace_count++;
+            }
+            else {
+                while (break_count--) *dest++ = 0x0A;
+            }
+        }
+        else {
+            while (break_count--) *dest++ = 0x0A;
+        }
+        break_count = 0;
+    }
+
+    if (space_count) {
+        if (state_collapse) {
+            *dest++ = ' ';
+            collapse_count += space_count - 1;
+        }
+        else {
+            while (space_count--) *dest++ = ' ';
+        }
+        space_count = 0;
+    }
+
+    if (verbose) fprintf(stderr,"replace_count=%ld collapse_count=%ld removed_codes=%d\n",replace_count,collapse_count,removed_codes);
+    //return length-collapse_count-removed_codes*2;
+    return dest - orig_dest;
+}
+
+
+//=============================================================================
+// nomen omen est
+//=============================================================================
+#ifndef EMBEDDED_USE
+int main(int argc, char* argv[]) {
+#else
+int TTDos2Ebk(int argc,char* argv[]) {
+#endif
+    FILE*          fp = NULL;
+    long           size;
+    char* buf1 = NULL;
+    char* buf2 = NULL;
+    char* infile  = 0;
+    char* outfile = 0;
+    //int            replace = 1;
+    int            verbose = 0;
+    int            i;
+
+#ifndef EMBEDDED_USE
+    PRINT_ID("TTDos2EBK");
+#endif
+
+    if (argc < 3) {
+#ifndef EMBEDDED_USE
+        PrintUsage();
+#endif
+        return 1;
+    }
+
+    // parse arguments
+    for (i=1; i<argc; i++) {
+        if (!strcmp(argv[i], "-v")) verbose = 1;
+        else if (!infile)  infile  = argv[i];
+        else if (!outfile) outfile = argv[i];
+        else {
+#ifndef EMBEDDED_USE
+            PrintUsage();
+#endif
+            return 1;
+        }
+    }
+
+    if (!infile || !outfile) {
+#ifndef EMBEDDED_USE
+        PrintUsage();
+#endif
+        return 1;
+    }
+
+
+    if (!(fp = fopen(infile,"rb"))) {
+        fprintf(stderr,"ERROR: cannot open inputfile %s\n",infile);
+        return 1;
+    }
+
+    fseek(fp,0,SEEK_END);
+    size = ftell(fp);
+    rewind(fp);
+
+    if (verbose) fprintf(stderr,"inputsize is %ld bytes\n",size);
+
+    if (!(buf1 = malloc(size*2))) {   // size*2 necessary for double-space
+        fprintf(stderr,"ERROR: cannot allocate %ld bytes\n",size);
+        fclose(fp);
+        free(buf2);
+        free(buf1);
+        return 1;
+    }
+    if (!(buf2 = malloc(size*2))) {   // size*2 necessary for double-space
+        fprintf(stderr,"ERROR: cannot allocate %ld bytes\n",size);
+        fclose(fp);
+        free(buf2);
+        free(buf1);
+        return 1;
+    }
+
+    if (fread(buf1,size,1,fp) != 1) {
+        fprintf(stderr,"ERROR: cannot read content of inputfile %s\n",infile);
+        fclose(fp);
+        free(buf2);
+        free(buf1);
+        return 1;
+    }
+    fclose(fp);
+
+    if (!(fp = fopen(outfile,"wb"))) {
+        fprintf(stderr,"ERROR: cannot open outputfile %s\n",outfile);
+        free(buf2);
+        free(buf1);
+        return 1;
+    }
+
+    size = Translate(buf1,buf2,size);
+    if (verbose) fprintf(stderr,"size after translation = %ld\n",size);
+
+    size = RemoveAll0D(buf2,buf1,size);
+    if (verbose) fprintf(stderr,"after removing all 0x0D is size %ld bytes\n",size);
+
+
+    size = Preprocess(buf1,buf2,size,verbose);
+
+    if (fwrite(buf2,size,1,fp) != 1) {
+        fprintf(stderr,"ERROR: cannot write %ld bytes to outputfile %s\n",size,outfile);
+    }
+    else {
+        if (verbose) fprintf(stderr,"%ld bytes written to file %s\n",size,outfile);
+    }
+
+    fclose(fp);
+    free(buf2);
+    free(buf1);
+
+    return 0;
+}
+
+
+//#############################################################################
+//###################### NO MORE FAKES BEYOND THIS LINE #######################
+//#############################################################################
+//
+//=============================================================================
+// Revision History
+//=============================================================================
+//
+// Revision 1.9  2009/01/25           Lionel Debroux
+// Changes by Romain Liévin and/or me for 64-bit compatibility.
+// Adapt to new version display (revtools.h).
+//
+// Revision 1.8  2002/03/06 16:08:52  tnussb
+// typo in PrintUsage() fixed
+//
+// Revision 1.7  2002/03/04 14:32:41  tnussb
+// now tool can be used as embedded version from within other tools
+// by defining EMBEDDED_VERSION before including the sourcefile
+//
+// Revision 1.6  2002/02/07 09:49:37  tnussb
+// all local includes changed, because header files are now located in pctools folder
+//
+// Revision 1.5  2000/11/28 00:06:33  Thomas Nussbaumer
+// using now USAGE_OUT stream for usage info
+//
+// Revision 1.4  2000/10/01 15:06:54  Thomas Nussbaumer
+// support for more tags and some bugs fixed
+//
+// Revision 1.3  2000/08/27 23:54:55  Thomas Nussbaumer
+// metatag handling support added
+//
+// Revision 1.2  2000/08/23 19:51:38  Thomas Nussbaumer
+// adapted to automatic version display (revtools.h)
+//
+// Revision 1.1  2000/08/20 15:45:02  Thomas Nussbaumer
+// initial version
+//
+//
+//

+ 821 - 0
tigcc/tools/ttebkgen.c

@@ -0,0 +1,821 @@
+/******************************************************************************
+*
+* project name:    TI-68k Developer Utilities
+* file name:       ttebkgen.c
+* initial date:    24/08/2000
+* authors:         thomas.nussbaumer@gmx.net
+* description:     executes all steps till a complete eBook
+*
+******************************************************************************/
+
+/*
+  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 ttebkgen 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <time.h>
+
+#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.10"
+
+#define EMBEDDED_USE
+#include "ttsplit.c"
+#include "ttebkmeta.h"
+#include "packhead.h"    // compressed header definition
+#include "ttdos2ebk.c"
+#include "ttarchive.h"
+#include "bin2oth.c"
+#include "ttarchive.c"
+#undef EMBEDDED_USE
+
+//=============================================================================
+// outputs usage information of this tool
+//=============================================================================
+void PrintUsage() {
+    PRINT_ID("TTEbkGen");
+
+    fprintf(USAGE_OUT, "Usage: ttebkgen [flags] <infile> <varname> \"description\"\n\n"\
+                       "-t titlefile ... own title image - see Note (8)\n"\
+                       "-89          ... generate ONLY TI89 ebook\n"\
+                       "-92          ... generate ONLY TI92p ebook\n"\
+                       "-v           ... verbose (unsets -quiet)\n"\
+                       "-quiet       ... don't output standard messages (unsets -v)\n"\
+                       "-keepfiles   ... keep all temporary generated files (for debugging only)\n\n"\
+                       "the infile must contain the complete text of the final ebook.\n"\
+                       "split points must be marked within the inputfile with tag\n"\
+                       "<--split--> on a single line.\n"\
+                       "NOTES:\n"\
+                       " (1) the maximum uncompressed size of a ebook part is 65518 bytes.\n"\
+                       " (2) the final size of the ebook cannot extend 65608 bytes\n"\
+                       "     (including PC header infos)\n"\
+                       " (3) if a part is too long, define more splitpoints in the infile\n"\
+                       " (4) if the complete text will not fit into one ebook, split\n"\
+                       "     the text into two or more ebooks\n"\
+                       " (5) varname is used as outfile name and as varname on the calculator\n"\
+                       " (6) don't forget to enclose the description in quotes !!\n"\
+                       " (7) just the first 19 character of the description are used\n"\
+                       " (8) titlefile must be a 4-grayscale pic with 160x100 pixels in binary form\n"\
+                       "     generated with ImageStudio (not compressed binary)\n\n");
+}
+
+
+char* tmptitlename = "tt_tf00.bin";
+char* titlename    = 0;
+
+unsigned char default_image[] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xfe,
+0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xfe,
+0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x0e,
+0x00,0x7f,0xff,0x80,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0xff,0xff,0xff,0xef,
+0xff,0xf7,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0xcf,0xff,0xfc,0xef,
+0xff,0xff,0xfb,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0xbf,0xff,0xff,0xef,
+0xf0,0x03,0xfc,0x00,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0xff,0xff,0xff,0xaf,
+0xf0,0x03,0xfc,0x00,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0x7f,0xc0,0x7f,0xce,
+0x70,0x03,0xff,0xf0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0xff,0xc0,0x7f,0xce,
+0x70,0x03,0xff,0xe0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xce,
+0x70,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xfe,
+0x70,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xfe,
+0x70,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xfe,
+0x70,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xfe,
+0x70,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xfe,
+0x70,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xfe,
+0x70,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x03,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x07,0xfb,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x7f,0xff,
+0xf0,0x07,0xff,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfc,0x1f,0xff,
+0xf0,0x7f,0xff,0x80,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,
+0xf0,0x00,0x1f,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,
+0xf0,0x00,0x1f,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,
+0xf0,0x00,0x1f,0xc0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,
+0xf0,0x00,0x3f,0xe0,0x63,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0x80,0x00,0x1f,
+0xff,0xff,0xff,0xff,0xe3,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xe3,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xe3,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0xd7,0xd7,0xef,
+0xff,0xff,0xff,0xff,0xe3,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0x7f,0xfc,0xdf,
+0xf0,0x00,0x00,0x00,0xe3,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xc1,0xfc,0xef,0xb9,
+0xef,0xff,0xff,0xfe,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xc7,0xf0,0x07,0xf9,
+0xec,0xff,0xff,0xce,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xdf,0xe0,0x00,0xf9,
+0xeb,0xff,0xff,0xfe,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0xc0,0x00,0xf9,
+0xef,0xff,0xff,0xfa,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0x81,0xff,0xf9,
+0xe7,0xfc,0x07,0xfc,0xe7,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x7f,0x87,0xc0,0x39,
+0xef,0xfc,0x07,0xfc,0xe7,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x7f,0x1f,0x80,0x1f,
+0xff,0xff,0xc7,0xfc,0xe7,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xfe,0x7e,0x00,0x1f,
+0xff,0xff,0xc7,0xff,0xe7,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x19,0xfe,0xfc,0x00,0x1b,
+0xff,0xff,0xc7,0xff,0xe7,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x19,0xff,0xf8,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xe7,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x19,0xff,0xf8,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xe7,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xfd,0xf0,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xe7,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xff,0xf0,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xe7,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xff,0xf0,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xe0,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xe0,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xe0,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xfd,0xe0,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xfd,0xe0,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xff,0xe0,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x19,0xff,0xe0,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x19,0xfe,0xe0,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x19,0xff,0xe0,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x19,0xff,0xe0,0x00,0x01,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0x60,0x00,0x21,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x7f,0xe0,0x00,0x61,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0xf0,0x00,0xe1,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0xf0,0x01,0xc1,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xcf,0xe0,0x07,0xc1,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xc3,0xfd,0xcf,0x01,
+0xff,0xff,0xc7,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xc2,0xff,0xfe,0x01,
+0xff,0xff,0xc1,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xc1,0xa7,0xd0,0x03,
+0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xc0,0xfe,0x00,0x07,
+0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0xff,0xc0,
+0x0f,0xf8,0x00,0x01,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,
+0x0f,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,
+0x0f,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x03,0x80,0x00,
+0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x7c,0x00,0x00,0x70,0x07,0xc0,0x00,
+0x1f,0xef,0x1e,0x1e,0x03,0x9e,0x1e,0x00,0x00,0x00,
+0x00,0x00,0x00,0x7e,0x00,0x00,0x70,0x07,0x00,0x00,
+0x0f,0xf7,0xbf,0x3f,0x07,0xbf,0x3f,0x04,0x00,0x00,
+0x00,0x00,0x3c,0x77,0x3c,0x3c,0x76,0x0f,0x9e,0x36,
+0x03,0x87,0x3b,0xbb,0x87,0x3b,0x9b,0x86,0x00,0x00,
+0x00,0x00,0x7e,0x7f,0x7e,0x7e,0x7f,0x07,0xff,0x3f,
+0x03,0x87,0x1f,0xbb,0x8f,0x3b,0x87,0x86,0x00,0x00,
+0x00,0x00,0x7f,0x7e,0x77,0x77,0x7e,0x07,0x3b,0xbf,
+0x03,0x87,0x3f,0x1f,0x8e,0x1f,0x8f,0x3f,0x80,0x00,
+0x00,0x00,0x7f,0x77,0x77,0x77,0x7c,0x07,0x3b,0xb8,
+0x03,0x87,0x3b,0x8f,0x8e,0x0f,0x9e,0x1f,0xc0,0x00,
+0x00,0x00,0x72,0x77,0x77,0x77,0x7c,0x07,0x3b,0xb8,
+0x03,0x87,0x3b,0x87,0x9e,0x07,0xbc,0x06,0x00,0x00,
+0x00,0x00,0x3d,0x7f,0x3f,0x3f,0x76,0x07,0x1f,0xb8,
+0x03,0x8f,0x1f,0x9f,0x1c,0x1f,0x3f,0x06,0x00,0x00,
+0x00,0x00,0x1e,0x3e,0x1e,0x1e,0x33,0x03,0x0f,0x18,
+0x01,0x87,0x8f,0x0e,0x3c,0x0e,0x1f,0x82,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xfe,
+0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xfe,
+0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x1e,
+0x00,0x7f,0xff,0xc0,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x1e,
+0x00,0x0f,0xfc,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0x1f,0x80,0x7e,0x1e,
+0x00,0x07,0xfc,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0x3f,0x80,0x7f,0x1e,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0x7f,0x80,0x7f,0x9e,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0xff,0x80,0x7f,0xde,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0xff,0x80,0x7f,0xde,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1e,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xf8,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x7f,0xfe,
+0x00,0x07,0xfc,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x00,0x3f,0xfe,
+0x00,0x0f,0xfc,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xf8,0x00,0x07,0xfe,
+0x00,0x7f,0xff,0xc0,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xfe,
+0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xfe,
+0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xfe,
+0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xfe,
+0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x01,
+0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x01,
+0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x01,
+0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x0f,0xe0,0x11,
+0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x00,0xff,0xfe,0x11,
+0xe0,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x03,0xff,0x1f,0xf1,
+0xe0,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x07,0xf8,0x03,0xf1,
+0xe1,0xf8,0x07,0xe1,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x0f,0xe0,0x01,0xf1,
+0xe3,0xf8,0x07,0xf1,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x1f,0xc0,0x00,0x71,
+0xe7,0xf8,0x07,0xf9,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x3f,0x80,0x00,0x71,
+0xef,0xf8,0x07,0xfd,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x7f,0x00,0x00,0x31,
+0xef,0xf8,0x07,0xfd,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0x00,0x00,0x31,
+0xef,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0x00,0x00,0x11,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x19,0xfe,0x00,0x00,0x11,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x19,0xfe,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xfe,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xfe,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xfc,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xfc,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xfc,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xfc,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xfc,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xfe,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xfe,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xfe,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1b,0xfe,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x19,0xfe,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x19,0xfe,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0x00,0x00,0x01,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0xff,0x00,0x00,0x11,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x7f,0x80,0x00,0x31,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x3f,0x80,0x00,0x71,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x1f,0xc0,0x00,0xe1,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x0f,0xf0,0x03,0x81,
+0xff,0xf8,0x07,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x07,0xfe,0x3f,0x01,
+0xff,0xf0,0x03,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x01,0xff,0xfc,0x01,
+0xff,0x80,0x00,0x7f,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x1f,0xe0,0x01,
+0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x01,
+0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x03,0x80,0x00,
+0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x7c,0x00,0x00,0x60,0x06,0x00,0x00,
+0x1f,0xef,0x1e,0x1e,0x03,0x1e,0x1e,0x00,0x00,0x00,
+0x00,0x00,0x00,0x66,0x00,0x00,0x60,0x06,0x00,0x00,
+0x03,0x06,0x33,0x33,0x06,0x33,0x33,0x04,0x00,0x00,
+0x00,0x00,0x3c,0x66,0x3c,0x3c,0x66,0x0f,0x9e,0x36,
+0x03,0x06,0x33,0x33,0x06,0x33,0x03,0x04,0x00,0x00,
+0x00,0x00,0x66,0x7c,0x66,0x66,0x6c,0x06,0x33,0x3e,
+0x03,0x06,0x1e,0x33,0x0c,0x33,0x06,0x04,0x00,0x00,
+0x00,0x00,0x7e,0x66,0x66,0x66,0x78,0x06,0x33,0x30,
+0x03,0x06,0x33,0x1f,0x0c,0x1f,0x0c,0x3f,0x80,0x00,
+0x00,0x00,0x60,0x66,0x66,0x66,0x78,0x06,0x33,0x30,
+0x03,0x06,0x33,0x03,0x0c,0x03,0x18,0x04,0x00,0x00,
+0x00,0x00,0x62,0x66,0x66,0x66,0x6c,0x06,0x33,0x30,
+0x03,0x06,0x33,0x06,0x18,0x06,0x30,0x04,0x00,0x00,
+0x00,0x00,0x3c,0x7c,0x3c,0x3c,0x66,0x06,0x1e,0x30,
+0x03,0x0f,0x1e,0x1c,0x18,0x1c,0x3f,0x04,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
+
+
+//=============================================================================
+// delete temporary files
+//=============================================================================
+void CleanUp(int keepfiles) {
+    int i;
+    char tmpname[100];
+
+    if (!keepfiles) {
+        for (i=0;i<1000;i++) {
+            sprintf(tmpname,"tictp%03d.txt",i); // splitted input files
+            if (remove(tmpname)) break;
+        }
+        for (i=0;i<1000;i++) {
+            sprintf(tmpname,"tictp%03d.tmp",i); // converted input files
+            if (remove(tmpname)) break;
+        }
+
+        remove("tict.txt");
+        remove("tictbook.cfg");
+
+        if (tmptitlename == titlename) remove(tmptitlename);
+    }
+}
+
+
+//=============================================================================
+// copies files
+//=============================================================================
+int FileCopy(char* source, char* dest) {
+    FILE* fp_src = fopen(source,"rb");
+    FILE* fp_dest;
+    int   c;
+
+    if (!fp_src) return 0;
+
+    if (!(fp_dest = fopen(dest,"wb"))) {
+        fclose(fp_src);
+        return 0;
+    }
+
+    do {
+        c = fgetc(fp_src);
+        if (c == EOF) break;
+        fputc(c,fp_dest);
+    }
+    while (1);
+
+    fclose(fp_src);
+    fclose(fp_dest);
+
+    return 1;
+}
+
+#define EBK_NOTSPECIFIED  0
+#define EBK_TI89VERSION   1
+#define EBK_TI92PVERSION  2
+
+//=============================================================================
+// a main is a main is main .....
+//=============================================================================
+int main(int argc, char* argv[]) {
+    char* infilename  = 0;
+    char* varname     = 0;
+    char* description = 0;
+    FILE* fp;
+    char  buffer[1024];
+    char  tmpname[1024];
+    int   i;
+    int   count;
+    int   keep = 0;
+    char* ttdos2ebk_params[3];
+    //char* ttpack_params[4];
+    char* ttarchive_params[8];
+    //char* ttbin2bin_params[2];
+    int   ebk_type = EBK_NOTSPECIFIED;
+    int   verbose  = 0;
+    int   quiet    = 0;
+
+    ttdos2ebk_params[0] = "";
+    ttdos2ebk_params[1] = tmpname;
+    ttdos2ebk_params[2] = buffer;
+
+    if (argc < 4) {
+        PrintUsage();
+        return 1;
+    }
+
+    // parse arguments
+    for (i=1; i<argc; i++) {
+        if      (!strcmp(argv[i], "-keepfiles")) keep       = 1;
+        else if (!strcmp(argv[i], "-89"))        ebk_type   |= EBK_TI89VERSION;
+        else if (!strcmp(argv[i], "-92"))        ebk_type   |= EBK_TI92PVERSION;
+        else if (!strcmp(argv[i], "-v"))         quiet=0,verbose=1;
+        else if (!strcmp(argv[i], "-quiet"))     quiet=1,verbose=0;
+        else if (!strcmp(argv[i], "-t")) {
+            if (i == argc-1) {
+                PrintUsage();
+                return 1;
+            }
+            i++;
+            titlename = argv[i];
+        }
+        else if (!infilename)  infilename  = argv[i];
+        else if (!varname)     varname     = argv[i];
+        else if (!description) description = argv[i];
+        else {
+            PrintUsage();
+            return 1;
+        }
+    }
+
+
+    if (!infilename || !varname || !description) {
+        PrintUsage();
+        return 1;
+    }
+
+    CleanUp(0); // delete old files to make sure we won't process them
+
+    if (ebk_type == EBK_NOTSPECIFIED) {
+        ebk_type = EBK_TI89VERSION | EBK_TI92PVERSION;
+    }
+
+    if (!quiet) PRINT_ID("TTEbkGen");
+
+    //--------------------------------------------
+    // if no title file is given, generate default
+    // title file
+    //--------------------------------------------
+    if (!titlename) {
+        FILE *f;
+        titlename = tmptitlename;
+
+        if (!(f = fopen(titlename,"wb"))) {
+            fprintf(stderr,"ERROR: cannot generate temporary titlefile %s\n",titlename);
+            return 1;
+        }
+        if (fwrite(default_image,4000,1,f) != 1) {
+            fprintf(stderr,"ERROR: cannot generate temporary titlefile %s\n",titlename);
+            return 1;
+        }
+        fclose(f);
+    }
+
+
+    //--------------------------------------------------------
+    // check if files exists and if title file is of size 4000
+    //--------------------------------------------------------
+    if (!(fp=fopen(infilename,"r"))) {
+        fprintf(stderr,"ERROR: infile %s doesn't exists\n",infilename);
+        CleanUp(keep);
+        return 1;
+    }
+    fclose(fp);
+
+    if (!(fp=fopen(titlename,"rb"))) {
+        fprintf(stderr,"ERROR: titlefile %s doesn't exists\n",titlename);
+        CleanUp(keep);
+        return 1;
+    }
+    fseek(fp,0,SEEK_END);
+    if (ftell(fp) != 4000) {
+        fprintf(stderr,"ERROR: titlefile %s is not of size 4000\n",titlename);
+        fclose(fp);
+        CleanUp(keep);
+        return 1;
+    }
+    fclose(fp);
+
+
+    //-------------------------------------------------------------------------
+    // copy inputfile to "tict.txt" ...
+    //-------------------------------------------------------------------------
+    if (verbose) fprintf(stdout,"copying inputfile to tict.txt ...\n");
+    if (!FileCopy(infilename,"tict.txt")) {
+        CleanUp(keep);
+        return 1;
+    }
+
+    //-------------------------------------------------------------------------
+    // split "tict.txt" into "tictp000.txt", "tictp001.txt" ...
+    //-------------------------------------------------------------------------
+    if (verbose) fprintf(stdout,"splitting tict.txt ...\n");
+    {
+        char* parameters[] = {"","-s","<--split-->","-t","tict.txt"};
+        if (TTSplit(5,parameters)) {
+            CleanUp(keep);
+            return 1;
+        }
+    }
+
+    //--------------------------------------------------------
+    // converting files "tictp000.txt" into "tictp000.ebk"
+    //--------------------------------------------------------
+    if (verbose) fprintf(stdout,"converting parts ...\n");
+
+    for (i=0;i<1000;i++) {
+        sprintf(tmpname,"tictp%03d.txt",i);
+        fp = fopen(tmpname,"r");
+        if (!fp) break;
+        fclose(fp);
+
+        sprintf(buffer,"tictp%03d.tmp",i);
+        if (TTDos2Ebk(3,ttdos2ebk_params)) {
+            CleanUp(keep);
+            return 1;
+        }
+    }
+
+    count = i;
+    if (count == 0) {
+        fprintf(stderr,"ERROR: no data to process further\n");
+        CleanUp(keep);
+        return 1;
+    }
+
+    //--------------------------------------------------------
+    // generating ebook
+    //--------------------------------------------------------
+    if (verbose) fprintf(stdout,"generatic ebook .....");
+
+    fp = fopen("tictbook.cfg","w");
+
+    if (!fp) {
+        fprintf(stderr,"ERROR: cannot generate tictbook.cfg\n");
+        CleanUp(keep);
+        return 1;
+    }
+
+    fprintf(fp,"#%s\n",description);
+    fprintf(fp,"%s title 0 0 compress\n",titlename);
+
+    for (i=0;i<count;i++) fprintf(fp,"tictp%03d.tmp p%03d 0 0 compress\n",i,i);
+    fclose(fp);
+
+    if (ebk_type & EBK_TI89VERSION) {
+        ttarchive_params[0] = "";
+        ttarchive_params[1] = (verbose) ? "-v" : "-quiet";
+        ttarchive_params[2] = "-89";
+        ttarchive_params[3] = "-e";
+        ttarchive_params[4] = "ebk";
+        ttarchive_params[5] = "tictbook.cfg";
+        ttarchive_params[6] = varname;
+        ttarchive_params[7] = "tictebks";
+
+        if (TTArchive(8,ttarchive_params)) {
+            fprintf(stderr,"ERROR: eBook %s.89y generation failed.\n",varname);
+            CleanUp(keep);
+            return 1;
+        }
+
+        if (!quiet) fprintf(stdout,"eBook %s.89y sucessfully generated.\n",varname);
+    }
+    if (ebk_type & EBK_TI92PVERSION) {
+        ttarchive_params[0] = "";
+        ttarchive_params[1] = (verbose) ? "-v" : "-quiet";
+        ttarchive_params[2] = "-92";
+        ttarchive_params[3] = "-e";
+        ttarchive_params[4] = "ebk";
+        ttarchive_params[5] = "tictbook.cfg";
+        ttarchive_params[6] = varname;
+        ttarchive_params[7] = "tictebks";
+
+        if (TTArchive(8,ttarchive_params)) {
+            fprintf(stderr,"ERROR: eBook %s.9xy generation failed.\n",varname);
+            CleanUp(keep);
+            return 1;
+        }
+
+        if (!quiet) fprintf(stdout,"eBook %s.9xy sucessfully generated.\n",varname);
+    }
+
+    CleanUp(keep);
+    return 0;
+}
+
+//#############################################################################
+//###################### NO MORE FAKES BEYOND THIS LINE #######################
+//#############################################################################
+//
+//=============================================================================
+// Revision History
+//=============================================================================
+//
+// Revision 1.10 2009/01/25           Lionel Debroux
+// Changes by Romain Liévin and/or me for 64-bit compatibility.
+// Adapt to new version display (revtools.h).
+//
+// Revision 1.9  2002/03/14 11:27:19  tnussb
+// (1) new commandline parameter -89 (generate only TI89 ebook)
+// (2) new commandline parameter -92 (generate only TI92p ebook)
+// (3) new commandline parameter -v (verbose)
+// (4) new commandline parameter -quiet (suppress standard messages)
+// (5) TTBin2Bin usage replaced by second call to TTArchive
+// (6) TTPack usage removed (is now handled by TTArchive itself)
+//
+// Revision 1.8  2002/03/04 14:35:02  tnussb
+// No use of external TIGCC Tools anymore, but using now compiled-in versions.
+// This way this tool can be distributed by its own without the need of a
+// TIGCC Tools Suite installation.
+//
+// Revision 1.7  2002/02/07 09:49:37  tnussb
+// all local includes changed, because header files are now located in pctools folder
+//
+// Revision 1.6  2000/11/28 00:08:29  Thomas Nussbaumer
+// using now USAGE_OUT stream for usage info
+//
+// Revision 1.5  2000/10/18 23:21:35  Thomas Nussbaumer
+// filecopy is done now by own routine instead of a system call to support
+// linux
+//
+// Revision 1.4  2000/10/01 15:06:13  Thomas Nussbaumer
+// using now default title image if none is specified
+//
+// Revision 1.3  2000/08/26 19:07:09  Thomas Nussbaumer
+// using now inline split tag (much easier to handle than an external splitfile)
+//
+// Revision 1.2  2000/08/25 18:10:33  Thomas Nussbaumer
+// some corrections to usage text
+//
+// Revision 1.1  2000/08/25 18:06:30  Thomas Nussbaumer
+// initial version
+//
+//
+//

+ 84 - 0
tigcc/tools/ttebkmeta.h

@@ -0,0 +1,84 @@
+/******************************************************************************
+*
+* project name:    TI-68k Developer Utilities
+* file name:       ttebkmeta.h
+* initial date:    25/08/2000
+* author:          thomas.nussbaumer@gmx.net
+* description:     meta tags and control codes definitions
+*
+******************************************************************************/
+
+/*
+  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 ttebkgen 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
+*/
+
+#ifndef __TTEBKMETA_H__
+#define __TTEBKMETA_H__
+
+#define CCI 0x07  // control code indicator
+
+#define SBCC_FF         0x01  // formfeed
+#define SBCC_HR         0x02  // horizontal ruler
+#define SBCC_LEFT       0x03  // alignment left
+#define SBCC_RIGHT      0x04  // alignment right
+#define SBCC_CENTER     0x05  // alignment center
+
+//--------------------------------------------------
+// the runlength indicator is NOT a real single
+// byte control key !!!
+//--------------------------------------------------
+#define SBCC_RLI        0xff  // run length indicator
+
+//--------------------------------------------------
+// the following codes are just used during
+// preprocessing. they will not be in the final
+// ebook text
+//--------------------------------------------------
+#define SBCC_TRANS_ON         0xe0
+#define SBCC_TRANS_OFF        0xe1
+#define SBCC_REPLACE_ON       0xe2
+#define SBCC_REPLACE_OFF      0xe3
+#define SBCC_COLLAPSE_ON      0xe4
+#define SBCC_COLLAPSE_OFF     0xe5
+#define SBCC_DOUBLESPACE_ON   0xe6
+#define SBCC_DOUBLESPACE_OFF  0xe7
+
+
+#endif
+
+//#############################################################################
+//###################### NO MORE FAKES BEYOND THIS LINE #######################
+//#############################################################################
+//
+//=============================================================================
+// Revision History
+//=============================================================================
+//
+// Revision 1.2  2000/10/01 14:59:22  Thomas Nussbaumer
+// generic commit
+//
+// Revision 1.1  2000/08/27 23:51:17  Thomas Nussbaumer
+// initial version
+//
+//
+

+ 1 - 1
tigcc/tools/ttextract.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttextract.c
 * initial date:    13/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 2 - 2
tigcc/tools/tthelp.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       tthelp.c
 * initial date:    21/08/2000
 * author:          thomas.nussbaumer@gmx.net
@@ -58,7 +58,7 @@ int main(void) {
                        "ttdos2ebk   ... dos text to ebook conversion\n"\
                        "ttebkgen    ... ebook generator\n"\
                        "ttextract   ... extract from binary using start and endtoken\n"\
-                       "tthelp      ... prints tool list\n"\
+                       "tthelp      ... prints tool list - this tool\n"\
                        "tthex2bin   ... converts textfile with hex or binary numbers into a binary file\n"\
                        "ttinfo      ... prints infos about 89z/89s/89y/9xz/9xs/9xy files\n"\
                        "ttpack      ... packer\n"\

+ 1 - 1
tigcc/tools/tthex2bin.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       tthex2bin.c
 * initial date:    18/03/2002
 * author:          thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/ttinfo.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttchecksum.c
 * initial date:    21/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/ttpack.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttpack.c
 * initial date:    14/08/2000
 * authors:         albert@cs.tut.fi

+ 1 - 1
tigcc/tools/ttppggen.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttppggen.c
 * initial date:    28/09/2000
 * authors:         thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/ttsetname.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttsetname.c
 * initial date:    18/10/2002
 * author:          thomas.nussbaumer@@gmx.net

+ 1 - 1
tigcc/tools/ttsplit.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttsplit.c
 * initial date:    23/08/2000
 * authors:         thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/ttstrip.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttstrip.c
 * initial date:    13/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/tttiler.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       tttiler.c
 * initial date:    24/11/2000
 * authors:         thomas.nussbaumer@gmx.net

+ 1 - 1
tigcc/tools/ttunarchive.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttunarchive.c
 * initial date:    29/01/2002
 * authors:         thomas.nussbaumer@gmx.net

+ 213 - 0
tigcc/tools/ttunebk.c

@@ -0,0 +1,213 @@
+/******************************************************************************
+*
+* project name:    TI-68k Developer Utilities
+* file name:       ttunebk.c
+* initial date:    11/04/2001
+* authors:         albert@cs.tut.fi
+*                  thomas.nussbaumer@gmx.net
+* description:     unpacks ebooks
+*
+* -----------------------------------------------------------------------------
+*
+* based on code from Pasi 'Albert' Ojala, albert@cs.tut.fi
+*
+* heavily reduced to fit to the needs by thomas.nussbaumer@gmx.net
+*
+******************************************************************************/
+
+/*
+  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 ttunebk 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "unpack.c"
+
+#include "tt.h"          // generic defines
+#include "ttversion.h"   // TI-68k Developer Utilities version info
+#include "revtools.h"
+#include "ttunpack.h"    // errorcodes definition
+#include "packhead.h"    // compressed header definition
+#include "ttarchive.h"   // ttarchive definitions
+
+#ifdef FILE_REVISION
+#undef FILE_REVISION
+#endif
+#define FILE_REVISION "1.3"
+
+
+//=============================================================================
+// outputs usage information of this tool
+//=============================================================================
+void PrintUsage() {
+    fprintf(USAGE_OUT, "Usage: ttunebk <infile> <outfile>\n\n"\
+                       "       exports the complete text of an ebook to a plain textfile\n\n");
+}
+
+
+
+//=============================================================================
+// our main reason why we are here ...
+//=============================================================================
+int main(int argc, char* argv[]) {
+    unsigned char* src;
+    FILE*          fp;
+    char*          infilename  = NULL;
+    char*          outfilename = NULL;
+    unsigned long           insize;
+    int            nr_entries;
+    int            i;
+
+    PRINT_ID("TTUnEbk");
+
+    for (i=1;i<argc;i++) {
+        if (!infilename)       infilename  = argv[i];
+        else if (!outfilename) outfilename = argv[i];
+        else {
+            PrintUsage();
+            return 1;
+        }
+    }
+
+    //-------------------------------------------
+    // check if infile and out file are specified
+    //-------------------------------------------
+    if (!infilename || !outfilename) {
+        PrintUsage();
+        return 1;
+    }
+
+    if (!(fp = fopen(infilename, "rb"))) {
+        fprintf(stderr, "ERROR: cannot open input file %s\n", infilename);
+        return 1;
+    }
+
+    fseek(fp,0,SEEK_END);
+    insize = ftell(fp);
+    rewind(fp);
+
+    // treatment of PC header ...
+    insize -= 88;
+    fseek(fp,86,SEEK_SET);
+
+
+    if (!(src = (unsigned char*)malloc(insize))) {
+        fprintf(stderr, "ERROR: cannot allocate buffer\n");
+        fclose(fp);
+        return 1;
+    }
+
+    if (fread(src, 1, insize, fp) != insize) {
+        fprintf(stderr, "ERROR: cannot read %ld bytes from %s\n",insize,infilename);
+        fclose(fp);
+        free(src);
+        return 1;
+    }
+
+    fclose(fp);
+
+    if (!IsTTArchive(src+2)) {
+        fprintf(stderr, "ERROR: %s is not a valid eBook\n",infilename);
+        free(src);
+        return 1;
+    }
+
+    nr_entries = GetNrEntries(src+2);
+
+    //printf("%s contains %d entries ...\n",infilename,nr_entries);
+
+    if (!(fp = fopen(outfilename, "wb"))) {
+        fprintf(stderr, "ERROR: cannot open output file %s\n", outfilename);
+        return 1;
+    }
+
+    for (i=1;i<nr_entries;i++) {
+        TTAEntry*      entry = GetEntryInfo(src+2,i);
+        unsigned char* data  = GetEntryStart(src+2,entry);
+        PackedHeader*  ch    = (PackedHeader*)data;
+        unsigned int origsize;
+        unsigned char* dest;
+        int            result;
+
+        printf("processing entry %d ...\n",i);
+
+        if (ch->magic1 != MAGIC_CHAR1 || ch->magic2 != MAGIC_CHAR2) {
+            fprintf(stderr, "ERROR: format mismatch of part %d (skipping)\n",i);
+            continue;
+        }
+
+        origsize = ch->origsize_lo | (ch->origsize_hi << 8);
+        if (!(dest = (unsigned char*)malloc(origsize))) {
+             fprintf(stderr,"ERROR: cannot allocate %d bytes for output buffer\n",origsize);
+             free(src);
+             fclose(fp);
+             return 1;
+        }
+
+        result=UnPack(data,dest);
+        if (result) {
+            fprintf(stderr,"ERROR: cannot decompress (code %03d)\n",result);
+            free(src);
+            free(dest);
+            fclose(fp);
+            return 1;
+        }
+
+        if (fwrite(dest,1,origsize,fp) != origsize) {
+            fprintf(stderr,"ERROR: cannot decompress (code %03d)\n",result);
+            free(src);
+            free(dest);
+            fclose(fp);
+            return 1;
+        }
+        printf("%d bytes written to %s\n",origsize,outfilename);
+        free(dest);
+    }
+
+    free(src);
+    fclose(fp);
+    return 0;
+}
+
+//#############################################################################
+//###################### NO MORE FAKES BEYOND THIS LINE #######################
+//#############################################################################
+//
+//=============================================================================
+// Revision History
+//=============================================================================
+//
+// Revision 1.3  2009/01/25           Lionel Debroux
+// Changes by Romain Liévin and/or me for 64-bit compatibility.
+// Adapt to new version display (revtools.h).
+//
+// Revision 1.2  2002/02/07 09:49:38  tnussb
+// all local includes changed, because header files are now located in pctools folder
+//
+// Revision 1.1  2001/04/11 22:59:40  Thomas Nussbaumer
+// initial version
+//
+//

+ 1 - 1
tigcc/tools/ttunpack.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttunpack.c
 * initial date:    18/08/2000
 * authors:         albert@cs.tut.fi

+ 1 - 1
tigcc/tools/ttunpack.h

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttunpack.h
 * initial date:    14/08/2000
 * author:          thomas.nussbaumer@gmx.net

+ 2 - 2
tigcc/tools/ttversion.h

@@ -1,10 +1,10 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       ttversion.h
 * initial date:    13/08/2000
 * author:          thomas.nussbaumer@gmx.net
-* description:     TI-68k Developer Utilities (formerly TIGCC Tools Suite) version definitions
+* description:     TI-68k Developer Utilities version definitions
 *
 ******************************************************************************/
 

+ 1 - 1
tigcc/tools/unpack.c

@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-* project name:    TI-68k Developer Utilities (formerly TIGCC Tools Suite)
+* project name:    TI-68k Developer Utilities
 * file name:       unpack.c
 * initial date:    14/08/2000
 * authors:         albert@cs.tut.fi