Sam Trenholme's webpage
This article was posted to the Usenet group alt.hackers in 1995; any technical information is probably outdated.

Bootstrap code


Article: 4925 of alt.hackers
From: Terje.Mathisen@hda.hydro.com (Terje Mathisen)
Newsgroups: alt.hackers
Subject: Bootstrap code
Date: 7 Jun 1995 18:19:45 GMT
Organization: Hydro Data, Norsk Hydro (Norway)
Lines: 116
Approved: Yes
Message-ID: 3r4qk1$hqv@vkhdsu01.hda.hydro.com
Reply-To: Terje.Mathisen@hda.hydro.com (Terje Mathisen)
NNTP-Posting-Host: sk08ts.hda.hydro.com
X-Newsreader: IBM NewsReader/2 v1.02
Status: RO

A few weeks ago, I posted a msg containing a program I had written that
ascii-encoded binary files so that you could use DEBUG as its decoder.

It had a tiny (40-byte) hex decoder which then processed the rest of the
input file, where each 32-bit binary dword had been extended to 5 ascii
chars.

Since then I received email stating a) that DEBUG is no longer a part of
Dos, and b) it could be done better, by writing a program that uses nothing
but printable ascii characters.  I got MAKEBOO.COM and UNBOO.COM as examples
of this approach.

>From  Jim Tucker I got another version, NETPIC, which works on the same
principle, but where MAKEBOO uses a uuencode-like process to pack 3 bytes
in 4 chars, Jim got better packing by storing 13 bits in two-character
pairs, using 91 different characters (91*91 > 2^13).

Based on their ideas, I wrote the enclosed program, TEXT.COM.  This can
be saved to disk and executed directly, and it will then recreate the
base91.zip file that's embedded inside it.  This Zip contains all the
source code for my encoder.

One feature that I like very much, is the way my program is partly self-
relocating, so it will adjust itself to handle either one or two-character
line terminators, i.e. this program can be saved as a Unix text file and
still be executable.

-Terje Mathisen (include std disclaimer) <Terje.Mathisen@hda.hydro.com>
"almost all programming can be viewed as an exercise in caching"

******* Save the rest of this message as TEXT.COM and run it! **********
ZRYQIQD[L@RX-g7-f61GDSXu&@,~P^P_O,!(GU(GZ(Gju4base91.zip<t<4<<<=
CFFFRX,`,`2$F=@!t.rQ0%IuL0%(%(%GERYAA 5t<(C)_Terje_Mathisen_1995
0P0PB#y#141m1#m#0Br#h#0_A#0^k#0t0>1k<#0&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