ST3PH-FORTH // Interactive WASM Platform

Forth Workspace IDE
I/O Display Buffer
ST3PH-FORTH Engine v3.5 Live... Native I/O Channels Up.
Core Syntax & Language Architecture

ST3PH-FORTH is a highly performance-optimized, Turing-complete, stack-based compilation runtime. Execution is performed through structured data pipelines passing parameters directly via the data stack using Postfix Notation (RPN).

Category Word Name Stack Effect Operational Description
Stack Ops dup ( n -- n n ) Duplicate the top element of the data stack.
Stack Ops drop ( n -- ) Discard the top element of the data stack.
Stack Ops swap ( n1 n2 -- n2 n1 ) Swap the top two data stack elements.
Stack Ops over ( n1 n2 -- n1 n2 n1 ) Copy the second element to the top of the stack.
Arithmetic +, -, *, /, mod ( n1 n2 -- result ) Standard mathematical operations executed on 32-bit signed integers.
Comparison <, >, = ( n1 n2 -- flag ) Compare stack numbers. Returns -1 for True, 0 for False.
Memory I/O @ ( addr -- val ) Fetch word. Reads a 32-bit integer directly from the specified memory address.
Memory I/O ! ( val addr -- ) Store word. Saves a 32-bit integer value into the target memory address pointer.
Hardware I/O key? ( -- flag ) Asynchronous channel check. Pushes -1 if any key is pressed down, else 0.
Hardware I/O key ( -- char ) Pops the last registered ASCII/Virtual key code from the buffer and flushes it.
Control if ... else ... then ( flag -- ) Conditional branches. Executes if flag is non-zero (True). else is optional.
Loops do ... loop ( limit init -- ) Definite loop. Iterates from init up to limit.
Loops i, j ( -- index ) i fetches current inner loop iterator. j fetches the outer loop index.
Graphics plot ( x y color -- ) Renders a single pixel directly onto the active canvas pixel buffer grid.
Graphics cls ( -- ) Clears the viewport rendering stack back to solid opaque black.
System exit ( -- ) Immediately forces termination of the currently running word execution branch.
Prebuilt Interactive Game Modules

Load any script directly into the editor workspace, hit Run Engine, and click inside the canvas viewport area to control the loop via keyboard inputs.

1. Retro Snake Game (Fully Functional Engine)
Controls: Arrow Keys. Memory mapped cyclic vector arrays.

2. Interactive Color Painter Board
Controls: WASD keys to move the drawing cursor pixel crosshair across the canvas buffer.