Sunday, November 5, 2023

Fun with LucasArts Classic Games: Make a Super Installer!

Make a super installer for all your classic LucasArts adventure games! Why? I have no idea!  

LucasArts Classic Adventures has five games. Monkey Island 2 and Indiana Jones and the Fate of Atlantis are not included, but both use the same installer format. So, we can add them to the Classic Adventures installer! Why? Why not?!?

This can be done just by modifying the original installer from LucasArts Classic Adventures:

Note the following is is all done in DOS (i.e., DOSBox or similar if there is no vintage machine available!).

Grab install.exe from the Classic Adventures Disk 1. We are going to remove the installation data at the end of the file so we can provide our own.  To do this, we need to use two DOS utilities:

lzexe.exe - Compresses exe files and appends a loader to automatically decompress when run.
unlzexe.exe - Decompresses exe files that have been compressed with LZEXE.

At a DOS prompt, run:

unlzexe install.exe
lzexe install.exe

There should now be:
INSTALL.OLZ - The original install file with install data.
INSTALL.OLD - Decompressed install file with no install data. 
INSTALL.EXE - Recompressed install file with no install data.

Now copy the updated the install.txt (contexts at end of this article) into same directory. Installation now works for all seven classic games, given all the archive files are present.

The install data can also be appended and install.txt deleted (install.old and install.olz can also be deleted). Append in DOS with:

type install.txt >> install.exe

Run install.exe and you should now see:


If you have all of the original archive files available, installation will work for all 7 games. The file list would look like this:

MANIAC_A XXX            401,060 26-08-1992  9:36
ZAK____A XXX            633,717 26-08-1992  9:33
LOOM___A XXX            394,088 08-09-1992 10:35
LOOM___B XXX            874,101 08-09-1992 10:35
INDY___B XXX            571,088 28-08-1992 10:00
INDY___C XXX          1,454,088 28-08-1992 10:00
INDY___D XXX          1,454,088 28-08-1992 10:00
INDY___E XXX             73,054 28-08-1992 10:00
MONKEY_E XXX          1,384,088 08-09-1992  9:41
MONKEY_F XXX          1,454,088 08-09-1992  9:41
MONKEY_G XXX            697,641 08-09-1992  9:41
PCV10__A MI2          1,426,088 21-11-1991 12:33
PCV10__B MI2          1,454,088 21-11-1991 12:33
PCV10__C MI2          1,454,088 21-11-1991 12:33
PCV10__D MI2          1,454,088 21-11-1991 12:33
PCV10__E MI2          1,445,727 21-11-1991 12:33
PCVIQA_A ND4          1,419,388 21-05-1992 10:11
PCVIQA_B ND4          1,454,088 21-05-1992 10:11
PCVIQA_C ND4          1,454,088 21-05-1992 10:11
PCVIQA_D ND4          1,454,088 21-05-1992 10:11
PCVIQA_E ND4          1,451,010 21-05-1992 10:11
INSTALL  EXE             24,927 05-11-2023 15:57

Have fun!

Contents of the new install.txt:

pcvdev_a.nd4
LucasArts(tm) Classic Adventures Archive 
GameDir
Please insert floppy disk #
Press any key to continue
Cannot find
Insert correct disk and press any key
Reading file
Installation Complete.
Extracting file
Cannot write file
Installation program for
Space needed for install
Space available on drive
Ignored unknown chunk:
Not enough space to install
Error!
(or A to Abort)
Hard drive on which to install program  (Use Arrow keys):
Floppy drive to read installation disks (Use Arrow Keys):
-----------------------------------------------------



Installation completed for this game

Press Any Key




-----------------------------------------------------
No disk in drive
Cannot find specified drive
Cannot create directory
Creating directory
TM & (c) 1992 LucasArts Entertainment Company.  All rights reserved.
-----------------------------------------------------



Error During Installation

Press Any Key to exit to Dos




-----------------------------------------------------
Select game(s) to install
(press number of game(s) to install, return when done)
                                                      
1) Maniac Mansion                                        
2) Zak McKracken                                         
3) Loom                                                  
4) Indiana Jones and the Last Crusade                    
5) The Secret of Monkey Island                           
6) Monkey Island 2: LeChucks's Revenge                   
7) Indiana Jones and the Fate of Atlantis                
maniac   maniac_a.xxx   1 //directory, filename, beginning disk#
zak      zak____a.xxx   1
loom     loom___a.xxx   1
indy     indy___a.xxx   2
monkey   monkey_a.xxx   5
monkey2  pcv10__a.mi2   1
atlantis pcviqa_a.nd4   1

