Word Reference

This reference lists all 404 words that VIOS accepts, generated from the sources by tools/vios_manual.py words. Kind is how the word is made: primitive (a VM opcode), native (a C function), prelude or colon (defined in Forth; the definition is shown), constant, variable, defer (a replaceable binding), compiler (parsed by the outer interpreter) or command (a line command parsed by the kernel; the rest of the line is its argument). Words marked board do real work only on the board (on the host build they talk to stubs).

Sections: Stack · Arithmetic · Bits and logic · Comparison · Memory and data space · Numbers and BASE · Control flow · Defining words · Extending the compiler · Strings and characters · Output · Input · Inspection and debugging · Engines and benchmarks · System services · Time and interrupts · Display and VDP · Audio · Tasks · Pipes and pipelines · Handles and devices · Files and loading · Modules · Boot slots · GUI: setup and batching · GUI: windows · GUI: surfaces and cells · GUI: commands and menus · GUI: widgets · GUI: text views · GUI: events · GUI: animation · GUI: canvases and icons · GUI: sprites and pointer · GUI: constants · GUI tools · Text workbench

Stack

Moving cells on the data and return stacks.

Word Stack effect Description Kind
DUP ( x -- x x ) Duplicate the top cell. Primitive (one VM opcode). Example: 5 DUP * . \ 25 primitive
DROP ( x -- ) Discard the top cell. Primitive. Example: 1 2 DROP . \ 1 primitive
SWAP ( x1 x2 -- x2 x1 ) Exchange the top two cells. Primitive. Example: 1 2 SWAP . . \ 1 2 primitive
OVER ( x1 x2 -- x1 x2 x1 ) Copy the second cell to the top. Primitive. Example: 1 2 OVER . . . \ 1 2 1 primitive
>R ( x -- ) ( R: -- x ) Move the top cell to the return stack. Use only inside a colon definition and move it back before the definition ends: ; returns through whatever is on top of the return stack, so an unbalanced >R fails with "invalid memory" (on the board it jumps to that address). The return stack is separate from the DO loop stack, so I still works after >R. Example: : SUM3 >R + R> + ; 1 2 3 SUM3 . \ 6 primitive
R> ( -- x ) ( R: x -- ) Move the top of the return stack to the data stack. Inside definitions only, paired with >R; fails with "return stack underflow" if the return stack is empty. Example: : SUM3 >R + R> + ; 1 2 3 SUM3 . \ 6 primitive
R@ ( -- x ) ( R: x -- x ) Copy the top of the return stack to the data stack. Inside definitions only. Example: : TWICE >R R@ R> + ; 21 TWICE . \ 42 primitive
DEPTH ( -- u ) Number of cells on the data stack before DEPTH ran. The foreground data stack holds 256 cells; a background task saves at most 64. Example: 1 2 3 DEPTH . \ 3 primitive
2DUP ( x1 x2 -- x1 x2 x1 x2 ) Duplicate the top pair. Defined in Forth as OVER OVER. Example: 1 2 2DUP .S \ <4> 1 2 1 2 Definition: : 2DUP OVER OVER ; colon
2DROP ( x1 x2 -- ) Discard the top pair. Defined as DROP DROP. Example: 1 2 3 2DROP . \ 1 Definition: : 2DROP DROP DROP ; colon
ROT ( x1 x2 x3 -- x2 x3 x1 ) Rotate the third cell to the top. Library word from the kernel prelude. Example: 1 2 3 ROT .S \ <3> 2 3 1 Definition: : ROT >R SWAP R> SWAP ; prelude
-ROT ( x1 x2 x3 -- x3 x1 x2 ) Rotate the top cell down to third place (ROT ROT). Not ANS standard but common. Example: 1 2 3 -ROT .S \ <3> 3 1 2 Definition: : -ROT ROT ROT ; prelude
NIP ( x1 x2 -- x2 ) Discard the second cell. Example: 1 2 NIP . \ 2 Definition: : NIP SWAP DROP ; prelude
TUCK ( x1 x2 -- x2 x1 x2 ) Copy the top cell below the second. Example: 1 2 TUCK .S \ <3> 2 1 2 Definition: : TUCK SWAP OVER ; prelude
?DUP ( x -- 0 \| x x ) Duplicate the top cell only if it is non-zero. Example: 7 ?DUP .S \ <2> 7 7 Definition: : ?DUP DUP IF DUP THEN ; prelude
2SWAP ( x1 x2 x3 x4 -- x3 x4 x1 x2 ) Exchange the top two pairs. Example: 1 2 3 4 2SWAP .S \ <4> 3 4 1 2 Definition: : 2SWAP ROT >R ROT R> ; prelude
2OVER ( x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2 ) Copy the second pair to the top. Example: 1 2 3 4 2OVER .S \ <6> 1 2 3 4 1 2 Definition: : 2OVER >R >R 2DUP R> R> 2SWAP ; prelude

Arithmetic

Integer arithmetic on cells (24 bits on the board).

Word Stack effect Description Kind
+ ( n1 n2 -- n3 ) Add. Results wrap modulo 2^24 (cells are 24 bits). Example: 8388607 1 + . \ -8388608 primitive
- ( n1 n2 -- n3 ) Subtract n2 from n1, modulo 2^24. Example: 10 3 - . \ 7 primitive
* ( n1 n2 -- n3 ) Multiply, keeping the low 24 bits of the product. Example: 6 7 * . \ 42 primitive
/ ( n1 n2 -- n3 ) Signed division that truncates toward zero (C semantics, not floored): -7 2 / is -3. Division by zero, or -8388608 by -1, fails with "arithmetic error". Example: -7 2 / . \ -3 primitive
MOD ( n1 n2 -- n3 ) Signed remainder with the sign of n1 (C semantics). Fails with "arithmetic error" on division by zero. Example: 7 -2 MOD . \ 1 primitive
1+ ( n -- n+1 ) Add one. Defined in Forth as 1 +. Example: 41 1+ . \ 42 Definition: : 1+ 1 + ; colon
1- ( n -- n-1 ) Subtract one. Example: 43 1- . \ 42 Definition: : 1- 1 - ; colon
NEGATE ( n -- -n ) Two's complement negation (0 SWAP -). Example: 5 NEGATE . \ -5 Definition: : NEGATE 0 SWAP - ; colon
ABS ( n -- u ) Absolute value. -8388608 stays -8388608 (it has no positive 24-bit counterpart). Example: -3 ABS . \ 3 Definition: : ABS DUP 0< IF NEGATE THEN ; prelude
MAX ( n1 n2 -- n3 ) The larger of two signed numbers. Example: 2 7 MAX . \ 7 Definition: : MAX 2DUP < IF SWAP THEN DROP ; prelude
MIN ( n1 n2 -- n3 ) The smaller of two signed numbers. Example: 2 7 MIN . \ 2 Definition: : MIN 2DUP SWAP < IF SWAP THEN DROP ; prelude
2* ( x -- x*2 ) Shift left by one bit (1 LSHIFT). Example: 21 2* . \ 42 Definition: : 2* 1 LSHIFT ; prelude
/MOD ( n1 n2 -- rem quot ) Remainder and quotient of a truncating division (2DUP MOD -ROT /). Example: 17 5 /MOD . . \ 3 2 Definition: : /MOD 2DUP MOD -ROT / ; prelude
*/ ( n1 n2 n3 -- n4 ) n1n2/n3. Unlike ANS Forth there is no double-cell intermediate: the product is truncated to 24 bits before the division, so keep n1n2 within -8388608..8388607. Example: 100 3 4 */ . \ 75 Definition: : */ >R * R> / ; prelude

Bits and logic

Bitwise operations and shifts.

