Manual

14f is a forth-like language inspired by uxn. It's interpreted and runs in the browser. Its main goal is to be simple to understand and fun to use.

overview

At the heart of 14f there is a stack. We can push numbers to the stack. Let's push number 1 and number 2:

#1 #2

The interpreter reads the previous line from left to right. It first pushes #1 to the stack, then #2. Once the line has been interpreted, the stack looks like that:

1 2

We can operate on the stack by using words. To add the top 2 elements from the stack, we can use "+".

+

The stack now contains only "3", since 1 and 2 have been added. This is how 14f works. Numbers are pushed on the stack, and words operate on these numbers to produce interesting results.

parts of the language

numbers

All numbers are expressed in hexadecimal. To push a number on the stack, prefix it with #. For example, to push the number 15 on the stack, type: #f.

words

Words operate on the stack. All the basic words are defined in the glossary, and can be combined by creating entries in the dictionary. To create an entry, use the ":" word:

: foo #1 #2 + ;

The previous like creates a "foo" entry in the dictionary. We can now use foo by just typing it.

special forms

Special syntax that aren't words nor numbers.

if else then

Use "if" to create a branch based on a condition. The following line will push #1 to the stack if ?ready is equal to 1, otherwise it will push #2.

?ready if #1 else #2 then

' (address of)

Push to the stack the address of the following word.

' foo

until

Loop until the top of the stack is 0.

' eat until
memory map
glossary
word stack definiton
+ n1 n2 -- n1+n2 Add the top 2 elements from the stack
- n1 n2 -- n1-n2 Substract the top 2 elements from the stack
* n1 n2 -- n1*n2 Multiply the top 2 elements from the stack
/ n1 n2 -- n1/n2 Divide the top 2 elements from the stack
% n1 n2 -- n1%n2 Modulo of the top 2 elements from the stack
drop n -- Drop the top of the stack
= n1 n2 -- f Push #1 if n1 and n2 are equal, #0 otherwise
> n1 n2 -- f Push #1 if n1 > n2, #0 otherwise
< n1 n2 -- f Push #1 if n1 < n2, #0 otherwise
and f1 f2 -- f Push #1 if f1 and f2 are true, #0 otherwise
, n -- Record n to the memory
@ adr -- n Push value from adr to the stack
! n adr -- Record n at adr
d@ adr -- n Push value from system adr to the stack
d! n adr -- Record n at system adr
dup n -- n n Duplicate the top of the stack
swap n1 n2 -- n2 n1 Swap the top of the stack
rot n1 n2 n3 -- n2 n3 n1 Rotate the top of the stack
rect w h c -- Draw w*h rect of color c
clear -- Clear screen
sprite adr -- Draw 2bpp sprite at adr
rand min max -- n Push random n in [min max]