30 95 78 0 

Files can be found on Github under Classics_SE.

Lucasfilm Games Archive Format

Byte offset Length Description
-- ALL ARCHIVE FILES --------------------------------------------------------------
0000 4 'LFG!'
0004 4 Length of this part of archive file.*
-- FIRST ARCHIVE FILE ONLY --------------------------------------------------------
0008 14 Archive filename, zero terminated. 
Max 12 characters; last byte ignored.
0016 2 Number of disks (archive files) that make up the total archive. Valid range is 1-10. 
Upper byte ignored.*
0018 4 Total space needed for all expanded files.*
-- FILE DATA, REPEATED FOR EACH FILE IN ARCHIVE -----------------------------------
4 'FILE'
4 Length of data that follows for the compressed file, until next 'FILE' marker or archive end.*
14 Filename, zero terminated. Max 12 characters; 
last byte ignored.
4 Final length of this file when expanded.*
2 2 - Meaning unknown. May be version numbers (major/minor/build, etc.). Ignored.
2 1 - See above. Ignored.
2 0 - See above. Ignored.
variable ... Compressed File Data, using PKZ 'implode' ...
-----------------------------------------------------------------------------------
*All multi-byte values are stored least-significant byte first. All lengths are in bytes.

(This table was a result of the work in Adventures in Useless Reverse Engineering, I just never posted it.)

Addendum:

All known 'LFG!' archives were recompiled with the lfgmake utility (also referenced in the earlier post).  The new archives can still be used with the original installer and even save a few bytes, as shown below.



Friday, May 26, 2017

Retro Machine: TIS-100

If you have not yet gotten your hands on a TIS-100, I highly recommend it.  It is a bit of a vintage item, but in many ways I believe it was way ahead of its time (much like the Amiga, which came out a decade later).  The name TIS-100 also harkens back to my first computer, the TS-1000 (known as ZX81 in the UK) with its 2K RAM. In any case, TIS-100 is a fun little machine to use to solve coding problems.  I haven't seen many on eBay, but there is a decent emulator available from Zachtronics.

And here's a handy quick reference guide to get you started:

TIS-100 (Tessellated Intelligence System) Quick Reference Guide

