| orig | ||
| port | ||
| res | ||
| src | ||
| .gitattributes | ||
| .gitignore | ||
| ARCHITECTURE.md | ||
| Makefile | ||
| README.md | ||
| SESSION_RECOVERY.md | ||
Disassembly and analysis of SubLOGIC's Flight Simulator II (FS2) for the Apple II platform, circa 1984.
Two halves:
- Disassembly of the original 6502 binary under
src/(chunkschunk2.s..chunk5.s) plus the scenery-file code overlays (ovl25.sedit mode,ovl2d.sWW1 Ace,ovl42.sCtrl+E,ovl2b.sboot page).make validateenforces byte-identity against the original FS2 chunks and the overlay sections. - C port in
port/(SDL2). A byte-faithful C translation of the whole program (no 6502 emulation in the game) running over a 64K RAM image; it is verified tick by tick against a 6502 oracle run of the real binary (port/tools/verify/regress.sh). The edit-mode editor, the WW1 mode and the Ctrl+E page, which the original loads as 6502 overlays from the scenery file, are disassembled insrc/ovl*.sand translated too. Seeport/PORT_STATUS.mdandARCHITECTURE.md.
Disassembly
The target is @qkumba's ProDOS port of FS2, which has a custom loader which decompressess chunks of code/data into memory. The project primarily focuses on understanding those chunks, which represent the memory-resident code of the original FS2.
The cc65 tool chain is used; source files target the ca65 macro assembler; ca65 and ld65 must be available. Build via make and use make validate to verify that the built chunks (out/?_????-????) are byte-identical to the original chunks (orig/?_????-????), and that the overlay sources src/ovl*.s rebuild the FS2.1 file sections in orig/ovl_*.bin.
PRs welcome. Comments are strongly encouraged. Macro use for common patterns is also encouraged, where it helps understanding the original code.
Loader
The source for @qkumba's ProDOS loader is included. To build the binary, use make binary. The output will be out/fs2#062499. This requires the following addtional tools to be available on the command line.
apultra- https://github.com/emmanuel-marty/apultra (compression)acme- https://sourceforge.net/projects/acme-crossass/ (cross-assembler)
Note that the binary on its own is insufficient to actually run FS2; an adjacent file representing a full image of the 140k FS2 disk is required, which includes the dynamically loaded scenery database. This file (and more) are present on the orig/flight simulator 2 with scenery PRODOS (san inc pack).po. If you do build the binary, you can transfer it to a copy of that disk image and BRUN it.
Additionally, a out/loader.system#ff2000 file will also be produced. This can be transferred to a disk as a SYS file and executed to load/run the FS2 binary.