Word Stack effect Description Kind
AND ( x1 x2 -- x3 ) Bitwise AND. Example: 12 10 AND . \ 8 primitive
OR ( x1 x2 -- x3 ) Bitwise OR. Example: 12 10 OR . \ 14 primitive
XOR ( x1 x2 -- x3 ) Bitwise exclusive OR. Example: 12 10 XOR . \ 6 primitive
INVERT ( x -- x' ) Flip all 24 bits. Example: 0 INVERT . \ -1 primitive
LSHIFT ( x u -- x' ) Logical shift left by u bits; u of 24 or more gives 0. Example: 1 4 LSHIFT . \ 16 primitive
RSHIFT ( x u -- x' ) Logical (unsigned) shift right by u bits; u of 24 or more gives 0. Example: -1 1 RSHIFT . \ 8388607 primitive
TRUE ( -- -1 ) The canonical true flag: all 24 bits set (hex FFFFFF). Example: TRUE . \ -1 Definition: : TRUE -1 ; colon
FALSE ( -- 0 ) The false flag. Example: FALSE . \ 0 Definition: : FALSE 0 ; colon

Comparison

Flags are -1 (true) and 0 (false).

Word Stack effect Description Kind
= ( x1 x2 -- flag ) True (-1) if the cells are equal. Example: 3 3 = . \ -1 primitive
< ( n1 n2 -- flag ) Signed less-than on 24-bit values. Example: -1 1 < . \ -1 primitive
U< ( u1 u2 -- flag ) Unsigned less-than (-1 counts as 16777215). Example: -1 1 U< . \ 0 primitive
0= ( x -- flag ) True if x is zero; also the usual logical NOT of a flag. Example: 0 0= . \ -1 primitive
> ( n1 n2 -- flag ) Signed greater-than (SWAP <). Example: 2 1 > . \ -1 Definition: : > SWAP < ; prelude
0< ( n -- flag ) True if n is negative (bit 23 set). Example: -5 0< . \ -1 Definition: : 0< 0 < ; prelude
0> ( n -- flag ) True if n is greater than zero. Example: 5 0> . \ -1 Definition: : 0> 0 SWAP < ; prelude
<> ( x1 x2 -- flag ) True if the cells differ (= 0=). Example: 1 2 <> . \ -1 Definition: : <> = 0= ; prelude
U> ( u1 u2 -- flag ) Unsigned greater-than. Example: -1 1 U> . \ -1 Definition: : U> SWAP U< ; prelude
WITHIN ( n lo hi -- flag ) True if lo <= n < hi (computed unsigned, so it also works across the sign boundary when lo <= hi). Example: 3 1 5 WITHIN . \ -1 Definition: : WITHIN OVER - >R - R> U< ; prelude

Memory and data space

Fetching, storing and reserving data space.

Word Stack effect Description Kind
@ ( addr -- x ) Fetch a 3-byte little-endian cell. On the board any address is accepted (native eZ80 addressing, no protection); on the host only the dictionary regions exist and other addresses fail with "invalid memory". Example: VARIABLE V1 42 V1 ! V1 @ . \ 42 primitive
! ( x addr -- ) Store a 3-byte cell at addr. No alignment is needed. On the board a bad address silently overwrites memory. Example: VARIABLE V2 7 V2 ! V2 @ . \ 7 primitive
C@ ( addr -- c ) Fetch one byte. Example: S" A" DROP C@ . \ 65 primitive
C! ( c addr -- ) Store the low 8 bits of c at addr. Example: CREATE B1 2 ALLOT 66 B1 C! B1 C@ . \ 66 primitive
FILL ( addr u c -- ) Set u bytes from addr to c. Works in chunks of 256 bytes so a timer tick can preempt a long fill; the result is the same. Example: CREATE F1 8 ALLOT F1 8 42 FILL F1 8 TYPE \ ******** native
MOVE ( src dst u -- ) Copy u bytes from src to dst; overlapping regions are handled. Chunked like FILL. Example: CREATE M1 3 ALLOT S" abc" DROP M1 3 MOVE M1 3 TYPE \ abc native
CELLS ( n -- n*3 ) Size in bytes of n cells. A cell is 3 bytes in VIOS, on the board and on the host. Example: 2 CELLS . \ 6 Definition: : CELLS 3 * ; colon
CELL+ ( addr -- addr+3 ) Advance an address by one cell. Example: 100 CELL+ . \ 103 Definition: : CELL+ 3 + ; colon
+! ( n addr -- ) Add n to the cell at addr. Example: VARIABLE C1 5 C1 ! 3 C1 +! C1 @ . \ 8 Definition: : +! DUP @ ROT + SWAP ! ; prelude
? ( addr -- ) Print the cell at addr (@ .). Example: VARIABLE Q1 99 Q1 ! Q1 ? \ 99 Definition: : ? @ . ; prelude
ERASE ( addr u -- ) Set u bytes to zero (0 FILL). Example: CREATE E1 4 ALLOT E1 4 ERASE E1 C@ . \ 0 Definition: : ERASE 0 FILL ; prelude
BOUNDS ( addr u -- addr+u addr ) Turn an address and length into DO loop limits. Example: : SHOW BOUNDS ?DO I C@ EMIT LOOP ; S" hi" SHOW \ hi Definition: : BOUNDS OVER + SWAP ; prelude
, ( x -- ) Append a cell to data space. Works at the prompt and inside definitions (defining words); refused in background tasks. Fails with "data space full" past 8192 bytes. Example: CREATE T1 10 , 20 , T1 CELL+ @ . \ 20 native
C, ( c -- ) Append one byte to data space. Works at the prompt and inside definitions; refused in background tasks. Example: CREATE CS1 3 C, 65 C, 66 C, 67 C, CS1 COUNT TYPE \ ABC native
ALLOT ( u -- ) Reserve u zeroed bytes of data space; a negative u fails ("negative ALLOT"). Works inside definitions too (defining words with DOES>). If the first ALLOT after CREATE does not fit, the CREATEd word is removed again. Example: CREATE BUF1 16 ALLOT BUF1 16 ERASE native
HERE ( -- addr ) The next free data-space address. Works at the prompt and inside definitions. Example: HERE 3 ALLOT HERE SWAP - . \ 3 native

Numbers and BASE

Number conversion and printing radix.

Word Stack effect Description Kind
BASE ( -- addr ) Variable holding the number radix (2..36) used for parsing and printing. Starts at 10; each background task has its own BASE, inherited from its spawner. Module source is always compiled in decimal. Example: 2 BASE ! 101 . DECIMAL \ 101 (read and printed in binary) variable
HEX ( -- ) Set BASE to 16. Example: HEX FF . DECIMAL \ FF Definition: : HEX 16 BASE ! ; colon
DECIMAL ( -- ) Set BASE to 10. Example: HEX 10 DECIMAL . \ 16 Definition: : DECIMAL 10 BASE ! ; colon
.HEX2 ( u -- ) Print u with a leading 0 when it is below 16, then a space. Meant for use while BASE is 16 (as DUMP does), where it prints bytes as two hex digits. Example: HEX 10 .HEX2 A .HEX2 DECIMAL \ 10 0A Definition: : .HEX2 DUP 16 < IF 48 EMIT THEN . ; prelude

Control flow

Conditionals, loops and execution tokens.

Word Stack effect Description Kind
IF ( flag -- ) Parser keyword: flag IF ... [ELSE ...] THEN. Runs the first branch when flag is non-zero. Compile-only ("compile-only word" outside a definition). Example: : SIGN 0< IF ." neg" ELSE ." pos" THEN ; -3 SIGN \ neg compiler
ELSE ( -- ) Parser keyword: starts the false branch of IF. Fails with "ELSE needs IF" when misplaced. Example: : ODD? 1 AND IF ." odd" ELSE ." even" THEN ; 4 ODD? \ even compiler
THEN ( -- ) Parser keyword: ends an IF or IF ... ELSE structure. Example: : ?NL DUP 0= IF CR THEN DROP ; 0 ?NL compiler
BEGIN ( -- ) Parser keyword: marks the start of BEGIN ... UNTIL, BEGIN ... AGAIN or BEGIN ... WHILE ... REPEAT. Compile-only. Example: : COUNTDOWN BEGIN DUP . 1- DUP 0= UNTIL DROP ; 3 COUNTDOWN \ 3 2 1 compiler
UNTIL ( flag -- ) Parser keyword: loop back to BEGIN while flag is zero. Example: : UPTO5 0 BEGIN 1+ DUP 5 = UNTIL . ; UPTO5 \ 5 compiler
AGAIN ( -- ) Parser keyword: loop back to BEGIN unconditionally. A foreground command stops after 1,000,000 VM instructions ("execution budget exhausted"), so endless loops belong in background tasks or must EXIT. Example: : FIRST-OVER-100 1 BEGIN 2* DUP 100 > IF EXIT THEN AGAIN ; FIRST-OVER-100 . \ 128 compiler
WHILE ( flag -- ) Parser keyword: in BEGIN ... WHILE ... REPEAT, leave the loop when flag is zero. Fails with "WHILE needs BEGIN" when misplaced. Example: : LT3 0 BEGIN DUP 3 < WHILE 1+ REPEAT . ; LT3 \ 3 compiler
REPEAT ( -- ) Parser keyword: ends BEGIN ... WHILE ... REPEAT, jumping back to BEGIN. Example: : HALVES BEGIN DUP WHILE DUP . 2 / REPEAT DROP ; 20 HALVES \ 20 10 5 2 1 compiler
DO ( limit start -- ) Parser keyword: start a counted loop ending in LOOP or +LOOP. The body runs at least once; with start = limit it runs 2^24 times, so use ?DO when the count may be zero. Loop frames live on a separate loop stack of 32 frames (16 in a background task). Example: : TENS 5 0 DO I 10 * . LOOP ; TENS \ 0 10 20 30 40 compiler
?DO ( limit start -- ) Parser keyword: like DO but skips the loop entirely when start equals limit. Example: : STARS 0 ?DO 42 EMIT LOOP ; 0 STARS 3 STARS \ *** compiler
LOOP ( -- ) Parser keyword: add one to the index; repeat until the index reaches the limit. Fails with "LOOP needs DO" when misplaced. Example: : ABC 3 0 DO 65 I + EMIT LOOP ; ABC \ ABC compiler
+LOOP ( n -- ) Parser keyword: add n to the index and repeat unless the index crossed the boundary between limit-1 and limit (either direction). Compiles a call to the internal (+LOOP). Example: : DOWN 0 10 DO I . -3 +LOOP ; DOWN \ 10 7 4 1 compiler
(+LOOP) ( n -- flag ) Internal native compiled by +LOOP: steps the innermost loop index by n and returns true (dropping the loop frame) when the loop is finished. You cannot call it by name: any token that starts with ( is read as a comment. native
I ( -- n ) Index of the innermost DO loop. Fails with "loop stack underflow" outside a loop. Unaffected by >R, because loop frames are not on the return stack. Example: : SQUARES 4 1 DO I I * . LOOP ; SQUARES \ 1 4 9 primitive
J ( -- n ) Index of the next outer DO loop. There is no K. Example: : GRID 2 0 DO 2 0 DO J . I . LOOP LOOP ; GRID \ 0 0 0 1 1 0 1 1 native
LEAVE ( -- ) Parser keyword: drop the innermost loop frame and continue after its LOOP/+LOOP. At most 16 LEAVE/?DO exits can be pending in one definition. Example: : UNTIL5 10 0 DO I 5 = IF LEAVE THEN I . LOOP ; UNTIL5 \ 0 1 2 3 4 compiler
UNLOOP ( -- ) Drop the innermost loop frame. Use it before EXIT inside a DO loop: EXIT returns through the return stack but leaves the loop frame on the separate loop stack. Example: : FIND7 10 0 DO I 7 = IF I UNLOOP EXIT THEN LOOP -1 ; FIND7 . \ 7 native
EXIT ( -- ) Parser keyword: return from the current definition at once. Compile-only; outside a definition EXIT is an unknown word. Example: : POS? DUP 0> IF DROP ." yes" EXIT THEN DROP ." no" ; 5 POS? \ yes compiler
RECURSE ( -- ) Parser keyword: compile a call to the definition being compiled (its own name is not visible until ;). Example: : FACT DUP 1 > IF DUP 1- RECURSE * ELSE DROP 1 THEN ; 10 FACT . \ 3628800 compiler
EXECUTE ( i*x xt -- j*x ) Run the word whose execution token is xt. Fails with "invalid execution token" for 0 or an xt beyond the dictionary. Example: ' DUP 3 SWAP EXECUTE .S \ <2> 3 3 primitive
' ( "name" -- xt ) Parser keyword: push the execution token (dictionary index, 1-based) of name. Interpretation only; inside a definition use ['] ("use ['] in definitions"). Parser keywords such as IF or VARIABLE have no xt. Example: ' DUP . \ 1 compiler
['] ( "name" -- ) compile; runtime ( -- xt ) Parser keyword: compile name's execution token as a literal. Use inside definitions. Example: : XT-OF-DUP ['] DUP ; XT-OF-DUP . \ 1 compiler

Defining words

Words that create other words.

Word Stack effect Description Kind
DOES> ( -- ) child: ( -- addr ) then the code after DOES> Parser keyword, used in a defining word after CREATE: ends the defining part; each word it creates then pushes its data address and runs the code after DOES>. Callers inline a child's address. Example: : CONST CREATE , DOES> @ ; 42 CONST ANSWER ANSWER . \ 42 compiler
>BODY ( xt -- addr ) The data address of a word made by CREATE, VARIABLE or a DOES> defining word; fails for other kinds. native
MARKER ( "name" -- ) name: ( -- ) Create a word that, when run, removes itself and every word defined after it and gives back their dictionary, code, data, name and source-map space. It refuses to remove module words, words a DEFER is still bound to, or code while tasks are live. Run it from the prompt. Example: MARKER SCRATCH native
(MARKER) ( -- ) Internal: the code a MARKER word runs to cut the dictionary back. native
(DOES>) ( t d -- ) Internal: compiled by DOES>; at run time it turns the word just CREATEd into a child that runs the does-part. native
: ( "name" -- ) Parser keyword: start a colon definition. Names are 1..31 characters, case-insensitive (stored upper case); definitions cannot nest. The word becomes visible only at ;, and a definition that fails is discarded. Redefining a name does not change words already compiled against the old one. Example: : SQ DUP * ; 7 SQ . \ 49 compiler
; ( -- ) Parser keyword: end the current definition and publish it. Fails with "unbalanced control flow" if an IF/BEGIN/DO is still open, or "unexpected semicolon" outside a definition. Example: : HELLO ." hello" ; HELLO \ hello compiler
VARIABLE ( "name" -- ) name: ( -- addr ) Create a word that pushes the address of a fresh 3-byte cell in data space, initialised to 0. A dictionary word: it can be used inside definitions, ticked and postponed. Example: VARIABLE SCORE 10 SCORE ! SCORE ? \ 10 native
CONSTANT ( x "name" -- ) name: ( -- x ) Create a word that pushes x. Callers compile the value as a literal, so redefining the constant later does not change them. A dictionary word, usable inside defining words. Example: 7 CONSTANT DAYS DAYS . \ 7 native
CREATE ( "name" -- ) name: ( -- addr ) Create a word that pushes its data-space address; reserve its body with ALLOT, , or C,. Works inside definitions, where DOES> can then give the new word its own behaviour (see Extending the compiler). Example: CREATE PRIMES 2 , 3 , 5 , PRIMES 2 CELLS + @ . \ 5 native
DEFER ( "name" -- ) name: ( i*x -- j*x ) Create a replaceable binding. Calling it runs the word stored with IS; compiled callers follow every rebinding. Executing an unbound DEFER fails with "invalid execution token". A dictionary word. Example: DEFER GREET : HI ." hi" ; ' HI IS GREET GREET \ hi native
IS ( xt "name" -- ) Parser keyword: bind the DEFER name to xt. Works interactively (checks xt) and inside definitions (stores at run time). Fails with "IS requires deferred word" for any other kind of word. Example: DEFER SHOUT : LOUD ." HEY" ; : ARM ['] LOUD IS SHOUT ; ARM SHOUT \ HEY compiler

Extending the compiler

Compile-time execution, macros and text evaluation.

Word Stack effect Description Kind
STATE ( -- addr ) A variable that holds true while a definition is being compiled and false while interpreting. Read it, do not store into it: use [ and ] to switch. Example: STATE @ . \ 0 variable
[ ( -- ) Parser keyword: switch to interpreting inside an open definition, for example to compute a value at compile time. Example: : DAY [ 60 60 * 24 * ] LITERAL ; compiler
] ( -- ) Parser keyword: switch back to compiling. Needs an open definition. compiler
LITERAL compile: ( x -- ) run: ( -- x ) Parser keyword, compile-only: compile the number on the stack as a literal, typically after [ ... ]. compiler
IMMEDIATE ( -- ) Parser keyword: make the word just defined immediate, so inside definitions it runs at compile time instead of being compiled. It applies only to a word defined in the same unit (line, LOAD or module). Example: : UNLESS POSTPONE 0= POSTPONE IF ; IMMEDIATE compiler
POSTPONE ( "name" -- ) Parser keyword, compile-only: compile name's compilation behaviour into the current definition. For an ordinary word that compiles code that will compile a call to it; for an immediate word or a control keyword (IF, THEN, DO ...) it makes the word act when the new word runs. Postponing a parsing keyword (S", .", [CHAR], ['], IS, POSTPONE) is refused. compiler
COMPILE, ( xt -- ) Compile a call to xt into the open definition (constants and variables are inlined, as the compiler does). Refused in background tasks. native
FIND ( c-addr -- c-addr 0 \| xt 1 \| xt -1 ) Look up a counted string (case-insensitive): 1 for an immediate word, -1 for an ordinary one, 0 if not found. Parser keywords are not dictionary words and give 0. native
EVALUATE ( i*x addr u -- j*x ) Interpret a string as if it were typed, sharing the compiler state, so inside an immediate word it compiles into the open definition (a text macro). Nests up to 4 levels, at most 512 bytes of text each. Refused in background tasks; outer commands, SYNC and ABORT are not available inside it. Example: S" 2 3 + ." EVALUATE \ 5 native
(KEYWORD) ( id -- ) Internal: compiled by POSTPONE of a control keyword; runs that keyword's compiler action when the new word executes. native
(EVAL-RETURN) ( -- ) Internal: the return point EVALUATE uses to come back from words it runs. native

Strings and characters

String literals, characters and comments.

Word Stack effect Description Kind
S" ( "text<quote>" -- addr u ) Parser keyword: copy text (up to the next " on the same line, one leading space skipped, case preserved) into data space with a trailing NUL and push its address and length. Interactively and in definitions alike, each S" takes data space permanently; fails with "unterminated string" when the quote is missing. Example: S" hello" TYPE \ hello compiler
." ( "text<quote>" -- ) Parser keyword: print text; equivalent to S" text" TYPE, so the text also lives in data space. Works both interactively and in definitions. Example: ." VIOS" CR compiler
CHAR ( "c" -- c ) Parser keyword: push the code of the first character of the next token (case preserved). Interpretation only; use [CHAR] in definitions. Example: CHAR a . \ 97 compiler
[CHAR] ( "c" -- ) compile; runtime ( -- c ) Parser keyword: compile the code of the next token's first character as a literal. Example: : STAR [CHAR] * EMIT ; STAR \ * compiler
COUNT ( addr -- addr+1 u ) Unpack a counted string (length byte first). Example: CREATE CNT1 2 C, 79 C, 75 C, CNT1 COUNT TYPE \ OK Definition: : COUNT DUP 1+ SWAP C@ ; prelude

Output

Printing to the console (or to a task's output).

Word Stack effect Description Kind
EMIT ( c -- ) Write one byte to the console (in a background task: to the task's output ring or redirected handle). Example: 65 EMIT \ A primitive
. ( n -- ) Print n as a signed 24-bit number in the current BASE, followed by a space. Example: -1 . \ -1 primitive
U. ( u -- ) Print u unsigned (0..16777215) in the current BASE, followed by a space. Example: -1 U. \ 16777215 native
CR ( -- ) Write a CR LF pair. Example: ." line" CR primitive
TYPE ( addr u -- ) Write u bytes from addr to the console in one native call. A redirected background task may stop part-way and resume the rest in its next slice. Example: S" text" TYPE \ text native
BL ( -- 32 ) The space character code. Example: BL . \ 32 Definition: : BL 32 ; prelude
SPACE ( -- ) Write one space. Example: 65 EMIT SPACE 66 EMIT \ A B Definition: : SPACE BL EMIT ; prelude
SPACES ( n -- ) Write n spaces; nothing when n is zero or negative. Example: 3 SPACES 42 EMIT \ * Definition: : SPACES BEGIN DUP 0> WHILE SPACE 1- REPEAT DROP ; prelude
CONSOLE-WRITE ( addr u -- ) Kernel service: write u bytes to the console through the task-aware emitter, byte by byte (like TYPE, without TYPE's resume-on-full behaviour). Example: S" via service" CONSOLE-WRITE CR native
CONSOLE-EMIT ( c -- ) Deferred service binding, initially EMIT. Rebind it with IS to redirect output of code that calls CONSOLE-EMIT; the system's own EMIT, TYPE and . do not go through it. Example: 72 CONSOLE-EMIT 73 CONSOLE-EMIT \ HI defer

Input

Reading keys.

Word Stack effect Description Kind
KEY ( -- c ) Wait for the next input byte. In the foreground it reads console input (physical keys typed while the command runs, or host bytes) and runs background tasks while it waits; arrow and function keys produce no byte. In a background task it reads the task's input handle (-1 at end of file) or fails with "KEY unavailable in background task". Example: : ECHO1 KEY EMIT ; primitive, board
CONSOLE-KEY ( -- c ) Deferred service binding, initially KEY. Code that reads through CONSOLE-KEY can be pointed at another input source with IS. Example: : ASK CONSOLE-KEY EMIT ; defer, board

Inspection and debugging

Looking inside the running system.

Word Stack effect Description Kind
.S ( -- ) Parser keyword: print <depth> and the data stack bottom to top as signed numbers, without changing it. Interpretation only. Example: 1 2 3 .S \ <3> 1 2 3 compiler
DUMP ( addr u -- ) Hex dump of u bytes. Each byte is two hex digits; a new line with the address starts at every 16-byte boundary (so an unaligned start has no address on its first line). BASE is restored afterwards. Example: S" ABC" DUMP prelude
WORDS ( -- ) Parser keyword: list every dictionary entry, oldest first, including shadowed older definitions. Parser keywords (IF, VARIABLE, SEE ...) and outer commands are not dictionary entries and are not listed. Example: WORDS compiler
SEE ( "name" -- ) Parser keyword: show a colon word's stored source (upper case, comments removed) or primitive NAME / data word NAME, then a metadata line: xt, kind (0 primitive, 1 colon, 2 constant, 3 variable, 4 defer, 5 native, 6 does, 7 marker), code addresses and sizes for both code formats, the module it came from, and immediate for an immediate word. Example: : CUBE DUP DUP * * ; SEE CUBE compiler
RESOURCES ( -- ) Parser keyword: one line with the engine, words used/512, token, direct, data and source bytes used, source-map entries used/1792 (the map TRACE and LAST-ERROR read), and the peak data and return stack depths. Example: RESOURCES compiler
LAST-ERROR ( -- ) Parser keyword: report the last foreground runtime failure as captured before the stacks were cleared: serial, engine, whether the dictionary changed since (stale), BASE, message, failing word, code offset and source token, stack depths, the top 8 data cells, then one frame line per caller (up to 16). The message and word names are printed as hex bytes; the host CLI's :why decodes them. Example: LAST-ERROR compiler
TRACE ( i*x "name" "n" -- j*x ) Parser keyword: run name one VM instruction at a time for at most n (1..100000) steps, printing step number, word+offset, source token, stack depths and top of stack before each, then trace returned or trace failed. Uses the current engine. Interpretation only. Example: : SQ2 DUP * ; 4 TRACE SQ2 10 . compiler

Engines and benchmarks

Choosing and measuring the execution engine.

Word Stack effect Description Kind
ENGINE ( "C\|TOKEN\|DIRECT" -- ) Parser keyword: select the execution engine for compiled code: C (the portable reference interpreter of token code), TOKEN (eZ80 assembly, one-byte opcodes) or DIRECT (eZ80 direct-threaded, the board default). TOKEN and DIRECT exist only on the board; refused while background tasks are live. The name is C, not REFERENCE. Example: ENGINE C compiler
BENCH ( -- ) Parser keyword, board only: time arithmetic, call, branch, loop and memory micro-benchmarks on all three engines with the 288 kHz timer (9 samples each) and print SAMPLE/CODE lines ending in BENCH DONE. Restores engine, BASE and stack. compiler, board

System services

Replaceable service bindings and system control.

Word Stack effect Description Kind
( ( "text)" -- ) Comment up to the next ). Handled by the tokenizer: any token that begins with ( starts a comment, and no space is needed after it. Comments are not stored, so SEE does not show them. Example: 1 ( a comment ) 2 + . \ 3 compiler
\ ( "rest of line" -- ) Comment to the end of the line, handled by the tokenizer (any token beginning with a backslash). Inside S" and ." text it is an ordinary character. Example: 5 . \ prints 5 compiler
ABORT ( i*x -- ) Parser keyword: clear the data, return and loop stacks, discard an unfinished definition and ignore the rest of the input line. It acts immediately when read, even inside a definition, so it cannot be compiled as a run-time abort. Example: 1 2 3 ABORT compiler
SYNC ( "name" -- ) Parser keyword for host framing: print @NAME (upper-cased) on its own line, touching no stacks. The harness uses it to find a known point in the output. It does not flush storage. Example: SYNC MARK \ @MARK compiler
REBOOT ( -- ) Flush console output and restart. After a MOS boot this is a watchdog CPU reset, so MOS loads VIOS again; everything not saved is lost. Foreground only. native, board
IRQ-PROBE ( -- ) Board only, read-only: report the boot path (mos or zdi), the I register, the interrupt jump table and its default handler, vectors with other handlers, and the timer, clock-gating, UART and GPIO interrupt ports. Valid only when MOS booted this run. Example: IRQ-PROBE native, board
IRQ-STATS ( -- ) Board only: print whether the 1 kHz tick runs, its millisecond count, the stray-interrupt count (should stay 0) and UART bytes dropped by the receive ring. Example: IRQ-STATS native, board

Time and interrupts

Clocks, ticks and the interrupt probe.

Word Stack effect Description Kind
TIMER@ ( -- u ) Raw value of the eZ80's 16-bit down-counting timer at 288 kHz; it wraps about every 227 ms. Subtract two readings (earlier minus later, low 16 bits) for short intervals. Example: TIMER@ TIMER@ - 65535 AND . native
MILLIS ( -- u ) The VDP (ESP32) millisecond clock, masked to 24 bits (wraps after about 4.6 hours). Costs a request/reply round trip; fails with "VDP clock timeout" after about 1 s without a reply. Example: MILLIS . native
MILLIS2 ( -- lo hi ) The full 32-bit VDP millisecond clock as its low 24 bits and high 8 bits. Example: MILLIS2 . . native
CLOCK-MS ( -- u ) Deferred service binding for a millisecond clock, initially MILLIS. MS, FRAME-WAIT and the task scheduler do not use it; they read the board tick (or the 288 kHz timer). Example: CLOCK-MS . defer
TICKS ( -- u ) Board only: milliseconds counted by the 1 kHz PRT1 tick interrupt, masked to 24 bits; 0 when the tick is off (after a ZDI load). No VDP round trip, unlike MILLIS. Example: TICKS . native, board

Display and VDP

Low-level text and graphics through the VDP.

Word Stack effect Description Kind
VDU ( c -- ) Send one byte to the VDP, as BBC BASIC's VDU. Multi-byte commands are built from several VDU calls or with VTYPE. Example: 7 VDU native, board
VTYPE ( addr u -- ) Send u raw bytes to the VDP (in 64-byte pieces). Unlike TYPE the bytes do not go to the console stream, so they are not echoed to USB. Example: S" Hi" VTYPE native, board
VDP-INFO ( -- ) Ask the VDP for its mode and print vdp width W height H colours C mode M console-dropped N (N counts console input bytes lost on the CPU side). Fails with "VDP mode timeout". Example: VDP-INFO native, board
MODE ( n -- ) Change screen mode (VDU 22,n) and verify it; fails with "VDP mode rejected" if the VDP reports another mode. Mode 0 (640x480, 16 colours) is the VIOS display mode; any other mode suspends the GUI compositor until 0 MODE. Example: 0 MODE native, board
CLS ( -- ) Clear the VDP text area (VDU 12). Example: CLS native, board
COLOUR ( n -- ) Set the VDP text colour (VDU 17,n): n below 128 is the foreground palette index, 128+n the background. Example: 10 COLOUR native, board
PLOT ( mode x y -- ) VDU 25 graphics command with 16-bit coordinates. By default coordinates are BBC logical units (1280x1024, origin bottom left). Common modes: 4 move, 5 line, 69 point, 85 filled triangle, 101 filled rectangle, 157 filled circle. Example: 4 100 100 PLOT 5 600 400 PLOT native, board
CHAR@ ( x y -- c ) Read back the character at text column x, row y (VDU 23,0,&83); the VDP matches glyphs against the current text colours. Fails with "VDP character timeout". Example: 0 0 CHAR@ . native, board
PIXEL@ ( x y -- rgb index ) Read back a pixel at graphics coordinates x y (VDU 23,0,&84): rgb packs red, green, blue as r + g256 + b65536; index is its palette entry. Fails with "VDP pixel timeout". Example: 0 0 PIXEL@ . . native, board
DISPLAY-WRITE ( addr u -- ) Deferred service binding for raw display output, initially VTYPE. Rebind it to send display bytes elsewhere; the console never depends on it. Example: S" " DISPLAY-WRITE defer, board

Audio

The three-voice synthesizer on the ESP32.

Word Stack effect Description Kind
BEEP ( freq ms -- status ) Play a note on VDP audio channel 0 at volume 64 for ms milliseconds and return the VDP's status byte (non-zero when accepted). Both arguments must fit in 16 bits ("BEEP argument exceeds 16 bits"); fails with "VDP audio timeout". Example: 440 200 BEEP DROP native, board
TONE ( freq ms -- ) Play a square tone of freq Hz (up to 8191) for ms milliseconds on the first idle voice, or on voice 0 when all three are busy, so a tone does not cut a playing tune. Returns at once; the ESP times the note. Example: 440 200 TONE native, board
TUNE ( addr u slot -- ) Store tune text (at most 255 bytes) in slot 0..7 on the ESP; u 0 frees the slot. The ESP checks the whole text first: an invalid tune is not stored (SOUND? cannot show where; the host harness's audio status can). Voices playing that slot stop. Tunes live in ESP RAM and are lost when the ESP restarts. Example: S" t140 l8 cdefg>c" 0 TUNE native, board
PLAY ( slot voice -- ) Start the tune in slot (0..7) on voice 0..2 from its beginning, with the default settings o4 l4 t120 v12 w0 q7. Nothing happens for an empty slot. Example: 0 0 PLAY native, board
STOP ( voice -- ) Silence voice 0..2 and end its tune; -1 (or any value above 2) stops all voices. Example: -1 STOP native, board
VOLUME ( n -- ) Set the master volume, 0..127 (default 127). It scales all three voices. Example: 100 VOLUME native, board
SOUND? ( -- mask ) Ask the ESP which voices are sounding: bit n is set while voice n plays a tone or tune. The only audio word that waits for a reply. Example: SOUND? . native, board

Tasks

Background tasks and preemption.

Word Stack effect Description Kind
SPAWN ( xt -- id ) Start xt as a background task in a free slot and return its id (1..4). The task's output (EMIT, TYPE, ., CR) goes to a private 128-byte ring that TASK-OUT reads; it starts with an empty stack and its spawner's BASE. Fails with "no free task slot" when all four slots are live, and inside a module transaction. Example: : T 6 7 * . ; ' T SPAWN . \ 1 native
SPAWN-CON ( xt -- id ) Like SPAWN, but the task's output goes to the console: it waits in the task's ring and is printed on its own lines when the REPL is idle, followed by a fresh prompt. This is how AUTORUN starts. A slot whose console text has not been printed yet is not reused. Example: : HI ." hello" CR ; ' HI SPAWN-CON . \ 1 native
PAUSE ( -- ) In a task: end the current slice now and let the others run. In the foreground: run one scheduler round, giving each ready task one slice. With tick preemption on, a task does not need PAUSE to share the CPU, but it is still the cheapest way to yield. Example: PAUSE native
MS ( u -- ) Wait u milliseconds. A task sleeps without using the CPU (state sleeping) and is woken by the scheduler. In the foreground the wait runs tasks meanwhile and Ctrl-C interrupts it. The task clock is the eZ80's 288 kHz timer, sampled at scheduling points. Example: 10 MS native
TASK-KILL ( id -- ) Stop task id: its state becomes killed (5), its remaining output is delivered where possible and every handle it owns is closed. Killing a task that already ended does nothing; an id outside 1..4 fails with "invalid task id". Example: : T BEGIN 5 MS AGAIN ; ' T SPAWN DUP TASK-KILL TASK-STATE . \ 5 native
TASK-STATE ( id -- n ) Return the state of task id: 0 free, 1 ready, 2 sleeping, 3 done, 4 failed, 5 killed. The state stays readable after the task ends until its slot is reused. Example: : T ; ' T SPAWN 10 MS TASK-STATE . \ 3 native
PREEMPT ( flag -- ) Turn tick preemption on (non-zero, the default) or off (0). With it on, the board's timer ends a background slice after 4 ms and lets ready tasks run every 4 ms even while a foreground command computes. With it off, tasks switch only at PAUSE, MS, FRAME-WAIT, a waiting KEY, the end of an instruction budget (TASK-SLICE), or when the REPL is idle. Example: 0 PREEMPT 1 PREEMPT native
PREEMPT-STATS ( -- ) Print "preempt on|off|none switches N ignored N critical N": whether preemption is on, how many tick switches happened, how many ticks were ignored (inside CRITICAL(, compilation, module transactions, TRACE) and the current CRITICAL( depth. "none" means no tick source is installed (host builds). Example: PREEMPT-STATS native
FRAME-WAIT ( -- ) Sleep until the next 60 Hz frame boundary (multiples of 50/3 ms on the task clock, rounded up), so a render loop wakes at a steady rate whatever its own work took. In the foreground it waits like MS and Ctrl-C interrupts it. Example: FRAME-WAIT native
CRITICAL( ( -- ) Begin a section in which timer ticks are ignored, so no other task runs until the matching )CRITICAL. Use it around read-modify-write of shared variables and multi-part VDU sequences. Sections nest up to 255 deep; the normal execution budget still bounds a forgotten )CRITICAL, and a failing command resets the depth. Example: VARIABLE HITS CRITICAL( 1 HITS +! )CRITICAL HITS @ . \ 1 native
)CRITICAL ( -- ) End a section started by CRITICAL(. Extra )CRITICAL words are ignored. Example: CRITICAL( )CRITICAL native
TASK-INPUT ( id h -- ) Make handle h the standard input of task id: its KEY reads bytes from h. On an empty pipe KEY waits (the task retries on its next slice); at end of input KEY returns -1. The task takes ownership of h, which is closed when the task ends. Without TASK-INPUT, KEY in a task fails. native
TASK-OUTPUT ( id h -- ) Make handle h the standard output of task id: EMIT, TYPE, . and CR go to h, drained from the task's ring between slices (a full pipe makes the task wait). The task takes ownership of h. If the reader closes the pipe the task fails with "broken pipe". native
TASK-OUT ( -- ) TASK-OUT id Command: print and empty the output ring of task id as "task-out ID hex BYTES dropped N", the bytes in hexadecimal and N the bytes lost because the 128-byte ring was full. Use it to collect the output of a SPAWNed task. Example: : T 42 . ; ' T SPAWN DROP 10 MS TASK-OUT 1 compiler
TASK-SLICE ( -- ) TASK-SLICE n Command: set the instruction budget of one background slice, 64..65535 (default 1024). With preemption on, the 4 ms tick usually ends a slice first; with it off (or on host builds) this budget is the only bound. Example: TASK-SLICE 2048 TASK-SLICE 1024 compiler
TASKS ( -- ) TASKS Command: print "task-slice N", then one line per slot with state, xt, name (as hex bytes), slices and instructions run, stack depths and peaks, buffered and dropped output bytes, error text (hex) and the task's BASE. Example: TASKS compiler

Pipes and pipelines

Connecting tasks through pipes.

Word Stack effect Description Kind
PIPE ( -- hr hw \| -err 0 ) Create a 128-byte pipe and return its read handle hr and write handle hw (hw on top). When no pipe or handle is free it returns a negative error code and 0 instead. Writes to a full pipe and reads from an empty one return -1 (try again); a read returns 0 once every writer has closed; a write fails with -2 once every reader has closed. Example: PIPE CLOSE . CLOSE . \ 0 0 native
PIPELINE ( xt1 xt2 -- id1 id2 ) Run xt1 and xt2 as two tasks joined by a pipe: everything xt1 prints becomes xt2's KEY input, and xt2 prints to the console (SPAWN-CON). Returns both task ids, the consumer's id on top. Each task owns its end, so xt2 sees end of input (-1) when xt1 finishes. colon
PL-R ( -- addr ) Variable used by PIPELINE: the read handle of the pipe it created most recently. Internal; the consumer task owns that handle. Example: PL-R @ . variable
PL-W ( -- addr ) Variable used by PIPELINE: the write handle of the pipe it created most recently. Internal; the producer task owns that handle. Example: PL-W @ . variable

Handles and devices

Uniform non-blocking I/O on files, pipes and /dev endpoints.

Word Stack effect Description Kind
OPEN ( addr u mode -- h \| -err ) Open the path addr u for reading (mode 1) or writing (mode 2) and return a handle 1..8, or a negative error code (-4 nothing free, -5 bad path or file not found, -7 bad mode). SD files opened for writing are created or truncated. Paths: SD files, /host/... (Mac files through the harness), /dev/null, /dev/cons (write), /dev/tasks (read) and devices made with DEVICE. Example: S" /dev/null" 2 OPEN DUP . CLOSE . \ 1 0 native
CLOSE ( h -- 0 \| -err ) Close handle h and return 0, -3 for a handle that is not open, or -6 when the file system reported an error while closing (the message is in HANDLES). Closing the last writer of a pipe gives its reader end of input. Example: S" /dev/null" 1 OPEN CLOSE . \ 0 native
READ ( addr u h -- n \| -err ) Read up to u bytes from handle h into addr and return the count; 0 means end of input. Never blocks: an empty pipe returns -1. Other errors: -3 bad handle, -6 I/O error, -7 handle opened for writing. READ-WAIT is the blocking form. native
WRITE ( addr u h -- n \| -err ) Write up to u bytes from addr to handle h and return how many were accepted, possibly fewer than u for a pipe. Never blocks: a full pipe returns -1; a pipe without readers returns -2. Other errors: -3 bad handle, -6 I/O error, -7 handle opened for reading. WRITE-ALL is the blocking form. Example: S" /dev/null" 2 OPEN CONSTANT N S" hi" N WRITE . N CLOSE . \ 2 0 native
READ-WAIT ( addr u h -- n ) Like READ, but while READ returns -1 (no data yet) it calls PAUSE and tries again. Returns the byte count, 0 at end of input, or another negative error code. Defined in Forth over READ, so you can replace the policy. Definition: : READ-WAIT >R BEGIN 2DUP R@ READ DUP -1 = WHILE DROP PAUSE REPEAT R> DROP >R 2DROP R> ; colon
WRITE-ALL ( addr u h -- 0 \| -err ) Write all u bytes to h, calling PAUSE whenever the pipe is full, and return 0, or the first negative error code (such as -2 broken pipe). Defined in Forth over WRITE. Example: S" /dev/null" 2 OPEN CONSTANT N S" hi" N WRITE-ALL . N CLOSE . \ 0 0 colon
DEVICE ( addr u xt -- ) Register /dev/NAME (addr u, 1..11 printable characters) served by the word xt, or replace an existing one; xt 0 removes it. Opening the device creates a pipe and starts xt as a task: opened for reading, the task's output is what you read; opened for writing, what you write is the task's KEY input. At most 4 devices. Example: : TEN 10 0 DO I . LOOP ; S" ten" ' TEN DEVICE native
HANDLES ( -- ) HANDLES Command: list every open handle (number, kind file/pipe/null/cons/snapshot/host, direction, owner task, bytes moved, bytes buffered in a pipe, path), every registered device, and the last I/O error message. Example: HANDLES command
HANDLE-GET ( -- ) HANDLE-GET h n Command for host tools: read up to n bytes (1..64) from handle h without blocking and print "get HEX", or "get -" at end of input (an empty pipe prints "get " with no bytes). command
HANDLE-PUT ( -- ) HANDLE-PUT h HEX Command for host tools: write the bytes given as hexadecimal digits to handle h and print "put N", the number accepted (a pipe can take fewer). command

Files and loading

The SD card, Mac host files and source loading.

Word Stack effect Description Kind
FS-READ ( addr u dest cap -- n ior ) Deferred service binding, initially FILE-READ: read the whole file named by addr u (1..127 printable characters) into dest, at most cap bytes (capped at 4096); push the byte count and 0 on success, 1 on failure. Example: CREATE FB 64 ALLOT S" /VIOS/NONE.TXT" FB 64 FS-READ . . defer
FS-WRITE ( addr u src n -- ior ) Deferred service binding, initially FILE-WRITE: write n bytes from src as the file named by addr u, replacing it. Pushes 0 on success, 1 on failure, 2 when n exceeds 4096. Example: S" /VIOS/FSW.TXT" S" hi" FS-WRITE . \ 0 defer
SD-MOUNT ( -- ior ) Mount the SD card again (after swapping it, for example) and return 0 on success or 1 on failure; FS-ERROR prints why. Only FAT32 cards are accepted. Note the result is 0 for success, not a Forth true flag. Example: SD-MOUNT . \ 0 native
FS-ERROR ( -- ) Print the last SD file system message ("ok", "file not found", "file exceeds buffer", "not FAT32", ...) on its own line. Example: FS-ERROR native
FILE-READ ( addr u dest cap -- n ior ) Read the whole SD file named addr u into dest (at most cap bytes, capped at 4096) and return its length n and ior 0, or 0 and ior 1 on failure (FS-ERROR says why; a file larger than cap fails with "file exceeds buffer"). For larger files use OPEN and READ. Not for /host/ paths. Example: CREATE B 64 ALLOT S" /VIOS/T.TXT" S" abc" FILE-WRITE DROP S" /VIOS/T.TXT" B 64 FILE-READ . . \ 0 3 native
FILE-WRITE ( addr u src n -- ior ) Create or replace the SD file named addr u with the n bytes at src, flushed to the card before it returns. Returns 0 on success, 1 on a file system error, 2 when n exceeds 4096. Not for /host/ paths. Example: S" /VIOS/T.TXT" S" hello" FILE-WRITE . \ 0 native
FILE-REMOVE ( addr u -- ior ) Delete the SD file (or empty directory) named addr u. Returns 0 on success, 1 on failure. Example: S" /VIOS/T.TXT" S" x" FILE-WRITE DROP S" /VIOS/T.TXT" FILE-REMOVE . \ 0 native
DIR ( -- ) DIR path Command: list an SD directory, one line per entry: "entry NAME size N dir 0|1". Paths are absolute; names are 8.3. Example: DIR /VIOS command
LOAD ( -- ) LOAD path Command: read a Forth source file (at most 4096 bytes) from SD, or from the Mac for /host/ paths, and evaluate it. A file that ends inside a definition fails with "incomplete definition in source file". Files may LOAD or INCLUDE others up to 4 deep. Example: S" /VIOS/HI.FTH" S" 6 7 * ." FILE-WRITE DROP LOAD /VIOS/HI.FTH \ 42 command
INCLUDE ( -- ) INCLUDE path Command: the same as LOAD (same code, same limits); both names are accepted. Example: S" /VIOS/HI.FTH" S" 6 7 * ." FILE-WRITE DROP INCLUDE /VIOS/HI.FTH \ 42 command

Modules

Staged, tested, transactional source modules.

Word Stack effect Description Kind
MODULE-BEGIN ( -- ) MODULE-BEGIN name version test\|- Command: start building a module source in the builder: name and version are 1..31 printable characters, test is the name of a word that must return one true flag after loading, or - for none. Follow with MODULE-DEP lines, MODULE-DATA lines and MODULE-STAGE. Example: MODULE-BEGIN DEMO 1.0 - command
MODULE-DEP ( -- ) MODULE-DEP name crc Command: pin a dependency of the module being built: the live module name with source CRC-32 crc (eight hex digits, as MODULES prints in decimal). Up to 4 per module; staging fails if the dependency is missing or has another CRC. command
MODULE-DATA ( -- ) MODULE-DATA hex Command: append source bytes, given as an even number of hex digits (at most 232 digits, 116 bytes, per line, though 220 digits keep the line within the 235-character console limit; no 00 byte), to the module being built. The whole source is ASCII and at most 4096 bytes. Example: MODULE-BEGIN DEMO 1.0 - MODULE-DATA 3A2058203B command
MODULE-STAGE ( -- ) MODULE-STAGE Command: check and dry-run the built source in a transaction (compile it, run the test word, then undo everything) and keep it as the pending module; prints "staged NAME crc32 N". Only one module can be pending; MODULE-ACTIVATE or MODULE-DISCARD it first. command
MODULE-ACTIVATE ( -- ) MODULE-ACTIVATE name Command: compile the pending module for real in one transaction (the test word runs again) and make it the module's current generation; the old current becomes previous. If anything fails nothing changes. command
MODULE-ROLLBACK ( -- ) MODULE-ROLLBACK name Command: undo the latest activation, which must be of name: its words disappear and the module records return to what they were. Only the most recent activation has a rollback checkpoint, and no module may be pending. command
MODULE-DISCARD ( -- ) MODULE-DISCARD Command: drop the pending (staged) module and any module being built. Always succeeds. Example: MODULE-DISCARD command
MODULE-SOURCE ( -- ) MODULE-SOURCE name [PREVIOUS] Command: print the exact source of a module's current generation (or its previous one with PREVIOUS) as "source-hex" lines of up to 64 bytes in hex. command
MODULE-LOAD ( -- ) MODULE-LOAD path Command: read a saved package (.VIM), check its header and CRCs, then compile and activate it in one transaction (dependencies must already be live). Boot uses the same path for each slot entry. command
MODULES ( -- ) MODULES Command: list the active modules, one line each ("module NAME version V crc32 N bytes N deps N active 1 previous 0|1"), followed by a "dependency" line per pinned dependency. CRCs are printed in decimal. Example: MODULES command
SAVE ( -- ) SAVE name [/path.ext] Command: write the current generation of module name, and first every module it depends on, as immutable package files /VIOS//.VIM, and print "saved PATH". With a path (8.3 name with an extension) it also writes a copy there. Writing the same package twice is harmless; different data at the same path is an error. command

Boot slots

A/B source slots and startup.

Word Stack effect Description Kind
BOOT-TRIAL ( -- ) BOOT-TRIAL Command: write every active module (saved as packages, in dependency order) into the boot slot that is not confirmed (B when A is confirmed, otherwise A) and mark it as the candidate for the next boot. The next boot tries it; if it loads and passes the health check it becomes confirmed, otherwise the confirmed slot boots. command
BOOT-CONFIRM ( -- ) BOOT-CONFIRM Command: confirm the running trial slot. Startup already confirms a healthy trial by itself, so this normally reports success without changes; it matters only if that automatic record write failed. Fails with "no running trial boot to confirm" otherwise. command, board
BOOT-REVERT ( -- ) BOOT-REVERT Command: cancel a pending trial, or, when none is pending, swap the confirmed slot with the previous confirmed one. Takes effect at the next boot; it does not reboot. command
BOOT-STATUS ( -- ) BOOT-STATUS Command: print "boot confirmed A|B|NONE candidate A|B|NONE state CLEAN|PENDING|TRIED current A|B|NONE generation N": the slots in the boot record, the slot that was loaded at this boot, and the record's write count. Example: BOOT-STATUS command
BOOT-MANIFEST ( -- ) BOOT-MANIFEST Command: show what a power cycle would load: for the confirmed and the candidate slot a "manifest" line (module count and bundle CRC, or the error), then one "manifest-module" line per module with version, CRC and whether its package file is ok, bad or unreadable. Read-only. Example: BOOT-MANIFEST command
BOOT-TIMES ( -- ) BOOT-TIMES Command: print how long each startup step took in ms (storage, state, modules, health, finish, total), with the number of module loads, the slowest module, the boot-module cache result (hit, stale, corrupt, absent, unstamped, identity, saved) and the read/check/compile split. Example: BOOT-TIMES command

GUI: setup and batching

Resetting, configuring and batching display-server operations.

Word Stack effect Description Kind
UI-RESET ( -- ) Reset the display server (op 34): close every window, undefine all sprites and surfaces, forget all commands, menus and widgets, go back to the Smalltalk style and 8-pixel snap, clear the error count and start a new epoch; the CPU's pending batch and event ring are dropped too. On the board this also closes the server's own Console window and removes the GUI tools' commands and world menu, which come back only after a reboot, so prefer closing your own windows with UI-CLOSE. Example: UI-RESET native, board
UI-RAW ( flag -- ) While flag is true, legacy VDU drawing owns the screen and the compositor stops drawing; false gives the screen back and repaints everything (op 35). Example: TRUE UI-RAW FALSE UI-RAW native, board
UI-STYLE ( n -- ) Switch the presentation style: 0 Smalltalk (grey desktop, white windows, title tabs, pop-up menus), 1 Turbo Vision (blue desktop, double frames, centred titles, menu bar and status line). Every window is re-decorated and repainted; no state is lost. Other values fail with an error. Example: 1 UI-STYLE 0 UI-STYLE native, board
UI-SNAP ( n -- ) Set the horizontal snap of window positions: 8 (default, client x on a cell boundary, fastest text drawing) or 1 (any pixel). Other values fail. A single window can opt out of snapping with the UI-FREE-X flag. Example: 1 UI-SNAP 8 UI-SNAP variable, board
UI-BEGIN ( -- ) Start a batch: the following UI words collect their ops in the CPU's 250-byte buffer instead of sending each at once (a full buffer is sent and collecting goes on). End the batch with UI-COMMIT so the ESP shows the whole change at once. Example: UI-BEGIN S" Notes" 1 UI-TITLE UI-COMMIT native, board
UI-COMMIT ( -- ) End a batch and send it with a COMMIT op (30): everything sent so far appears in the same frame. Also useful without UI-BEGIN: unbatched ops are held on the ESP until a commit or for at most 33 ms. Example: UI-COMMIT native, board
UI-SYNC ( -- epoch generation errors ) Ask the display server for its state (op 31) and wait for the reply: epoch (counts UI-RESETs), generation (batches applied) and the number of refused ops since the last reset (at most 255). Fails with "UI-SYNC: no display server reply" when no server answers. Foreground only: it cannot run in a background task. native, board
UI-SNAPSHOT ( -- ) Print Forth source that rebuilds the display server's current windows and widgets, text views' text included (the contents of /dev/ui/tree). Save it to a file and LOAD it to restore the layout. colon, board

GUI: windows

Opening, placing and managing windows.

Word Stack effect Description Kind
UI-WINDOW ( id surface x y cols rows flags -- ) Open window id (0..26; 20..24 are the GUI tools', 26 the workbench's, so applications use 0..19) showing surface (or 255 for none). x, y is the pixel position of the client area's top-left corner (x snaps to 8 unless UI-FREE-X or UI-SNAP 1); cols x rows is its size in cells, 1..255. flags: UI-VISIBLE UI-DECOR UI-SHADOW UI-ACTIVE UI-FREE-X UI-MODAL, added together. The title starts empty (UI-TITLE). Example: 0 40 10 48 UI-SURFACE 1 0 160 120 40 10 7 UI-WINDOW native, board
UI-TITLE ( addr len id -- ) Set the title of window id (at most 31 characters, else an error). Smalltalk shows it in a tab above the top-left corner, Turbo Vision centred in the top frame. Example: S" Notes" 1 UI-TITLE native, board
UI-PLACE ( id x y cols rows -- ) Move and resize window id in one step (pixels for x, y; cells for cols, rows, 1..255). Widgets inside lay themselves out again. Example: 1 200 100 30 8 UI-PLACE native, board
UI-RAISE ( id -- ) Bring window id to the top of the stacking order without giving it the keyboard. Example: 1 UI-RAISE native, board
UI-CLOSE ( id -- ) Close window id. The ESP forgets its widgets (their ids become free) and its pop-up menu binding; its surface stays and can be shown again. Example: 1 UI-CLOSE native, board
UI-FOCUS ( id -- ) Give window id the keyboard: raise it, mark it active and send a FOCUS event. Only visible decorated windows can take focus, and none other than the topmost modal window while one is shown (the request is then refused as an ERROR event). Example: 1 UI-FOCUS native, board
UI-FLAGS ( id flags -- ) Replace the flags of window id (0..255): UI-VISIBLE 1, UI-DECOR 2, UI-SHADOW 4, UI-ACTIVE 8, UI-FREE-X 16, UI-MODAL 32. Clearing UI-VISIBLE hides the window without closing it. Example: 1 UI-VISIBLE UI-DECOR OR UI-FLAGS native, board
UI-CLIENT ( id surface -- ) Show another surface in window id; several windows may show the same surface. Example: 1 0 UI-CLIENT native, board
UI-VIEW ( id col row -- ) Scroll the client area of window id so that surface cell col, row is at its top-left corner (for a surface bigger than the window). Example: 1 0 2 UI-VIEW native, board
UI-KEYS ( id policy -- ) Key policy of window id: 0 (default) passes keys that no window-manager binding or widget uses on to the CPU's keyboard input; 1 drops them (F1 still goes through). The GUI tools use 1. Example: 1 1 UI-KEYS 1 0 UI-KEYS native, board

GUI: surfaces and cells

Character surfaces that windows show.

Word Stack effect Description Kind
UI-SURFACE ( id cols rows attr -- ) Create (or resize and clear) surface id, a grid of cols x rows character cells filled with spaces in attr. Ids 0..10 belong to the CPU (5..9 are used by the GUI tools, 10 by the workbench); cols 1..80, rows 1..60. attr is fg + 16 * bg, palette indices; 0..3 are black, red, yellow and white in both styles. Example: 0 40 10 48 UI-SURFACE native, board
UI-TYPE ( addr len id col row attr -- ) Write a string of at most 255 characters into surface id at col, row in one attribute; longer text is sent in 64-character runs. Text past the right edge is clipped. Every window that shows the surface updates. Example: S" Hello" 0 1 1 48 UI-TYPE native, board
UI-FILL ( id col row w h char attr -- ) Fill a w x h rectangle of surface id with character char in attr. Characters 1 and 2 are the server's one-pixel vertical and horizontal line glyphs (used for pane dividers). Example: 0 0 0 40 10 32 48 UI-FILL native, board
UI-SCROLL ( id dy attr -- ) Scroll the whole surface by dy rows, -127..127; a positive dy moves the text up. Vacated rows become spaces in attr. Example: 0 1 48 UI-SCROLL native, board
UI-CARET ( id col row shape blink -- ) Place the text caret of surface id at col, row. shape: 0 off, 1 block, 2 underline, 3 bar; a true blink makes the ESP blink it every 500 ms by itself. Example: 0 5 1 2 TRUE UI-CARET native, board

GUI: commands and menus

Commands, menus, popups and accelerators.

Word Stack effect Description Kind
UI-COMMAND ( addr len id flags vk mods ascii -- ) Define (or redefine) command id (0..65023; 32512..32767 = $7F00.. are the GUI tools') with a label of at most 23 characters ('&' marks the mnemonic). flags: UI-ENABLED (needed to be chosen), UI-CHECKED, UI-STATUS (shown on the Turbo Vision status line). The accelerator is vk (a virtual key such as 159..170 for F1..F12, or 0) or else ascii, plus mods (UI-CTRL UI-SHIFT UI-ALT). Choosing it from a menu, the palette or its accelerator sends a COMMAND event. The ESP holds 64 commands. Example: S" &Quit" 100 UI-ENABLED 0 UI-CTRL 113 UI-COMMAND native, board
UI-MENU ( item1 .. itemN n addr len menu -- ) Define menu 0..15 with a title (at most 15 characters) and n items (at most 16): command ids, UI-SEPARATOR, or m UI-SUBMENU for menu m. Note that n sits under the title string. Menu 0 is the world menu (Smalltalk) or the menu bar (Turbo Vision); the GUI tools define menu 0, 12, 14 and 15, so pick other ids unless you mean to replace them. Example: 100 101 2 S" File" 1 UI-MENU native, board
UI-STATE ( id flags -- ) Change the flags of command id: UI-ENABLED 2, UI-CHECKED 4 (a '*' in menus), UI-STATUS 8. Pass all the flags you want; the old ones are replaced. Example: 100 UI-ENABLED UI-CHECKED OR UI-STATE native, board
UI-POPUP ( id menu -- ) Bind menu 0..15 as the pop-up menu of window id, opened with Shift+F10 while the window has focus; 255 restores the default (the world menu). It does not open the menu. Example: 1 1 UI-POPUP native, board
UI-SUBMENU ( menu -- item ) Turn a menu id into a menu item that opens it as a submenu (65024 OR menu). Submenus nest at most three levels deep. Example: 2 UI-SUBMENU . \ 65026 Definition: : UI-SUBMENU 65024 OR ; colon

GUI: widgets

Widgets and their layout.

Word Stack effect Description Kind
UI-WIDGET ( id window kind parent col row w h flags -- ) Create widget id (0..63, shared by all windows; 40..63 are the GUI tools') in window id. kind: UI-BOX UI-LABEL UI-BUTTON UI-CHECK UI-RADIO UI-INPUT UI-LIST UI-PROGRESS UI-TEXTVIEW UI-TABS (1..10). parent is a box widget of the same window or UI-NONE; col, row, w, h place it in client cells unless the parent box lays it out. flags: UI-HIDDEN UI-DISABLED UI-WF-FILL UI-READONLY UI-TREE UI-PAGER. Reusing an id replaces that widget; Tab order is creation order. Example: 0 40 10 48 UI-SURFACE 1 0 160 120 40 10 7 UI-WINDOW 5 1 UI-BUTTON UI-NONE 0 0 10 1 0 UI-WIDGET native, board
UI-WTEXT ( addr len id -- ) Set the text of widget id (at most 47 characters): the caption of a label, button, check box or radio ('&' marks a mnemonic, shown highlighted), the contents of an input field, the header of a table (cells separated by a tab character) or the tab labels of a tabs widget, separated by '|'. Example: S" &Go" 5 UI-WTEXT native, board
UI-WVALUE ( id value -- ) Set the value of widget id (signed 16 bits): 0/1 for a check box; nonzero selects a radio and clears the others with the same parent; 0..100 for a progress bar; the selected row of a list or tab of a tabs widget (clamped); the caret of an input field. For a TextView it sets (nonzero) or clears (0) the dirty flag. No event is sent. Example: 5 1 UI-WVALUE native, board
UI-LAYOUT ( id layout gap -- ) Make box id lay out its children in creation order: layout 0 none, 1 column (UI-COLUMN), 2 row (UI-ROW), with gap empty cells between them. Each child gets its fixed size from UI-WSIZE, the rest is shared by weight. A one-pixel divider line is drawn in the gap between two panes (lists, text views, boxes). Example: 0 1 UI-BOX UI-NONE 0 0 0 0 UI-WF-FILL UI-WIDGET 0 UI-COLUMN 1 UI-LAYOUT native, board
UI-WSIZE ( id fixed weight -- ) Size of widget id inside a laid-out box: fixed cells along the box's direction (0..255), or, when fixed is 0, a share of the remaining room by weight (0 counts as 1; the default weight is 1). Example: 5 1 0 UI-WSIZE native, board
UI-ITEM ( addr len id index -- ) Set row index (0..1023, below the list's count) of list widget id to a string of at most 31 characters. In a table, a tab character (9) separates the cells. Lists share a pool of 1024 rows on the ESP. Example: S" alpha" 3 0 UI-ITEM native, board
UI-ITEMS ( id count -- ) Set the number of rows of list widget id (0..1024). New rows start empty; fill them with UI-ITEM. To append rows one at a time use UI-ROW+. Example: 3 2 UI-ITEMS native, board
UI-WDELETE ( id -- ) Delete widget id and all its children; its area is cleared and the window lays out again. Example: 5 UI-WDELETE native, board
UI-WFOCUS ( id -- ) Make widget id the focused widget of its window (it gets the keys while the window has focus). Disabled, hidden or non-interactive widgets are refused. Example: 5 UI-WFOCUS native, board
UI-WGET ( id addr -- value len ) Read widget id back from the ESP: its value (signed; the caret position for an input field) and its text, of which at most 25 characters are copied to addr; len is the number copied. Fails with "UI-WGET: no such widget". Foreground only. native, board
UI-ROW+ ( addr len id -- ) Append one row to list widget id (protocol op 92), as UI-TEXT+ appends text. The row count grows by one; at most 1024 rows. Example: S" first" 10 UI-ROW+ native, board
UI-COLUMNS ( w1 .. wn n id -- ) Turn list id into a table with n columns (at most 8) of widths w1..wn cells (0..80 each); 0 UI-COLUMNS makes it a plain list again. Rows and the header (widget text) separate cells with a tab character; each cell is clipped to its width. Example: 8 12 2 3 UI-COLUMNS native, board
UI-WNAME ( addr len id -- ) Give widget id a name, as /dev/win lists it (spaces show as _). native, board
UI-WSTYLE ( id style -- ) Set a widget's look: 0 normal, 1 strong, 2 fault (drawn in red). The same as writing style N to /dev/win/N/ctl. native, board

GUI: text views

Editable text views.

Word Stack effect Description Kind
UI-TEXT ( addr len id -- ) Replace the whole text of TextView id (at most 4096 bytes; lines end in a line feed, CR is dropped). The text is sent in 200-byte runs. The view is edited locally on the ESP from then on. Example: S" : SQ DUP * ;" 11 UI-TEXT native, board
UI-TEXT+ ( addr len id -- ) Append text to TextView id, up to its 4096-byte limit. Example: S" 3 SQ ." 11 UI-TEXT+ native, board
UI-INSERT ( addr len id -- ) Insert at most 200 bytes at the caret of TextView id, replacing the selection; the inserted text is then selected (the Workspace's print it works this way). Example: S" 9" 11 UI-INSERT native, board
UI-SELECT ( id caret anchor -- ) Set the caret and the selection anchor of TextView id (byte offsets; caret = anchor means no selection). The view scrolls to show the caret. Example: 11 0 0 UI-SELECT native, board
UI-TEXT@ ( id addr max -- len ) Copy the text of TextView id into addr, at most max bytes, and return the length copied; it asks for the length first, then reads 25 bytes per reply. Fails with "UI-TEXT@: no such TextView". Foreground only. native, board
UI-CH ( char id -- ) Append one character to text view id (through UI-TEXT+). /dev/ui/tree uses it for newlines and quote characters that S" cannot hold. Definition: : UI-CH >R UI-CH-BUF C! UI-CH-BUF 1 R> UI-TEXT+ ; colon, board
UI-CH-BUF ( -- addr ) The one-byte buffer UI-CH sends from. Internal. variable

GUI: events

Pulling and decoding display-server events.

Word Stack effect Description Kind
UI-EVENT ( addr -- len ) Take the next event as raw bytes: seq kind id and up to 26 argument bytes (at most 29 bytes) are stored at addr and len is returned, or 0 when no event waits. When the CPU's 8-event ring is empty it polls the ESP first. Fails with "UI-EVENT: no display server reply". Foreground only. native, board
UI-NEXT ( -- kind id arg true \| false ) Take the next event, decoded: kind (UI-EV-*), id (window, widget or 0) and arg, the first two argument bytes as an unsigned little-endian number (one byte if the event has only one): the command id, list row, widget value, previous focus... For UI-EV-WIN use arg 255 AND for what happened (2 = close request). Returns false when nothing waits. Fails with "UI-NEXT: no display server reply". Foreground only. native, board

GUI: animation

Tweens and their easing.

Word Stack effect Description Kind
UI-ANIMATE ( target id prop from to ms easing -- ) Start a tween run by the ESP at frame rate: target UI-TWEEN-WINDOW (window 0..26) or UI-TWEEN-SPRITE (0..15); prop UI-X, UI-Y (pixels) or, for windows, UI-SCROLL-ROW, UI-SCROLL-COL; from and to are signed; ms 0..65535 (0 jumps at once); easing UI-LINEAR, UI-IN-OUT, UI-OUT, UI-SPRING (overshoots). A new tween on the same target, id and property replaces the old one; at most 16 run at once. An ANIMDONE event reports the end. Example: UI-TWEEN-WINDOW 1 UI-Y 0 120 400 UI-OUT UI-ANIMATE native, board
UI-STOP ( target id prop -- ) Stop the tween on that target, id and property where it is, without an ANIMDONE event. Example: UI-TWEEN-WINDOW 1 UI-Y UI-STOP native, board

GUI: canvases and icons

Pixel graphics as display lists the ESP keeps.

Word Stack effect Description Kind
UI-CANVAS ( canvas surface x y w h bg flags -- ) Create or replace canvas 0..7: w x h pixels (up to 640 x 480) at pixel x y (x a multiple of 8) of a surface, background colour bg, flags UI-CV-VISIBLE and/or UI-CV-CLEAR (transparent: bg is the key colour). Replacing a canvas drops its items. All canvas rasters together are limited to 256 KB. Example: 3 2 0 0 320 144 3 UI-CV-VISIBLE UI-CANVAS native, board
UI-CANVAS-AT ( canvas x y -- ) Move a canvas on its surface (x a multiple of 8). native, board
UI-CANVAS-FLAGS ( canvas flags -- ) Set a canvas's flags (UI-CV-VISIBLE, UI-CV-CLEAR): show, hide or make it transparent. Flags -1 deletes the canvas and its items. native, board
UI-PEN ( canvas colour -- ) Choose the canvas and colour (0..15) that the following item words use. CPU state only: nothing is sent. Example: 3 4 UI-PEN native
UI-SHAPE ( item a b c d kind -- ) Set item 0..254 of the pen's canvas to a shape: kind 1 dot, 2 line, 3 rectangle outline, 4 filled bar, 5 oval, 6 disc, 9 stipple (with the second colour in bits 8..11 of kind). The named words UI-DOT ... UI-STIPPLE are colon definitions over it. native, board
UI-DOT ( item x y -- ) Set an item to one pixel in the pen colour. Definition: : UI-DOT 0 0 1 UI-SHAPE ; colon, board
UI-LINE ( item x0 y0 x1 y1 -- ) Set an item to a line, both end points included. Example: 0 10 130 300 130 UI-LINE Definition: : UI-LINE 2 UI-SHAPE ; colon, board
UI-RECT ( item x y w h -- ) Set an item to a 1-pixel rectangle outline. Definition: : UI-RECT 3 UI-SHAPE ; colon, board
UI-BAR ( item x y w h -- ) Set an item to a filled rectangle. Example: 1 20 60 30 70 UI-BAR Definition: : UI-BAR 4 UI-SHAPE ; colon, board
UI-OVAL ( item x y w h -- ) Set an item to an ellipse outline inscribed in the box. Definition: : UI-OVAL 5 UI-SHAPE ; colon, board
UI-DISC ( item x y w h -- ) Set an item to a filled ellipse inscribed in the box. Definition: : UI-DISC 6 UI-SHAPE ; colon, board
UI-STIPPLE ( item x y w h colour2 -- ) Set an item to a filled rectangle in a two-colour checker of the pen colour and colour2: the way to shade with 16 colours. Definition: : UI-STIPPLE 256 * 9 + UI-SHAPE ; colon, board
UI-PRINT ( addr n item x y -- ) Set an item to text (up to 20 characters) in the 8x8 font at pixel x y, in the pen colour, with a transparent background. Put a UI-BAR under it for a background. Example: S" sales" 2 20 132 UI-PRINT native, board
UI-ICON ( item x y bitmap -- ) Set an item to a bitmap (0..31; 24..31 are the built-in icons) at pixel x y; the bitmap's transparent colour is skipped. Example: 5 4 4 UI-ICON-FOLDER UI-ICON native, board
UI-ERASE ( item -- ) Delete an item of the pen's canvas; 255 deletes them all. native, board
UI-WIPE ( -- ) Delete every item of the pen's canvas (255 UI-ERASE). Definition: : UI-WIPE 255 UI-ERASE ; colon, board
UI-NUDGE ( item dx dy -- ) Move an item by dx dy pixels. Example: 1 0 -20 UI-NUDGE native, board
UI-INK ( item colour -- ) Recolour an item. native, board
UI-BITMAP ( bitmap w h transparent -- ) Define your own bitmap 0..23, up to 64 x 64 pixels at 4 bits per pixel, with transparent as the colour that is not drawn. Fill it with UI-BITS. Bitmaps are shared by all canvases. native, board
UI-BITS ( addr n bitmap offset -- ) Copy n bytes of 4-bit pixels (two a byte, rows packed) from addr into a bitmap at byte offset; sent in chunks of 64 bytes. native, board

GUI: sprites and pointer

Sprites, the arrow and the keyboard pointer.

Word Stack effect Description Kind
UI-SPRITE ( id w h hotx hoty transparent -- ) Define sprite id (0..15, 15 is the pointer by convention): w x h pixels (1..64), hotspot hotx, hoty inside it, and the colour index drawn as transparent (255: none). Pixels come from a 4096-byte pool on the ESP and start hidden; send them with UI-PIXELS. Example: 1 8 8 4 4 15 UI-SPRITE native, board
UI-PIXELS ( addr len id offset -- ) Copy len bytes of 4-bit pixels into sprite id starting at byte offset (rows of (w + 1) / 2 bytes, high nibble = left pixel), in 64-byte runs. offset + len must stay within the sprite. Example: CREATE PX 32 ALLOT PX 32 34 FILL 1 8 8 4 4 15 UI-SPRITE PX 32 1 0 UI-PIXELS native, board
UI-SPRITE-AT ( id x y -- ) Move sprite id so that its hotspot is at screen pixel x, y. Sprites draw above all windows, higher ids on top. Example: 1 320 240 UI-SPRITE-AT native, board
UI-SPRITE-SHOW ( id flag -- ) Show (true) or hide (false) sprite id. Example: 1 TRUE UI-SPRITE-SHOW native, board
UI-ARROW ( id -- ) Define sprite id as the built-in 12x16 arrow (black and white, hotspot at its tip). Usually UI-CURSOR UI-ARROW; the server also does this by itself on the first pointer move. Example: UI-CURSOR UI-ARROW native, board
UI-POINTER ( x y buttons -- ) Report a pointer position and button state (bit 0 primary) to the server, as a mouse would: the arrow moves there and shows, a press focuses the window under it (and clicks the widget under it in the focused window's client area), and every button change sends a POINTER event. Ctrl+F12 gives the same pointer to the keyboard. Example: 320 240 0 UI-POINTER native, board

GUI: constants

Named values for flags, kinds, events and modifiers.

Word Stack effect Description Kind
UI-CV-VISIBLE ( -- 1 ) Canvas flag: shown. constant
UI-CV-CLEAR ( -- 2 ) Canvas flag: transparent; the background colour is the key and the surface's cells show through. constant
UI-EV-CANVAS ( -- 19 ) Event kind: a click in a visible canvas, with the point in canvas pixels and the topmost item there (255 for none). constant
UI-TWEEN-CANVAS ( -- 2 ) UI-ANIMATE target: a canvas (properties UI-X and UI-Y slide it over its surface). constant
UI-ICON-DOCUMENT ( -- 24 ) Built-in 16x16 icon: a document. constant
UI-ICON-FOLDER ( -- 25 ) Built-in 16x16 icon: a folder. constant
UI-ICON-WORD ( -- 26 ) Built-in 16x16 icon: a Forth word. constant
UI-ICON-MODULE ( -- 27 ) Built-in 16x16 icon: a module. constant
UI-ICON-INFO ( -- 28 ) Built-in 16x16 icon: information. constant
UI-ICON-WARNING ( -- 29 ) Built-in 16x16 icon: a warning. constant
UI-ICON-ERROR ( -- 30 ) Built-in 16x16 icon: an error. constant
UI-ICON-DISK ( -- 31 ) Built-in 16x16 icon: a disk. constant
UI-ROW ( -- 2 ) The layout code 2 for UI-LAYOUT: children side by side. (To append a list row use UI-ROW+.) Example: UI-ROW . \ 2 constant
UI-VISIBLE ( -- 1 ) Window flag: shown. Example: UI-VISIBLE UI-DECOR OR UI-SHADOW OR . \ 7 constant
UI-DECOR ( -- 2 ) Window flag: frame and title in the current style. Only visible decorated windows can take focus. Example: UI-DECOR . \ 2 constant
UI-SHADOW ( -- 4 ) Window flag: drop shadow (4 pixels in Smalltalk, two cells by one cell in Turbo Vision). Example: UI-SHADOW . \ 4 constant
UI-ACTIVE ( -- 8 ) Window flag: drawn as the active window. The server sets and clears it as focus moves. Example: UI-ACTIVE . \ 8 constant
UI-FREE-X ( -- 16 ) Window flag: never snap this window's x position to 8 pixels. Example: UI-FREE-X . \ 16 constant
UI-MODAL ( -- 32 ) Window flag: a dialog. The topmost visible modal window dims everything below it, keeps the focus, and turns Esc into a close request. Example: UI-MODAL . \ 32 constant
UI-ENABLED ( -- 2 ) Command flag: can be chosen (menus show other commands greyed; accelerators and the palette ignore them). Example: UI-ENABLED . \ 2 constant
UI-CHECKED ( -- 4 ) Command flag: shown with a '*' in menus. Example: UI-CHECKED . \ 4 constant
UI-STATUS ( -- 8 ) Command flag: listed with its accelerator on the Turbo Vision status line (bottom row). Commands without an accelerator are not shown. Example: UI-STATUS . \ 8 constant
UI-SEPARATOR ( -- 65535 ) Menu item: a separator line. Example: UI-SEPARATOR . \ 65535 constant
UI-CTRL ( -- 1 ) Accelerator modifier: Ctrl. Example: UI-CTRL UI-SHIFT OR . \ 3 constant
UI-SHIFT ( -- 2 ) Accelerator modifier: Shift. Example: UI-SHIFT . \ 2 constant
UI-ALT ( -- 4 ) Accelerator modifier: Alt (left or right). Example: UI-ALT . \ 4 constant
UI-EV-ACTIVATE ( -- 2 ) Event kind: a button was pressed, or Enter in an input field or list. id = widget, arg = its window. Example: UI-EV-ACTIVATE . \ 2 constant
UI-EV-SELECT ( -- 3 ) Event kind: a list selection or a tab changed. id = widget, arg = the new row or tab. Example: UI-EV-SELECT . \ 3 constant
UI-EV-CHANGE ( -- 4 ) Event kind: a check box or radio changed (arg = new value), an input field was edited (arg = text length), or a TextView became dirty (once). id = widget. Example: UI-EV-CHANGE . \ 4 constant
UI-EV-TEXT ( -- 5 ) Event kind: a TextView command. id = widget; with UI-NEXT, arg 255 AND is what: 1 accept (Ctrl+S), 2 do it (Ctrl+D), 3 print it (Ctrl+P), 4 inspect it (Ctrl+I). UI-EVENT also gives the selection start and end (u16 each) and the window. Example: UI-EV-TEXT . \ 5 constant
UI-EV-FOCUS ( -- 6 ) Event kind: window id got the keyboard; arg = the previous focus (255: none). Example: UI-EV-FOCUS . \ 6 constant
UI-EV-POINTER ( -- 7 ) Event kind: pointer buttons changed. id = window under the pointer (255: desktop), arg = x; UI-EVENT also gives y, the cell column and row, the part (1 client, 2 frame, 3 title tab) and the buttons. Example: UI-EV-POINTER . \ 7 constant
UI-EV-EXPAND ( -- 8 ) Event kind: Right (open) or Left (close) on a row of a UI-TREE list. id = widget, arg = row; the open flag is the fourth argument byte (UI-EVENT). The CPU rewrites the rows. Example: UI-EV-EXPAND . \ 8 constant
UI-EV-PAGE ( -- 9 ) Event kind: a UI-PAGER list was moved past its first or last row. id = widget; arg 255 AND is the direction as a signed byte: 1 / 255 (-1) for Down / Up, 2 / 254 (-2) for PgDn / PgUp. The CPU supplies the next rows. Example: UI-EV-PAGE . \ 9 constant
UI-EV-OVERFLOW ( -- 14 ) Event kind: the ESP's 16-event queue was full and older events were lost; arg = how many. Resynchronise your view of the screen. Example: UI-EV-OVERFLOW . \ 14 constant
UI-EV-ERROR ( -- 15 ) Event kind: the server refused an op (unknown window, full table, a malformed batch...). id = 0; arg = op code + 256 * its offset in the batch. UI-SYNC counts these. Example: UI-EV-ERROR . \ 15 constant
UI-EV-WIN ( -- 16 ) Event kind: something happened to window id. arg 255 AND is what: 1 moved/resized by the keyboard, 2 close request (Ctrl+W, Alt+F3, Esc in a dialog), 3 zoomed, 4 restored. The server never closes a window by itself: close it with UI-CLOSE if you agree. Example: UI-EV-WIN . \ 16 constant
UI-EV-COMMAND ( -- 17 ) Event kind: a command was chosen. id = the focused window, arg = the command id; the third argument byte (UI-EVENT) is the source: 1 menu, 2 accelerator, 3 palette. Example: UI-EV-COMMAND . \ 17 constant
UI-EV-ANIMDONE ( -- 18 ) Event kind: a tween ended. id = window or sprite, arg = target + 256 * property. Example: UI-EV-ANIMDONE . \ 18 constant
UI-CURSOR ( -- 15 ) The sprite id of the pointer (the topmost sprite). Example: UI-CURSOR . \ 15 constant
UI-TWEEN-WINDOW ( -- 0 ) Tween target: a window. Example: UI-TWEEN-WINDOW . \ 0 constant
UI-TWEEN-SPRITE ( -- 1 ) Tween target: a sprite (properties UI-X and UI-Y only). Example: UI-TWEEN-SPRITE . \ 1 constant
UI-X ( -- 0 ) Tween property: x position in pixels. Example: UI-X . \ 0 constant
UI-Y ( -- 1 ) Tween property: y position in pixels. Example: UI-Y . \ 1 constant
UI-SCROLL-ROW ( -- 2 ) Tween property of a window: the first surface row shown (0..255). Example: UI-SCROLL-ROW . \ 2 constant
UI-SCROLL-COL ( -- 3 ) Tween property of a window: the first surface column shown (0..255). Example: UI-SCROLL-COL . \ 3 constant
UI-LINEAR ( -- 0 ) Easing: constant speed. Example: UI-LINEAR . \ 0 constant
UI-IN-OUT ( -- 1 ) Easing: slow start and slow end. Example: UI-IN-OUT . \ 1 constant
UI-OUT ( -- 2 ) Easing: fast start, slow end. Example: UI-OUT . \ 2 constant
UI-SPRING ( -- 3 ) Easing: overshoots the end and settles back. Example: UI-SPRING . \ 3 constant
UI-BOX ( -- 1 ) Widget kind: an invisible container that lays out its children (UI-LAYOUT). With UI-WF-FILL and no parent it covers the window's client area and follows its size. Example: UI-BOX . \ 1 constant
UI-LABEL ( -- 2 ) Widget kind: one line of text; not focusable. Example: UI-LABEL . \ 2 constant
UI-BUTTON ( -- 3 ) Widget kind: a push button, drawn as [ text ] centred; Space, Enter or a click sends ACTIVATE. Example: UI-BUTTON . \ 3 constant
UI-CHECK ( -- 4 ) Widget kind: a check box [x]; Space or a click toggles it and sends CHANGE with the new value. Example: UI-CHECK . \ 4 constant
UI-RADIO ( -- 5 ) Widget kind: a radio button (*); radios with the same parent form a group. Space, a click, or Up/Down within the group selects and sends CHANGE. Example: UI-RADIO . \ 5 constant
UI-INPUT ( -- 6 ) Widget kind: a one-line input field of up to 47 characters, edited on the ESP (Left, Right, Home, End, Backspace, Delete); every edit sends CHANGE, Enter sends ACTIVATE. Read it with UI-WGET. Example: UI-INPUT . \ 6 constant
UI-LIST ( -- 7 ) Widget kind: a scrolling list (a table with UI-COLUMNS). Up, Down, PgUp, PgDn, Home, End and a letter (type-ahead) move the selection and send SELECT; Enter sends ACTIVATE. Example: UI-LIST . \ 7 constant
UI-PROGRESS ( -- 8 ) Widget kind: a progress bar showing its value 0..100 as a bar and a percentage. Example: UI-PROGRESS . \ 8 constant
UI-TEXTVIEW ( -- 9 ) Widget kind: a multi-line text editor (4096 bytes) run on the ESP, with selection, a 1 KB clipboard and the Smalltalk evaluation keys. At most 4 exist at a time, shared with the GUI tools. Example: UI-TEXTVIEW . \ 9 constant
UI-TABS ( -- 10 ) Widget kind: a row of tabs from the widget text split at '|'; the value is the selected tab. Left/Right, or Ctrl+Tab anywhere in the window, change it and send SELECT. Example: UI-TABS . \ 10 constant
UI-HIDDEN ( -- 1 ) Widget flag: not shown and skipped by layout and Tab. Example: UI-HIDDEN . \ 1 constant
UI-DISABLED ( -- 2 ) Widget flag: greyed and not focusable. Example: UI-DISABLED . \ 2 constant
UI-WF-FILL ( -- 4 ) Widget flag for a root box (parent UI-NONE): cover the whole client area and resize with the window. Example: UI-WF-FILL . \ 4 constant
UI-READONLY ( -- 8 ) Widget flag for a TextView: the caret moves and text can be selected and copied, but not edited. Example: UI-READONLY . \ 8 constant
UI-TREE ( -- 16 ) Widget flag for a list: Right and Left send EXPAND events for the selected row instead of doing nothing; type-ahead skips leading spaces, '+' and '-'. Example: UI-TREE . \ 16 constant
UI-PAGER ( -- 32 ) Widget flag for a list: moving past the first or last row sends a PAGE event so the CPU can fill in the next rows (the Inspector's memory view). Example: UI-PAGER . \ 32 constant
UI-COLUMN ( -- 1 ) Layout code for UI-LAYOUT: children stacked top to bottom. Example: UI-COLUMN . \ 1 constant
UI-NONE ( -- 255 ) No parent (a root widget), no surface, or no window: the server's 'none' id. Example: UI-NONE . \ 255 constant

GUI tools

The Browser, Workspace, Inspector and Manager.

Word Stack effect Description Kind
TOOL ( n -- ) Open GUI tool n, or focus it if it is already open: 0 Browser, 1 Workspace, 2 Inspector, 3 Manager; -1 closes every tool window (and the Confirm dialog). Other values fail. The tools need the display server, so on the host build TOOL fails. native, board

Text workbench

The full-screen text workbench and console view.

Word Stack effect Description Kind
WB-PAINT-DEFAULT ( -- ) The native workbench painter: sends at most one batch of changed screen cells to the display. WB-PAINT is deferred to it by default. Example: ' WB-PAINT-DEFAULT IS WB-PAINT native
WB-SAVE-DEFAULT ( -- ) The native save service behind WB-SAVE and F7: saves the exact active draft as its module package on SD. WB-SAVE refuses to run if this name has been redefined. native, board
WB-PAINT ( -- ) Deferred painter the workbench calls at the REPL idle boundary, on a temporary stack with a 4096-instruction budget. If a replacement fails, painting stops and the draft stays; restore it with ' WB-PAINT-DEFAULT IS WB-PAINT and WB-REDRAW. Example: ' WB-PAINT-DEFAULT IS WB-PAINT defer
WB-ACTIVATE ( -- ) WB-ACTIVATE revision Command: activate the draft staged at that revision (F6), if the live catalog has not changed since; prints a WB-STATUS line. Like every WB- command it reads its arguments from the rest of the line and cannot be compiled into a definition. command, board
WB-BROWSE ( -- ) WB-BROWSE MODULES \| WORDS [module] Command: switch the workbench browser to the module list or to the words (of one module), print one WB-ITEM line per entry (names in hex), then a WB-STATUS line. Example: WB-BROWSE MODULES command
WB-CLOSE ( -- ) WB-CLOSE Command: close the workbench (F10), keeping the draft in RAM; returns to the console view if it was opened before. Prints a WB-STATUS line. Example: WB-CLOSE command
WB-COMPOSE ( -- ) WB-COMPOSE Command: compose the workbench screen once and print the time it took in 288 kHz timer ticks (valid below 227 ms), for profiling. Example: WB-COMPOSE command
WB-CONSOLE ( -- ) WB-CONSOLE Command: show the REPL console (closing the workbench if open). Under the GUI the console is the Console window, brought to the front. Prints WB-CONSOLE open 1. Example: WB-CONSOLE command
WB-CONSOLE-CLEAR ( -- ) WB-CONSOLE-CLEAR Command: clear the console view's text on the ESP. Example: WB-CONSOLE-CLEAR command
WB-CONSOLE? ( -- ) WB-CONSOLE? Command: print whether the console view is open and whether it is the home view, e.g. WB-CONSOLE open 1 home 1 renderer esp. Example: WB-CONSOLE? command
WB-EDIT ( -- ) WB-EDIT module discard Command: load the active source of module into the draft (discard 1 is needed to replace a modified draft). The revision goes up by one. command, board
WB-FLUSH ( -- ) WB-FLUSH Command: compose and paint until nothing is pending, then print the time, bytes, spans, batches and cells sent. Example: WB-FLUSH command
WB-FLUSH-FENCED ( -- ) WB-FLUSH-FENCED Command: as WB-FLUSH, then wait for a VDP reply so the ESP has also finished drawing (a completion fence before reading pixels back). Example: WB-FLUSH-FENCED command
WB-KEY ( -- ) WB-KEY code modifiers Command: inject a key into the workbench as if typed: code is ASCII or 256 Up, 257 Down, 258 Left, 259 Right, 260 Home, 261 End, 262 Delete, 263 F5, 264 F6, 265 F7, 266 F8, 267 F10; modifiers 1 Ctrl, 4/8 Alt. command, board
WB-META ( -- ) WB-META revision version test\|- Command: set the draft's version and test word (- for none), keeping its dependencies. Revision-checked. command, board
WB-NEW ( -- ) WB-NEW module version discard Command: start an empty draft for a new module (names up to 31 printable characters). discard 1 replaces a modified draft. Prints a WB-STATUS line with the new revision. command, board
WB-OPEN ( -- ) WB-OPEN Command: open the text workbench (browser, inspector and source editor on an 80x60 screen; under the GUI a full-screen window that owns the keyboard). Needs the VIOS display mode (mode 0, 16 colours). Prints a WB-STATUS line. command, board
WB-PATCH ( -- ) WB-PATCH revision offset remove hex\|- Command: replace remove bytes at offset of the draft with the bytes given in hex (at most 80 bytes; - inserts nothing), only if revision is current. The revision goes up by one. command, board
WB-REDRAW ( -- ) WB-REDRAW Command: full recovery: set the display mode again (outside the GUI), reset the renderer cache and repaint. Use after raw VDU or MODE changes. command, board
WB-RENDER-STATS ( -- ) WB-RENDER-STATS [RESET] Command: print the painter's totals (cells, spans, batches, bytes, ticks, pending); RESET clears them first. Example: WB-RENDER-STATS command
WB-REPAINT ( -- ) WB-REPAINT Command: repaint the workbench screen without a mode change (falls back to WB-REDRAW if the mode is wrong). command, board
WB-SAVE ( -- ) WB-SAVE revision Command: save the exact active draft as its module package on SD (F7). It does not change the boot slots. command, board
WB-SELECT ( -- ) WB-SELECT MODULE name \| WORD index Command: select a module by name or a word by dictionary index in the workbench browser. command, board
WB-SOURCE ( -- ) WB-SOURCE offset count Command: print up to 80 bytes of the draft from offset, in hex, with the revision and total length. command, board
WB-STAGE ( -- ) WB-STAGE revision Command: compile and test the draft at that revision in an isolated transaction (F5), without changing the live system. command, board
WB-STATUS ( -- ) WB-STATUS Command: print the workbench state: revision, catalog, open, draft, dirty, staged, active, saved, length, cursor, focus, word counts, and the module, version, test word and last error in hex. Example: WB-STATUS command
WB-UNDO ( -- ) WB-UNDO revision Command: restore the single undo snapshot taken before the last edit (F8). Fails with "no undo snapshot" when there is none. command, board
WB-VIEW ( -- ) WB-VIEW row count Command: print count rows of the workbench's desired 80-column screen from row, characters and attributes in hex (a headless view). command, board
WB-ZOOM ( -- ) WB-ZOOM 0\|1 Command: 1 widens the source editor to all 80 columns, 0 restores the 54-column pane (Ctrl+Space toggles). Example: WB-ZOOM 0 command
WB-ZOOM? ( -- ) WB-ZOOM? Command: print WB-ZOOM enabled 0 or 1. Example: WB-ZOOM? command

Index of words

All words in ASCII order:

! ' ( (+LOOP) (DOES>) (EVAL-RETURN) (KEYWORD) (MARKER) )CRITICAL * */ + +! +LOOP , - -ROT . ." .HEX2 .S / /MOD 0< 0= 0> 1+ 1- 2* 2DROP 2DUP 2OVER 2SWAP : ; < <> = > >BODY >R ? ?DO ?DUP @ ABORT ABS AGAIN ALLOT AND BASE BEEP BEGIN BENCH BL BOOT-CONFIRM BOOT-MANIFEST BOOT-REVERT BOOT-STATUS BOOT-TIMES BOOT-TRIAL BOUNDS C! C, C@ CELL+ CELLS CHAR CHAR@ CLOCK-MS CLOSE CLS COLOUR COMPILE, CONSOLE-EMIT CONSOLE-KEY CONSOLE-WRITE CONSTANT COUNT CR CREATE CRITICAL( DECIMAL DEFER DEPTH DEVICE DIR DISPLAY-WRITE DO DOES> DROP DUMP DUP ELSE EMIT ENGINE ERASE EVALUATE EXECUTE EXIT FALSE FILE-READ FILE-REMOVE FILE-WRITE FILL FIND FRAME-WAIT FS-ERROR FS-READ FS-WRITE HANDLE-GET HANDLE-PUT HANDLES HERE HEX I IF IMMEDIATE INCLUDE INVERT IRQ-PROBE IRQ-STATS IS J KEY LAST-ERROR LEAVE LITERAL LOAD LOOP LSHIFT MARKER MAX MILLIS MILLIS2 MIN MOD MODE MODULE-ACTIVATE MODULE-BEGIN MODULE-DATA MODULE-DEP MODULE-DISCARD MODULE-LOAD MODULE-ROLLBACK MODULE-SOURCE MODULE-STAGE MODULES MOVE MS NEGATE NIP OPEN OR OVER PAUSE PIPE PIPELINE PIXEL@ PL-R PL-W PLAY PLOT POSTPONE PREEMPT PREEMPT-STATS R> R@ READ READ-WAIT REBOOT RECURSE REPEAT RESOURCES ROT RSHIFT S" SAVE SD-MOUNT SEE SOUND? SPACE SPACES SPAWN SPAWN-CON STATE STOP SWAP SYNC TASK-INPUT TASK-KILL TASK-OUT TASK-OUTPUT TASK-SLICE TASK-STATE TASKS THEN TICKS TIMER@ TONE TOOL TRACE TRUE TUCK TUNE TYPE U. U< U> UI-ACTIVE UI-ALT UI-ANIMATE UI-ARROW UI-BAR UI-BEGIN UI-BITMAP UI-BITS UI-BOX UI-BUTTON UI-CANVAS UI-CANVAS-AT UI-CANVAS-FLAGS UI-CARET UI-CH UI-CH-BUF UI-CHECK UI-CHECKED UI-CLIENT UI-CLOSE UI-COLUMN UI-COLUMNS UI-COMMAND UI-COMMIT UI-CTRL UI-CURSOR UI-CV-CLEAR UI-CV-VISIBLE UI-DECOR UI-DISABLED UI-DISC UI-DOT UI-ENABLED UI-ERASE UI-EV-ACTIVATE UI-EV-ANIMDONE UI-EV-CANVAS UI-EV-CHANGE UI-EV-COMMAND UI-EV-ERROR UI-EV-EXPAND UI-EV-FOCUS UI-EV-OVERFLOW UI-EV-PAGE UI-EV-POINTER UI-EV-SELECT UI-EV-TEXT UI-EV-WIN UI-EVENT UI-FILL UI-FLAGS UI-FOCUS UI-FREE-X UI-HIDDEN UI-ICON UI-ICON-DISK UI-ICON-DOCUMENT UI-ICON-ERROR UI-ICON-FOLDER UI-ICON-INFO UI-ICON-MODULE UI-ICON-WARNING UI-ICON-WORD UI-IN-OUT UI-INK UI-INPUT UI-INSERT UI-ITEM UI-ITEMS UI-KEYS UI-LABEL UI-LAYOUT UI-LINE UI-LINEAR UI-LIST UI-MENU UI-MODAL UI-NEXT UI-NONE UI-NUDGE UI-OUT UI-OVAL UI-PAGER UI-PEN UI-PIXELS UI-PLACE UI-POINTER UI-POPUP UI-PRINT UI-PROGRESS UI-RADIO UI-RAISE UI-RAW UI-READONLY UI-RECT UI-RESET UI-ROW UI-ROW+ UI-SCROLL UI-SCROLL-COL UI-SCROLL-ROW UI-SELECT UI-SEPARATOR UI-SHADOW UI-SHAPE UI-SHIFT UI-SNAP UI-SNAPSHOT UI-SPRING UI-SPRITE UI-SPRITE-AT UI-SPRITE-SHOW UI-STATE UI-STATUS UI-STIPPLE UI-STOP UI-STYLE UI-SUBMENU UI-SURFACE UI-SYNC UI-TABS UI-TEXT UI-TEXT+ UI-TEXT@ UI-TEXTVIEW UI-TITLE UI-TREE UI-TWEEN-CANVAS UI-TWEEN-SPRITE UI-TWEEN-WINDOW UI-TYPE UI-VIEW UI-VISIBLE UI-WDELETE UI-WF-FILL UI-WFOCUS UI-WGET UI-WIDGET UI-WINDOW UI-WIPE UI-WNAME UI-WSIZE UI-WSTYLE UI-WTEXT UI-WVALUE UI-X UI-Y UNLOOP UNTIL VARIABLE VDP-INFO VDU VOLUME VTYPE WB-ACTIVATE WB-BROWSE WB-CLOSE WB-COMPOSE WB-CONSOLE WB-CONSOLE-CLEAR WB-CONSOLE? WB-EDIT WB-FLUSH WB-FLUSH-FENCED WB-KEY WB-META WB-NEW WB-OPEN WB-PAINT WB-PAINT-DEFAULT WB-PATCH WB-REDRAW WB-RENDER-STATS WB-REPAINT WB-SAVE WB-SAVE-DEFAULT WB-SELECT WB-SOURCE WB-STAGE WB-STATUS WB-UNDO WB-VIEW WB-ZOOM WB-ZOOM? WHILE WITHIN WORDS WRITE WRITE-ALL XOR [ ['] [CHAR] \ ]