Using phxdec
The same reference as README.txt in the zip. The commands are the same on Windows, macOS and Linux.
The page
phxdec
phxdec -gui
Run phxdec with nothing after it, or double-click it, and it opens the Phoenix Decompiler page in your default browser. Everything the command line does for one program is there: drop a program on it, tick Verify, Restore hand patches, Run unknown depackers or Quick, and press Decompile. The page shows phxdec's output as it comes, lists the files it wrote (view the listings, download any file, save them all as one zip or into a folder you name), and the Names and Comments tabs edit the names and comments files to decompile again with them.
The page is served by phxdec on your own computer only, at the address phxdec prints. Leave phxdec's window open while you use it, and press Quit on the page (or Ctrl+C in the window) to stop it. Each run is phxdec itself run again with the options you ticked, so the page gives exactly the results of the command line. Light and Dark switch its theme.
Scan
The page's Scan mode runs -scan, -scancompilers or -scanextensions
on a folder, archive or disk image of your computer, with the options ticked. Each line shows as it
comes, success, partial and failed in colour, with a running count; Stop ends the scan, and its log can
be downloaded.
Clean up with AI
Under the listing, Clean up with Claude, Claude Code, ChatGPT, Gemini, Copilot, DeepSeek, Mistral or Grok
sends the decompiled listing, its names and comments files and every rule they follow to that AI on your
own account, in one request. The AI answers with real names and comments; phxdec checks the answer,
writes NAME.NAM and NAME.CMT, and decompiles again with them and -verify. If that run
stops on the files (a comment's line not found, say), it asks once more with the error.
| Button | What it needs |
|---|---|
| Claude | An Anthropic API key, or ANTHROPIC_API_KEY |
| Claude Code | No key: your Claude plan (Pro or Max), through Claude Code on this computer, signed in once with claude and /login |
| ChatGPT | An OpenAI API key, or OPENAI_API_KEY |
| Gemini | A Google AI Studio key, or GEMINI_API_KEY |
| Copilot | A GitHub token with the Models permission, or GITHUB_TOKEN (through GitHub Models) |
| DeepSeek | A DeepSeek API key, or DEEPSEEK_API_KEY |
| Mistral | A Mistral API key, or MISTRAL_API_KEY |
| Grok | An xAI API key, or XAI_API_KEY |
Give the key under "AI keys and models"; each service's model list then shows the models it offers your key. A key goes only to that AI service, and stays in the browser only when you tick Remember.
Decompiling
phxdec program.prg [out_name] [-verify] [-lib LIBRARY] [-names NAMES_FILE] [-comments FILE] [-nosearch] [-run] [-restore]
The files go beside the program, or to out_name (its extension is dropped):
| Program | Files written |
|---|---|
| GFA BASIC 3.x | NAME.LST, the listing as the editor's Save,A writes it; NAME.GFA, the tokenised file the editor loads and the compiler compiles; XMODULE.O for the linker when the program has $X procedures |
| GFA BASIC 1.x/2.x | NAME.LST and NAME.BAS, and phxdec prints the compiler options to use |
| Patched 1.x/2.x | NAME.PAT, the bytes no source gives; NAME_XXXX.BIN for each block of DATA the code takes, with a Devpac NAME_XXXX.S for each block of machine code |
| STOS BASIC | NAME.BAS, the tokenised source STOS loads, and NAME.ASC, the listing as text (see STOS BASIC) |
| Omikron BASIC | NAME.BAS, the tokenised source the interpreter loads, and NAME.LST, the listing as text (see Omikron BASIC) |
| Every program | NAME.NAM and NAME.CMT, the starter names and comments files (see Names and comments) |
| Packed programs | NAME.UNP, the program depacked |
phxdec says which compiler the program was made with, and prints the exact -compile
command that rebuilds it with the same compiler and options. Lines it can't follow are kept as
' ?? comments, so the listing always loads.
| Option | What it does |
|---|---|
-verify | Compile the source again with the program's own compiler, write it as NAME.RE and compare it with the original byte for byte |
-lib LIBRARY | 3.x: match the program with this library (a GFA3BLIB or a fingerprint file), for a program linked with a patched library |
-names FILE | Give variables, procedures and labels real names, one generated_name new_name pair a line (GFA, STOS and Omikron BASIC) |
-comments FILE | Add comments to the listing, anchored to the units and lines they go with |
-nosearch | Skip trying the forms the compiler decides. Quicker, but the source may compile a little differently |
-run | Depack a program packed with an unknown packer by running its own depacker in the built-in 68000 interpreter |
-restore | Put back the original instructions of the hand patches phxdec recognises, then decompile the restored program (saved as NAME.RES) |
A 3.x program linked with a library patched in a way phxdec knows is recognised, and -verify
links with the library patched the same way. One example is the Falcon fix that patches out the
Line-A mouse calls of HIDEM and SHOWM.
Verifying
-verify prints one verdict and sets the exit status:
verified: recompiles byte-identical
differs: first difference at $xxxx (sizes original/recompiled)
For 3.x, phxdec also prints how many units (procedures, functions and the main program) match, and which differ.
Some programs can't compile to the same bytes from any source, because the file isn't just what the compiler wrote. It may have been patched or cracked after compiling, padded or cut when it was copied, or damaged, or it may hold bytes left over from an earlier compile. The decompiled source of such a program is still right; only the file differs. phxdec counts these as the same:
- pad bytes the compiler left to chance
- a desk-accessory start-up added after compiling
- the file ending, and a symbol table the original holds
- a hand patch that phxdec can name and put back
Hand patches
Where the bytes show that a program was patched after compiling, the verdict names the patches, such
as "hand-patched: nop in place of bne.s at $3074". -restore puts the original instructions
back, saves the restored program as NAME.RES, decompiles that and, with -verify, compares
against it:
restored: addq.l #4,a3 at $3074 (was nop)
The patches go in NAME.PAT as the program has them, so the patched program can be rebuilt exactly:
phxdec -compile NAME.LST -patch NAME.PAT
-verify checks this by writing NAME.PAT over the recompiled program, as
-compile -patch does. When that doesn't give the program as found, a program that otherwise
recompiles byte-identical is only partly verified:
NAME.PAT: checked: -compile -patch NAME.PAT gives the program as found
Damaged programs
A copy that lost code to a sector of zeros, or holds foreign bytes from a sector boundary, is reported as damaged, with the offset. The decompiled source is still right as far as the damage allows.
The original file is never changed. Patches phxdec can't name stay as they are and are still reported.
Compiling
phxdec -compile NAME.GFA|NAME.BAS|NAME.LST [out.prg] [-compiler NAME] [-opts OPTIONS] [-lib LIBRARY] [-acc] [-keep ROUTINES] [-patch NAME.PAT] [-pack PACKER]
The built-in GFA, STOS and Omikron compilers as a command-line compiler (see Omikron BASIC for its options). The program goes to
out.prg, or to NAME.PRG by default. A .BAS is compiled with the 1.x/2.x compiler, or with
the STOS compiler when it is a STOS source. A .LST is tokenised first, so keep the .GFA or .BAS that
phxdec wrote beside it and the variables stay where they were.
| Option | What it does |
|---|---|
-compiler NAME | The compiler to use, as phxdec -compiler list names them ("3.6 TT D", "3.02 E", "2.02 GB issued 1987-09-16", "2.06" ...). The default is the version a .GFA names, 2.02 GB for a 1.x/2.x .BAS and 2.06 for a STOS source |
-opts OPTIONS | 1.x/2.x compiler options: stop=ever|loop|never, errors=text|no, bombs=+|-, trapv=+|-; or a STOS compile's settings as decompiling prints them |
-lib LIBRARY | 3.x: link with this library instead of the version's own |
-acc | 1.x/2.x: make the program into a desk accessory |
-keep ROUTINES | 1.x: have the compiler take these runtime routines (hex numbers, comma separated) |
-patch NAME.PAT | 1.x/2.x and STOS: write the patch file decompiling or -verify wrote over the compiled program |
-pack PACKER | Pack the compiled program with one of the built-in packers |
-compiler list marks some 1.x/2.x compilers as synthetic. They aren't
releases GFA Systemtechnik made. Each one is a real compiler with another release's changes put in,
standing in for a release no copy has been found of, so that programs made with it can be verified.
STOS BASIC 
phxdec PROGRAM [out_name] [-verify] [-run]
phxdec SOURCE.BAS
A program compiled with the STOS BASIC compiler, run from GEM or from STOS, packed or not, is
decompiled to NAME.BAS, the tokenised source STOS loads, and NAME.ASC, the
listing as text. A tokenised STOS source (.BAS) given to phxdec is listed to NAME.ASC: it is already a
source, so there is nothing to decompile. The compiler doesn't keep variable names or REM lines, so
the names are made up.
-verify compiles the source again with the real STOS compiler built in, with its
libraries and the extensions the program was made with, and compares it with the program as for GFA
BASIC. Decompiling prints the command that compiles the source to the program again, and writes the
files it needs beside the source:
phxdec -compile NAME.BAS -compiler 2.06 -opts gem,comptest=1,...
-opts holds the settings the program was compiled with. Files the program copied in (fonts,
window and sprite libraries, the mouse) that aren't the compiler's own are written as NAME_FILE.
Compiler builds
Each build is named by the version it gives itself:
| Build | What it is |
|---|---|
1.1 | Mandarin (Jawx), with STOS BASIC 2.04 |
2.05 | Mandarin (Jawx), with STOS BASIC 2.05 |
2.06 | Mandarin (Jawx), with STOS BASIC 2.06 |
2.07 | The 2.07 update of the compiler only, with the STOSSER #17 bug fixers (1992) |
2.07 (Anthony Jacques) | Community: his STOS v2.07 Loader Program |
3.0 | Community: 2.08 patched for all TOS versions by P. Putnik and exxos, March 2014 |
Extensions
A STOS program calls the compiler part of each extension it was made with (NAME.ECx, x the slot it loads into, A to Z), and a source names the extension's commands from its interpreter part (NAME.EXx). These are built in (C: compiler part, I: interpreter part):
| Slot | Extension | Parts |
|---|---|---|
| A | COMPACT | C, I |
| B | TML Help (The Thug) | I |
| C | COMPILER | C, I |
| D | Maestro (several builds) | C, I |
| D | STE sound | C |
| D, F | GEMMA 1.52 | I |
| E | Squasher | C |
| F | STE Extension 3.0, 3.1, 3.5, 4.0 (Asa Burrows) | C, I |
| F | SixSticks 2.3 (A & L) | I |
| F | Sticks | I |
| G | Blitter 1.0, 1.1 (A & L); Storm/GBP Blitter 1.0 | C, I |
| G | Fast 1.0 (Baz Molloy) | C, I |
| H | Stars 2.6 (Lee Upcraft) | C, I |
| I | Codetext | C, I |
| M | Musician 0.06 (MIDI) | C, I |
| M | Misty (Top Notch) | C, I |
| N | Graphic-Extract 1.0 | C, I |
| N | RNC | C |
| N | Bitmania | I |
| P | Propack 1.00 (A. Cato) | C, I |
| P | GBP 4.7 | I |
| P | Dreams (Brian T. Innes) | I |
| Q, R, S | Missing Link (Top Notch), several builds | C, I |
| S | STOS 3D | C, I |
| S | STOS Tracker 7, 10 and 14 kHz | C |
| S | ICBIS 1 (Richard Hunt) | I |
| T | Ninja Tracker 1.05 | C, I |
| T | TOME (1989), TOME 2.1 (Shadow Software) | C, I |
| U | Spectrum 512 1.8 | I |
| U, V | Eagle 0.8 (David Haylett) | C, I |
| V | STOS Vidi 1.00 | C, I |
| W | Control 3.00, 3.02, 3.05a, 3.05b, 3.06b (L.J. Greenhalgh) | C, I |
| W | Border (Orbital Software) | C, I |
| W | EG example extension (M. Cubitt) | C |
| X | Falcon Extension 1.4 (Anthony Jacques) | C, I |
| Y | Cyber 1.00 (A. Cato, M. Cubitt) | C, I |
| Y | Falcon audio | C |
| Z | Extra 1.01, 1.70, 2.10, 3.21, 3.26 (Martin Cubitt) | C, I |
| Z | Magnetic 3.6 (Ben Riley) | I |
| Z | Modem, Usefull | C, I |
When a program calls a version of an extension that isn't built in, its calls are taken as
the nearest routines of a version that is, and phxdec says so ("made with a version of extension Z
phxdec does not have"). Please report such programs on the
support forum, so the extension can be
added. -scanextensions (see Scanning) finds the extensions in a
collection that phxdec doesn't have.
STOS fixers
A STOS fixer (STOS Fixer, STOS_FIX and the like) changes a program's start-up code after compiling. When
it rewrites the table of TOS addresses or the TOS check, -verify takes that for a hand
patch: it goes in NAME.PAT and -restore puts it back. When it gives the program another
compiler's longer start-up code, decompiling saves that as NAME_STARTUP.BIN, with a NAME.PAT that
splices it into the compile, and the printed command has -patch NAME.PAT.
Omikron BASIC
phxdec PROGRAM [out_name] [-verify]
phxdec SOURCE.BAS
phxdec -compile SOURCE.BAS|SOURCE.LST [OUT.PRG] [-compiler NAME] [-opts link[=OON][,all]]
A program compiled with the Omikron BASIC compiler (2.x, 3.x or 4.x), one that loads its library
(BASLIB, BASLIB_3, BASLIB_4) or one linked with it by CUTLIB, packed or not, is decompiled to
NAME.BAS, the tokenised source the interpreter loads, and NAME.LST, the listing
as text with each variable's type suffix. A tokenised Omikron BASIC source given to phxdec is listed to
NAME.LST. The compiler keeps no variable names or REM lines, so the names are made up (L1%L, S2$, D3#);
it keeps the line numbers when the program was compiled with them.
The Omikron BASIC decompiler is new in 1.2 and doesn't know all of the library's routines
yet: code it doesn't know is kept in its line as a REM ?? with the instructions, and the
result is partial. Please report such programs on the
support forum.
-verify compiles a fully decompiled program again with the real Omikron BASIC compiler, with
the build of the library the program was made with (linking it with CUTLIB when the original was
linked), and compares the two byte for byte. The word holding the serial number of the compiler's copy
is left out of the comparison, and phxdec says when it differs.
Compiler builds
| Build | What it is |
|---|---|
2.3E | Compiler V2.3E, with BASLIB 2.0 and CUTLIB (the 2.2 disk) |
2.4E | Compiler V2.4E, with BASLIB 2.4 and CUTLIB |
3.00 | Compiler V3.00, with BASLIB 3.00 (programs that load BASLIB_3) |
3.05 | Compiler V3.05 (French), with BASLIB 3.05 and CUTLIB2 |
3.06 | Compiler V3.06, with BASLIB 3.05 and CUTLIB |
3.59E | Compiler 3.59E, with CUTLIB, BASLIB and FPULIB 3.57 |
4.08E_3.56, 4.08E_3.57 | Compiler 4.08E, with BASLIB_4 4.06, CUTLIB, and BASLIB and FPULIB 3.56 or 3.57 |
Decompiling prints the command that compiles the source to the program again:
phxdec -compile NAME.BAS -compiler 4.08E_3.57 -opts link
-compile takes a listing (.LST) too, as decompiling or the editor's SAVE ,A writes it.
-opts link has CUTLIB link the library into the program; for the 2.x and 3.x CUTLIB,
link=OON gives its three answers and all adds its -999.
Scanning
phxdec -scan PATH [-recurse] [-verbose] [-run] [-test [-cache] [-restore]] [-gfa] [-stos] [-omikron] [-log FILE] [-disable FORMATS]
Lists the GFA BASIC, STOS BASIC and Omikron BASIC programs in a file or folder, looking inside ZIP, LZH and ARJ archives, .ST, .MSA and .STX disk images, the disks of PMK v1.2 RAM disk programs and CD-ROM .ISO images, nested to any depth. Each program is printed with its path through the archives, its compiler and any packers. STOS sources (.BAS, .ACB) and memory banks (.MBK) aren't programs and aren't listed:
GAMES.ZIP/DISK1.ST/AUTO/FOO.PRG, GFA BASIC Compiler 3.6 TT D, packed (Ice 2.40)
| Option | What it does |
|---|---|
-recurse | Scan the folders below PATH too |
-verbose | List each archive, image or file that couldn't be read, with the reason |
-run | Also find programs packed with an unknown packer, by running their own depacker (up to about a second a program) |
-test | Decompile and verify each program found, and print the result in colour |
-cache | With -test: test each program once; a copy of one tested before in the same scan takes its result |
-restore | With -test: put back the hand patches phxdec recognises before verifying each program, as -verify -restore does |
-gfa, -stos, -omikron | List only those BASICs' programs (none of them: all three) |
-log FILE | Write every line to FILE as well, without colours, as the scan goes |
-disable FORMATS | Leave out the containers named, comma separated: iso, st, msa, stx, zip, lzh, arj, or diskimage and archive for each group, e.g. -disable iso,stx |
GAMES.ZIP/DISK1.ST/AUTO/FOO.PRG, GFA BASIC Compiler 3.6 TT D: success - verified: recompiles byte-identical
tested 120: 95 success, 22 partial, 3 failed (41 copies of programs tested before, not tested again)
A scan writes no files. With -test, the files decompiling writes go to a temporary folder
that is removed after each program.
Compilers and extensions
phxdec -scancompilers PATH [-recurse] [-verbose] [-gfa] [-stos] [-log FILE] [-disable FORMATS]
phxdec -scanextensions PATH [-recurse] [-verbose] [-log FILE] [-disable FORMATS]
-scancompilers lists the compilers instead, through the same folders, archives and disk
images: GFA BASIC's compilers, linkers and libraries, and STOS BASIC's compilers and libraries.
-scanextensions lists the STOS BASIC extensions, each part (.ECx or .EXx) with its slot
and its version text. Each file is "known" when phxdec has the same bytes built in, else "NEW": those
are the files worth sending in.
DISKS/STOS.MSA/COMPILER/COMPILER.PRG, STOS BASIC compiler, Stos basic compiler V 1.0 by Francois Lionet,
packed (Pompey Packer v1.5): known (build 1.1 COMP_204.PRG)
GBP/GBP.EXP, STOS BASIC extension, slot P, interpreter part, STORM/GBP Extension V4.7 (c)STORM '94 **: known
Unpacking and packing
Packed programs are depacked before decompiling, by phxdec's own routine for the packer or by the packer's own depack routine run in the 68000 interpreter. These packers are known:
| Packer | Versions |
|---|---|
| Atomik | 3.1, 3.3, 3.3B, 3.5 |
| Automation | 2.3, 2.4, 2.51 (normal, buffer and chunked), 5.01 (normal, buffer and chunked) |
| CHFI/IMP Packer | |
| Fire Packer | 1.01 (data files only), 2.01 |
| JAM Packer | 2.4/3.0 (V2), 3.0 and 4.0 (LZH), 4.0 (LZW, Ice and V2) |
| Pack-Ice | 1.13, 2.11, 2.12, 2.20, 2.31, 2.34, 2.40 |
| PFX/AFX-Packer | 2.1 (PFX 1.13P) |
| Pompey Pirates Packer | 1.5, 1.9, 1.9a |
| Powerpacker | 2.0, 3.0, 4.0 |
| RNC Packer | |
| Sentry | 2.05 |
| Speed Packer | 2.0, 3.0 |
| STCS Packer | |
| UVK 2000's packer |
A program packed with any other packer can be depacked with -run. To unpack a program only,
GFA BASIC or not:
phxdec -unpack FILE
GAME.PRG: unpacked (Ice 2.40), 81234 bytes to 196608 bytes, saved as GAME.UNP
Result: success - unpacked (Ice 2.40)
To pack a program with one of the built-in packers (phxdec -pack list names them):
phxdec -pack FILE PACKER [OUT]
The built-in packers are the packer programs themselves, run in the 68000 interpreter, so the packed file is the one the packer writes:
- Automation Packer 2.31, 2.41, 2.51 and 5.01
- LSD Packer 1.2, 1.5 and 2.2, and JEK Packer 1.2d
- Atomik Cruncher 3.3, 3.5 and 3.6
- Pompey Pirates Packer 1.5 and 1.9a
- JAM Packer 3.0 and 4.0 (each of their methods)
- Pack-Ice 1.13, 2.11, 2.12, 2.20, 2.31, 2.34 and 2.40
- PFX/AFX-Packer 2.1 (PFX 1.13P) by Thomas Quester and Markus Fritze
-verify of a program that holds one of their stubs packs the recompiled program the same
way and compares it with the packed original too:
repacked with JAM Packer 4.0 (LZH): the same as the packed original
A program packed with a packer phxdec doesn't know can still be depacked with
-run. phxdec then prints "depacked by running its own depacker (packer not recognised ...)".
Please report these programs on the support
forum, so the packer can get a routine of its own.
Names and comments
A decompiled listing has made-up names such as v02ce, proc_0023c,
I4% or S3$, and no comments. Every decompile, of GFA BASIC 1.x, 2.x or 3.x,
STOS BASIC or Omikron BASIC, also writes two starter files beside the listing:
NAME.NAM: every generated name the listing uses, each paired with itself (v02ce v02ce), under#headings;NAME.CMT: the heading of every unit (@ main,@ PROCEDURE proc_0023c), with no comments yet.
Change the names on the right, add comments under the headings, and decompile again with them, so the listing still recompiles byte for byte:
phxdec GAME.PRG -names GAME.NAM -comments GAME.CMT -verify
# procedures
proc_0023c draw_board
# variables and arrays
v02ce counter
In the comments file, the ' lines after a heading go before that unit; ^ text
picks the next line of the unit starting with text, and the ' lines after it go before that
line, a ! text line at its end.
@ PROCEDURE proc_0023c
' Draws the whole board
^ v02ce%=v02ce%+1
! one more move
The page's Clean up with AI buttons do all of this in one click with your own AI
account. The prompts/ folder in the zip has prompts to do it by hand with an AI assistant,
one prompt file at a time.
Results and exit status
Every run ends with one result line, printed last, in green, yellow or red on a colour console:
Result: success - every line decompiled
Result: partial - 2 of 6768 lines not decompiled (kept as ' ?? comments)
Result: success - recompiles byte-identical
Result: success - recompiles byte-identical apart from a hand patch: nop in place of trap #1 at $f2
Result: success - recompiles byte-identical after restoring 1 hand patch
Result: partial - decompiled, but recompiles differently: 20 of 25 units match
Result: success - wrote NAME.PRG
Result: failed
| Exit status | Meaning |
|---|---|
0 | Done. With -verify, the program recompiles byte-identical (apart from its file ending or a symbol table it holds) |
1 | -verify: the program differs |
2 | The program couldn't be decompiled, or the source didn't compile |
Also: phxdec on its own opens the page, phxdec -h prints the usage text and
phxdec -version prints the version number only.