Blue v7 Docs

Overview

By convention Blue bytecode files have a `.b` extension. A `.bo` file indicates partial bytecode that is meant to be joined into a complete `.b` file. This amalgamation is typically formed with `cat`. Breaking code out into separate `.bo` files aids in code reuse and can help with testing words in isolation.

Individual `.bo` files should be limited to 1024 bytes, which may be enforced by tools such as an `editor`.

Format

Unsigned leading bytes are ignored by interpreter, allowing for literate bytecode.

Leading signed bytes are interpreted as color bytes and must be followed by 8 bytes of data.

A color byte is formed by `or`ing `0x80` with:

Op

`0x00`: green word - runtime branch to word
`0x01`: blue word - asmtime branch to word
`0x02`: red word - define label
`0x03`: magenta word - push address on data stack
`0x04`: green number - write number to output
`0x05`: blue number - push number on data stack

Mode

`0x00`: immediate
`0x08`: postpone

Flags

Numbers:

`0x00`: 1 byte representation
`0x10`: 2 byte representation
`0x30`: 4 byte representation
`0x70`: 8 byte representation

Green/Blue Words:

`0x00`: call
`0x10`: jmp

Magenta Words:

`0x00`: asmtime address
`0x10`: runtime address