Skip to the content.

term.fs (lib)

The term.fs library helps you emulate a terminal on the screen.


Use init-term to initialise this library. In order to be able to write anything to the screen, you need to install a font as a tileset first. You can use ibm-font.fs for this.

require ibm-font.fs
require term.fs

: main
  init-term ;

Word Index

. ( n – )

Prints the number to the screen and moves the cursor position.

.r ( n1 n2 – )

Prints the number n1 to the screen, using at least n2 positions.


Reads the string up to the first " character, and prints the string to the screen.

? ( c-addr – )

Prints the value at c-addr to the screen.

at-xy ( u1 u2 – )

Moves the cursor to column u1 and row u2.

cr ( – )

Prints a newline (moves the cursor down).

emit ( c – )

Prints the character with the given character code.

page ( – )

Clears the entire screen.

space ( – )

Prints a single space to the screen.

spaces ( u – )

Prints u spaces to the screen.

type ( c-addr u – )

Prints the string starting from c-addr with length u to the screen.

typewhite ( c-addr u – )

Prints u spaces to the screen.