Professional Documents
Culture Documents
Lotus 123 For Linux
Lotus 123 For Linux
by Tavis Ormandy
Intro
Background
Progress
Lotus 1-2-3 for UNIX
A Mystery File
Hacking
GNU objcopy
Porting Problems
System Calls
Relocations
Incompatible Functions
Termios
Licensing
Result
Intro
It’s an exciting time
in the Lotus 1-2-3
enthusiast community –
that was a joke, there
is no enthusiast
😆
community, it’s just
me!
It really is an
exciting time though –
that part isn’t a
joke!
Background
I really like
Lotus 1-2-3, I
even maintain a
driver to make
sure it works
well on modern
systems. I had to
reverse engineer
the driver api to
make that happen,
but it works
beautifully.
Progress
Fast forward a year
or two, and I found
someone who used to
be a sysop in the
’90s BBS scene.
Check out his
website, he still
has a catalogue of
NFOs and a telnet
BBS online if you
want to see some
rad ANSI art!
He had kept tape backups from old BBS systems, and was
able to recover a warez copy of the SDK –
unbelievable! It actually worked, I was able to build
a few sample plugins!
You can download the ADK right here, and here is a
sample LPL program.
$ ls
123UNIX1.TD0 123UNIX2.TD0 123UNIX3.TD0
123UNIX4.TD0 123UNIX5.TD0 LEGAL.NFO
WHATITIS
$ file *.TD0
123UNIX1.TD0: floppy image data (TeleDisk)
123UNIX2.TD0: floppy image data (TeleDisk)
123UNIX3.TD0: floppy image data (TeleDisk)
123UNIX4.TD0: floppy image data (TeleDisk)
123UNIX5.TD0: floppy image data (TeleDisk)
$ file *.RAW
123UNIX1.RAW: tar archive
123UNIX2.RAW: ASCII cpio archive (pre-SVR4 or
odc)
123UNIX3.RAW: ASCII cpio archive (pre-SVR4 or
odc)
123UNIX4.RAW: ASCII cpio archive (pre-SVR4 or
odc)
123UNIX5.RAW: ASCII cpio archive (pre-SVR4 or
odc)
$ tar xf 123UNIX1.RAW
$ for i in 123UNIX{2..5}.RAW; do cpio -id < $i; done
1555 blocks
2606 blocks
2510 blocks
2481 blocks
$ ls -l
total 2.0M
-rw-r--r-- 1 taviso taviso 1.2M May 20 13:53
123.o.z_1
-rw-r--r-- 1 taviso taviso 717K May 20 13:53
123.o.z_2
-rw------- 1 taviso taviso 913 May 20 13:53
dl_init.o.z
-rwx------ 1 taviso taviso 77K May 20 13:53 ld.z*
-rwx------ 1 taviso taviso 14K May 20 13:53
mkdlobj.z*
-rw------- 1 taviso taviso 649 May 20 13:53 stub.o
-rw------- 1 taviso taviso 328 May 20 13:53 tail.o
-rw-r--r-- 1 taviso taviso 1.4K May 20 13:53
wyse50-lts123
Hacking
I can’t tell you how useful this discovery was – the
debug information answered so many questions I had
about Lotus 1-2-3 internals! This was a direct source
port from DOS, so it mostly worked the same way but
now I had debugging data. For example, I really wanted
to hook into the rasterizer in my driver so that I
could improve the appearance of graphs in the
terminal… but it was just too complex to understand
without documentation.
GNU objcopy
Okay… but there is one more big question, I know that
objcopy can convert COFF object files to ELF, the
format used by Linux. It seems like a long shot, but
🐧
is it possible I could link this into a native Linux
program?
Porting Problems
System Calls
The first problem is that Linux and UNIX do not use a
compatible system call interface. UNIX uses the lcall7
interface, so we need to find those calls and fix them
up. Here is how this object file calls open():
000e20d4 <open>:
e20d4: b8 05 00 00 00 mov eax,0x5
e20d9: 9a 00 00 00 00 07 00 call 0x7:0x0
e20e0: 0f 82 c6 01 00 00 jb e22ac
<_cerror>
e20e6: c3 ret
e20e7: 90 nop
Relocations
Incompatible Functions
if (stat("/etc/passwd", &sb) == 0) {
printf("Size: %u\n", sb.st_size);
}
Termios
Licensing
Incredibly,
after a bunch of
hacking it
actually runs
without
crashing!
…and refuses to
work without a
license, damn!
Well, I am a
legitimate licensed 1-2-3 owner
with a boxed copy
of 1-2-3, and this
is 32 year old
abandonware. I
think Mitch Kapor
will forgive me
for bypassing this
check.
�
systemname. If that all matches what the system
reports, the check passes!
Result
That’s it, Lotus 1-2-3 has been ported to a new
operating system. There are a few kinks that need to
be ironed out, and I need to port over my terminal
driver, but it is 100% usable. At the moment, the DOS
version running under emulation looks better - but
this can be fixed!