Input / OutputΒΆ

FlipJump has no read or write instruction. I/O happens at fixed bit-addresses that the runtime watches.

OutputΒΆ

Flipping a specific bit at the I/O opcode address sends one output bit to stdout. The exact address is exposed by stl.startup as the label IO:

ns stl {
    def startup code_start > IO {
        ;code_start
      IO:                       // exposed: this address IS the I/O opcode
        ;0
    }
}

After running stl.startup, the address of IO is known to the rest of the program. To emit a 0 bit, flip the low bit of IO; to emit a 1, flip a different bit. The STL’s stl.output_bit and stl.output_char wrap the bit-flipping pattern.

Bytes are output LSB first by flipping eight consecutive bits in sequence.

InputΒΆ

The next input bit is automatically loaded by the runtime at the bit-address 3*w + #w (this is dbit + dw from the I/O opcode). Read it by jumping based on the bit value:

.if0 input_bit, branch_for_zero, branch_for_one

The runtime reloads the next bit on each read. End-of-input is signalled by the input slot being permanently 0 (or by the runtime keeping the program looping until interrupted β€” implementations vary).

Higher-level wrappersΒΆ

User code rarely touches the IO opcode directly. The STL provides:

A complete β€œHello, World!” program is just stl.startup_and_init_all + stl.output "Hello\n" + stl.loop. See the Hello World walkthrough for a guided tour.

Runtime IO devicesΒΆ

The IO opcode above is the language-level contract: a program only ever flips and reads those fixed bits. Where those bits actually go is decided at run time by a pluggable IO device, chosen with fj --run prog.fjm --io MODE:

  • standard (the default) β€” input and output over the terminal, exactly as described above.

  • pc β€” an interactive window with live keyboard input and a scaled 256-color screen that the device reads straight out of program memory. F11 toggles fullscreen; closing the window stops the run. It needs pygame β€” pip install "flipjump[io]".

Because every device speaks the same IO opcode, a program written for the terminal also drives the pc window unchanged β€” only the device differs. See Choosing an IO device for the CLI side.

ReferenceΒΆ

The exact I/O addresses (2*w for the opcode, 3*w + #w for the input bit) come from the upstream language design β€” for more depth see esolangs.org/FlipJump#Input_/_Output.