So this is a port of pinfocom to the TI. What I did : -- Wrote a new "terminal interface" file titi.c which complies more or less with the specifications given in pinfo_ti.man -- Removed all code related to command line options, which means I entirely suppressed options.c and removed almost everything in the main function (infocom.c) -- Added my own (very limited) set of command line options -- Also #ifdef'ed out code related to preliminary version 4-5 support (other object format and alternate dictionary), removed code related to debugging the Z files (like object transfer display etc.) and to "informational" mode (if you want to get information about the file just do it on your computer before transferring it), and some functions which I think are useless (like verify() which computes the file's checksum -- do it on your computer), which saves some space -- Completed the header structure with info found in the Z-machine standard by Graham Nelson ; could be useful if we want to implement version 4 -- Removed all references to globals which don't exist in tigcc, like stdout, stderr and errno -- Entirely rewritten file.c for several reasons : * Use of native VAT functions instead of stdio ones. * Handling of the gamefile splitting and compression. The gamefiles are more than 64k so they can't fit in a single TI variable. Also, since they are big, I thought it would be a good idea to compress them, but decompressing everything at once into RAM would have taken up to 128k. Pinfocom was already designed to have only some blocks of the file loaded at any time, so I decided to pre-split the file into 4k blocks and compress each of them separately (with ttarchive and ttpack) in two archive files, the first file containing the first 16 blocks and the other the remaining blocks. I don't think there is any z-game which is less than 64k so the two files are required (however, if the game is really less than 64k the second one doesn't need to contain anything at all). * Handling of the savegame compression (as suggested in the Z-machine specifications by G. Nelson) : the original pinfocom simply dumped the modified dynamic z-memory to the savegame file. The compression method consists in XORing this modified memory with the original one from the game file to get lots of zeros, and then encoding sequences of zeros by a single zero followed by the number of zeros in the sequence. * suppressed the header conversion function (byte-order conversion is not needed for the 68000). -- Structural changes : * For several reasons, I #included all other C files into the main one, so that everything is now compiled at once. * Since in tigcc the memory is NOT automatically freed at program exit (by the way, perhaps it should be quoted more visibly in the docs), I replaced all calls to exit() so that exit is always done via the main function. More precisely, I modified the three init functions (init, pg_init and print_init) to return boolean values which indicate success or failure and not to use the xmalloc() and xrealloc() functions (which I removed) anymore. After initialization, I made sure that all exits were done through the quit() function, which I simplified and which now simply sets the QUIT_GAME flag to exit the main interpreter loop. NOTE : even if I simplified it, the quit() function of the original pinfocom was not very different, that is, it did not really exit, nor did the error() function. I kept it like that but am not now quite sure that this is such a good idea (in case of a problem with the gamefile it could happen that we continue reading garbage for a while before we return to the main loop, since NEXT_BYTE does not check for errors...) * The docs say that it is evil to use globals, and pinfocom uses a huge lot of them. But I noticed that many of them are constants (that is, for a given datafile) and computed in a very simple way, so I replaced them by macros. This means that I removed parts of the init() function (init.c) and added #defines in infocom.h instead ; to avoid parse errors I also had to comment out all extern declarations (I did it brutally with a regexp-replace on all files -- some of them were still valid but they were of no use anyway since all the c files are #included in the main one). * I also made all function declarations static instead of extern so that it would be possible to save space by declaring some of them inline, which I did (there are also a few modifications in the functions' order, in order for the inlining to work) So titi.c was created, options.c suppressed, file.c entirely rewritten, infocom.h, infocom.c and init.c largely changed, page.c and print.c slightly modified, and some code was removed in support.c (xmalloc, xrealloc, verify, ti_escape) and in object.c (debugging info). I think that's all.