We Solve Your Difficult Problems: Forward Porting with Legacy Media and Code – Part 1

Forward Porting with Legacy Media and Code – Part 1

AlphaPixel often gets called upon to work on legacy codebases, sometimes VERY legacy. We have contact with code from the 80s and 90s on a regular basis, in a variety of dialects and languages, and stored and archived in various difficult containers and mediums.

 

A few years ago, we recovered source code and data from a SCSI drive from the late 80s, and then again from the 90s. This often involves reviving very old hardware, sourcing special adapters that are scarce and obscure, and using complex setups of virtual machines, emulators and real antique electronics to assemble a pipeline through which data can flow to modern environments.

 

After recovering data, many times it must be forward converted into more modern formats (many file  formats from decades ago are no longer supported by modern software) and often evolved into new languages or modern dialects of the same language in order to compile. Even after compiling, there are often issues with data sizes and GPU features, since modern 64-bit CPUs have capabilities that may trip up code anticipating it was running in the 32, 16 or even 8 bit era.

 

While NDAs and confidentiality mean we often can’t talk about our paid projects, we recently had an interesting side project that used the same processes, only it was all for fun, so we can talk all about it.

The task: Revive the Amiga source code for a basic educational raytracer written by our friend and early mentor, Brian Wagner.

 

In August/September 1991, during the era of powerful “big box” Amiga computers, when the Amiga was at the top of its game in the graphics and performance computation world, our friend Brian wrote a couple of articles for a short-lived programming magazine named AmigaWorld Tech Journal (henceforth AWTJ). At the time, I read the article but never compiled and ran the code. Recently, while mentoring some computer graphics Padawans myself, I had the bright idea to revisit that super-simple explanation of ray-tracing in its most basic form. But first, there were Difficult Problems to Solve.

 

First, I had, years ago, donated all of my collection of physical computer industry magazines and their accompanying 3.5” floppy “coverdisks” to archivists who promised to scan and duplicate their content to make available online. I can’t recall who even I sent them to to inquire about gaining access to them, so I had to start looking afresh.

Luckily, Archive.org seems to have a decent collection of good scans. In fact, I suspect these may actually be MY AWTJ magazines, as I think I recall contacting them and shipping them off, but my memory is hazy so I could be misremembering. Nonetheless, https://archive.org/search?query=amigaworld+tech+journal

 

I didn’t see the floppy disk contents archived there, and while I found mentions of them being in “The Zone” of the “English Amiga Board”, I found this website shortly thereafter:
https://chomikuj.pl/Amiga789/FTP++*26++Netsites/Grandis.nu/Uploads/Unkown/Amiga.Magazines.Disks/Amiga.World.Tech.Journal

 

It’s in Poland and Polish, but with Google Translate I was able to navigate enough to find the coverdisk for Volume 1 Issue 3 here:
https://chomikuj.pl/Amiga789/FTP++*26++Netsites/Grandis.nu/Uploads/Unkown/Amiga.Magazines.Disks/Amiga.World.Tech.Journal/Amiga_World_Tech_Journal_Vol_01-03,6973019755.adf

 

I successfully downloaded this to my Windows workstation. Hah! Success! Or IS it?

 

How do I crack open that ADF file? ADF is an Amiga-specific disk image file format similar to a .ISO file for a CD-ROM, or a .dmg/.smi/.img on MacOS or .wim/.vfd or similar on Windows. What reads and ADF these days? Turns out, precious little.

You CAN mount an ADF file as a virtual drive within an emulated Amiga environment using WinUAE or AmigaForever or similar. However, that only gains me access to the files from within a faux Amiga – it doesn’t get me the files within my native Windows environment. There are probably ways to transfer the files out of the emulated environment, and likely a way to mount the ADF as a Windows virtual drive, but I was impatient and kept looking.

 

There are apparently plugins for Total Commander and Directory Opus (plug: We love Directory Opus and you should try it and buy it. Period. Try the demo, it saves SO much time it will pay for itself in the first month of ownership.) I wasn’t able to get any of those to work, because they were quite old (later, I did get the DirectoryOpus one to work). I DID find an Open Source tool called ADFOpus (not related to Directory Opus except that it’s a file-manager type UI and was apparently named as a tip of the hat to Directory Opus). ADFOpus ran on modern 64-bit Windows despite last being updated in 2014. I was able to navigate the structure of the filesystem within the ADF file and locate the folder corresponding to the article I wanted “Wagner (p25)” and copy the files contained within to my Windows filesystem. The important file is called Tracer.lzh.

 