Basic Execution Node Instruction Set
NOP              NO OPERATION
MOV <SRC> <DST>  MOVE <SRC> TO <DST>
SWP SWAP ACC AND BAK
SAV SAVE ACC TO BAK
ADD <SRC> ADD <SRC> TO ACC
SUB <SRC> SUBTRACT <SRC> FROM ACC
NEG NEGATE ACC (NEG 0 = 0)
JMP <LABEL> JUMP TO <LABEL>
JEZ <LABEL> JUMP TO <LABEL> IF ACC = 0
JNZ <LABEL> JUMP TO <LABEL> IF ACC != 0
JGZ <LABEL> JUMP TO <LABEL> IF ACC > 0
JLZ <LABEL> JUMP TO <LABEL> IF ACC < 0
JRO <SRC> JUMP TO RELATIVE OFFSET <SRC>
                 (A value of 0 causes an infinite loop. Both
                 positive and negative jumps are bounded by the
                 node's first and last instructions.)
HCF HALT & CATCH FIRE
                 (Undocumented; resets the TIS-100.)


<SRC>            Refers to ACC, UP, DOWN, LEFT, RIGHT, ANY, LAST,
                 NIL, literal (-999...999)
<DST> Refers to ACC, UP, DOWN, LEFT, RIGHT, ANY, LAST, 
                 NIL
<LABEL> Refers to location marked by alphanumeric 
                 label '<LABEL>:'


# Indicates a comment in source.
## Indicates program title to the debugger.
! Triggers a breakpoint when using the debugger.


Registers
All registers and ports can store an integer in the range of -999 to 999.

ACC      The primary storage and computational register in
                 each node.

BAK              BAK cannot be directly addressed (see SWP, SAV).

UP, DOWN,  Each output port holds its value until read,
 LEFT, RIGHT  thereby behaving like an additional register. 

ANY              Reads to or writes from the next available port 
                 (UP, RIGHT, DOWN, or LEFT) that is receiving or 
                 sending a value.  
LAST             Maps to the last port selected by ANY. LAST maps to
                 NIL if ANY has not been used.

NIL              As a source, NIL maps to 0. As a destination, it 
                 has no effect.

Nodes
Up to 12 nodes are available per program. 
There are two types of nodes available on the TIS-100, Basic Execution and Stack Memory. Note that a defective or damaged node is automatically disabled.

Basic Execution Node (T21)
- Each node can run a subprogram with up to 15 instructions.  Labels
  are not considered instructions.
- When the last instruction in a node is run, execution continues 
  with the first. Note that this wraparound does not cost any 
  cycles.
Stack Memory Node (T30)
- Can hold up to 15 values.
- Supports push/pop from any connected port.
- Pop from an empty stack node will stall.
- Push to a full stack node will stall.
- Note that push/pop stalls can be recovered if another port is used
  to remove/add a value from the stack.

Cycles
- Writes take 2 cycles. Other operations require only one cycle 
  assuming data is available.
- The first "step" in a run does not count as a cycle.
- A cycle is needed to write out the last output port.


List of Sample Programs Included*

TIS-100 SEGMENT MAP

00150 SELF-TEST DIAGNOSTIC
10981 SIGNAL AMPLIFIER
20176 DIFFERENTIAL CONVERTER
21340 SIGNAL COMPARATOR
22280 SIGNAL MULTIPLEXER
30647 SEQUENCE GENERATOR
31904 SEQUENCE COUNTER
32050 SIGNAL EDGE DETECTOR
33762 INTERRUPT HANDLER
40196 SIGNAL PATTERN DETECTOR
41427 SEQUENCE PEAK DETECTOR
42656 SEQUENCE REVERSER
43786 SIGNAL MULTIPLIER
50370 IMAGE TEST PATTERN 1
51781 IMAGE TEST PATTERN 2
52544 EXPOSURE MASK VIEWER
53897 HISTOGRAM VIEWER
60099 SIGNAL WINDOW FILTER
61212 SIGNAL DIVIDER
62711 SEQUENCE INDEXER
63534 SEQUENCE SORTER
70601 STORED IMAGE DECODER

TIS-NET DIRECTORY

NEXUS 00.526.6   SEQUENCE MERGER
NEXUS 01.874.8   INTERNER SERIES CALCULATOR
NEXUS 02.981.2   SEQUENCE RANGE LIMITER
NEXUS 03.176.9   SIGNAL ERROR CORRECTOR
NEXUS 04.340.5   SUBSEQUENCE EXTRACTOR
NEXUS 05.647.1   SIGNAL PRESCALER
NEXUS 06.786.0   SIGNAL AVERAGER
NEXUS 07.050.0   SUBMAXIMUM SELECTOR
NEXUS 08.633.9   DECIMAL DECOMPOSER
NEXUS 09.904.9   SEQUENCE MODE CALCULATOR
NEXUS 10.656.5   SEQUENCE NORMALIZER
NEXUS 11.711.2   IMAGE TEST PATTERN 3
NEXUS 12.534.4   IMAGE TEST PATTERN 4
NEXUS 13.370.9   SPATIAL PATH VIEWER
NEXUS 14.781.3   CHARACTER TERMINAL
NEXUS 15.897.9   BACK-REFERENCE REIFIER
NEXUS 16.212.8   DYNAMIC PATTERN DETECTOR
NEXUS 17.135.0   SEQUENCE GAP INTERPOLATOR
NEXUS 18.427.7   DECIMAL TO OCTAL CONVERTER
NEXUS 19.762.9   PROLONGED SEQUENCE SORTER
NEXUS 20.433.1   PRIME FACTOR CALCULATOR
NEXUS 21.601.6   SIGNAL EXPONENTIATOR
NEXUS 22.280.8   T20 NODE EMULATOR
NEXUS 23.727.9   T32 NODE EMULATOR
NEXUS 24.511.7   WAVE COLLAPSE SUPERVISOR

*My machine appears to have had memory damage, as most of the sample programs listed in the directories were either corrupted or erased. I've reprogrammed some of them, with varying degrees of efficiency. I have included some for reference:
Back-Reference Reifer (661/9/42)
Histogram Viewer (2173/9/59)
Exposure Mask Viewer (808/7/50)
Sequence Gap Interpolator (790/5/58)
Sequence Merger (475/6/34)
Signal Multiplier (638/4/31)
Prime Factor Calculator (10884/4/49)
Signal Exponentiator (4259/6/34)

Fun with LucasArts Classic Games: Make a Super Installer!

Make a super installer for all your classic LucasArts adventure games! Why? I have no idea!   LucasArts Classic Adventures  has five games. ...