Reverse engineering of Lode Runner for the Apple II series.
main.pdf is the literate programming document for this project. This means the explanatory text is interspersed with source code. The source code can be extracted from the document and compiled.
The goal is to provide all the source code necessary to reproduce a binary identical to the one found on the Internet Archive's Lode_Runner_1983_Broderbund_cr_Reset_Vector.do disk image.
The assembly code is assembled using dasm
.
This document doesn't explain every last detail. It's assumed that the reader can find enough details on the 6502 processor and the Apple II series of computers to fill in the gaps.
- Beneath Apple DOS, by Don Worth and Pieter Lechner, 1982.
- Apple II Computer Graphics, by Ken Williams, Bob Kernaghan, and Lisa Kernaghan, 1983.
- 6502 Assembly Language Programming, by Lance A. Leventhal, 1979.
- Beagle Bros Apple Colors and ASCII Values, Beagle Bros Micro Software Inc, 1984.
- Hi-Res Graphics and Animation Using Assembly Language, The Guide for Apple II Programmers, by Leanard I. Malkin, 1985.
This step should not be necessary, as the release provides the assembly files, the 6502 binary, and the PDF.
To compile main.nw
, you must use the noweb
package and a TeX
distribution such as TeX Live.
WARNING: The latest TeX Live, 2022, is known to break noweb
[bug]. Use TeXLive 2021 or earlier until the bug is fixed.
$ noweave -delay -index main.nw > main.tex
$ pdflatex main.tex
$ pdflatex main.tex
Yes, you have to run pdflatex
twice. The first run generates auxilliary information about indexes that the second run can use to properly cross-reference things.
First, you must place the filter script ignore_preuse_text.py
in /usr/lib/noweb
. Sorry Windows users, I don't know where to put your filter scripts.
The ignore_preuse_text.py
filter makes it so that uses of code blocks do not get extra indentation when that use is indented. This is important for the assembly language output, and makes the PDF output more pleasant to read.
$ notangle -filter ignore_preuse_text.py main.nw > main2.asm
$ python3 reorder_asm.py main2.asm > main.asm
$ dasm main.asm -f3 -omain.bin
reorder_asm.py
reads the main.asm
output, and reorders code blocks so that
their ORG locations are increasing. This is necessary because dasm
doesn't handle
code blocks whose origins jump around.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.