The fj command-line tool¶
fj is the FlipJump assembler and interpreter in one command. By default it does both: it assembles your .fj source files into a .fjm memory image and immediately runs it.
fj a.fj b.fj # assemble a.fj + b.fj (+ the STL) and run the result
The command is installed as the fj console-script when you pip install flipjump — see Installation.
Usage¶
fj [--asm | --run] [arguments] files [files ...]
files is one or more .fj source files (or, with --run, a single .fjm file). When you pass several .fj files they are concatenated in order, after the standard library.
A few real invocations (from fj’s own help text):
fj a.fj b.fj # assemble and run
fj a.fj b.fj -o out.fjm # assemble, save out.fjm, and run
fj code.fj -d -B swap_start exit_label # assemble and debug
fj --asm -o o.fjm a.fj -d dir/debug.fjd # assemble + save debug info
fj --asm -o out.fjm a.fj b.fj --no_stl -w 32 # assemble, no STL, 32-bit memory
fj --run prog.fjm # just run a prebuilt image
fj --run o.fjm -d dir/debug.fjd -B label # run and debug
Choosing a phase¶
By default fj assembles and runs. These two mutually-exclusive flags pick a single phase:
Flag |
Effect |
|---|---|
|
Assemble only. Run-time arguments are ignored. Pair with |
|
Run only. The positional argument is a |
Universal options¶
These apply in every mode:
Option |
Meaning |
|---|---|
|
The |
|
Don’t print assemble/run times or run statistics. |
|
Debug-file path, used for breakpoints. When you both assemble and run you may pass |
Assemble options¶
Ignored when --run is given.
Option |
Meaning |
|---|---|
|
Write the assembled |
|
Memory width in bits — one of |
|
|
|
Default |
|
LZMA2 compression preset |
|
Treat all assemble warnings as errors. |
|
Maximum macro-recursion depth the compiler allows. |
|
Don’t assemble/link the standard library. You’re then on your own for startup, I/O and everything else. |
|
Show macro code-size statistics. |
Run options¶
Ignored when --asm is given.
Option |
Meaning |
|---|---|
|
Print every opcode as it executes. Verbose — for the smallest programs only. |
|
Run the program but don’t print its output. |
|
On a failing run, show the last |
|
Pause when execution reaches a label named exactly |
|
Pause when reaching any label whose name contains |
Debugging¶
The -d/-b/-B options drive FlipJump’s interactive debugger. Breakpoints are matched against label names, so they need debug information: when you assemble and run in one go, -d (no path) keeps it in a temporary file for you; when you split the phases, write the debug file at assemble time (--asm -o out.fjm -d dir/debug.fjd) and feed it back at run time (--run out.fjm -d dir/debug.fjd -B label).
See also¶
Installation — getting the
fjcommand.The
.fjmbinary format — what-o,-vand-fproduce.Cheat sheet — the language itself on one page.