Great! We’re done, right? Nope!

 

In theory, the 7-zip utility and its library supports LHA/LZH archives. But trying to extract these LZH archives on Windows in 7-zip reports that the lh1 decompression method is unsupported. Further research indicates this is a known issue, reported in 2021 and there’s even a submitted patch to address it! But that patch has never been incorporated. Not feeling like patching and rebuilding 7-zip myself, because I’m lazy, I looked further. Had there been no other way, we could have rebuilt the patched 7-zip, or even used the Amiga lzh/lha utility within an emulator to unpack the archive, then exfiltrated the files inside out of the emulation environment.

 

But, an easier solution presented itself. I found an implementation of the lha tool in GnuWin, already compiled for Windows. Downloading and executing this in the command-line extracted the contents of the Tracer.lzh file (neat directory listing courtesy of Directory Opus for Windows):

 

Name                       Size Type                                                   Modified  Attr

free.c                439 bytes C Source File                                5/23/1991  3:45 PM -a-----

image.c                 2.38 KB C Source File                                5/23/1991  3:45 PM -a-----

load.c                  5.07 KB C Source File                                5/23/1991  3:45 PM -a-----

math.c                  7.12 KB C Source File                                5/23/1991  3:45 PM -a-----

pyrs                  250 bytes File                                         5/23/1991  3:45 PM -a-----

pyrsopts               59 bytes File                                         5/23/1991  3:45 PM -a-----

readme                  3.05 KB File                                         6/13/1991  9:41 AM -a-----

tracer                  17.4 KB File                                         5/23/1991  3:45 PM -a-----

tracer.c                6.08 KB C Source File                                5/23/1991  3:45 PM -a-----

tracer.h              630 bytes C Header Source File                         5/23/1991  3:45 PM -a-----

tracerFFP               17.6 KB File                                         6/10/1991  9:45 AM -a-----

TracerFFP.doc          86 bytes Microsoft Word 97 - 2003 Document            6/13/1991  8:58 AM -a-----

write.c                 1.28 KB C Source File                                5/23/1991  3:45 PM -a-----

 

They’re even wearing their original file metadata, including dates from spring 1991!

 

Hey, NOW are we done? Yes, for now. We’ve completed Phase One of my little pet project, reviving the source code of the AmigaWorld Tech Journal Ray Tracer by Brian Wagner. I started this lark at about 10:30pm one night after deciding I wasn’t interested in watching the last half of Captain America:Civil War again. I completed the task and uploaded the files to GitHub at about 8 minutes after midnight. Elapsed time for recovery, one hour, 38 minutes.

 

I have published all the data from the various stages of this exercise in a GitHub repository here https://github.com/XenonofArcticus/AmigaWorld-Raytracer-Brian-Wagner

 

This repository includes the PDF of the magazine, the ADF of the coverdisk, the lzh files, and the extracted contents of the Tracer.lzh archive.

 

Tune in next time when I quickly forward-port the code to a modern Windows compiler and make some improvements.

 

AlphaPixel solves difficult problems every day for clients around the world. In the past we’ve done extraordinary things, like recovering deleted forensic video evidence from SD cards, having old failed hard drives refurbished to rescue critical data, reverse-engineering proprietary data formats to liberate valuable siloed information, even desoldering surface mount chips and sucking their brains out with hardware exploitation devices. We’ve worked on common and exotic architectures and operating systems and environments from the 8-bit to the 64-bit, Motorola, Intel, ARM, RISC-V, PA-RISC, DEC Alpha, Power, and microcontrollers.

 

The path to rescuing old code and data and making it useful again is a journey, often akin to building a rope suspension bridge one plank at a time, while suspended in mid-air. Sometimes while being attacked by natives, a la Indiana Jones. Often there are interlocking chicken and egg problems, where the obvious solution won’t work because of one minor issue, which then cascades and snowballs into bigger problems. It’s not ucommon to find a bug or omission in some old tool you need to use, and when you go to fix it, you find the tool can no longer be compiled by modern toolchains, necessitating reconstruction of a side environment just to fix the problem that’s blocking you on the main endeavor. We’ve jokingly used the term “Software Archaeologist” in some contexts like these.

 

If you have a difficult problem you’re facing and you’re not confident about solving it yourself, give us a call. We Solve Your Difficult Problems.

 

We Solve Your Difficult Problems: Forward Porting with Legacy Media and Code – Part 1
Scroll to top

connect

Have a difficult problem that needs solving? Talk to us! Fill out the information below and we'll call you as soon as possible.

Diagram of satellite communications around the Earth
Skip to content