BrainFuck in X-FORTH
Back to current versionRestore this version

General Information
Author: Carsten Strotmann
Language: FORTH
Compiler/Interpreter: XFORTH
Published: 2003

BrainF\*ck#

BF is a very minimalistic language, with only eight commando's, yet it is (theoretically) powerfull enough to compute anything that can be computed (with a Turing Machine). The language operates on an array of memory cells each containing an initially zero integer value. There is a memory pointer which initially points to the first memory cell.

Resources#

Tom Hunt has another BF implementation for the A8 written in CC65 (see bottom of page).

a new Atari BrainFuck was written by Pawel "Cosi" Piatkowski, Announcement in Polish, download of atr with English manual and program file here.

How to use#

Each of the eigth commands consists of a single ASCII character, with the following meaning:

." .."

: BFI ( addr -- ) IP ! BEGIN IP@ 93 = IF BF] THEN IP@ 91 = IF BF THEN IP@ 62 = IF BF> THEN IP@ 60 = IF BF< THEN IP@ 46 = IF BF. THEN IP@ 44 = IF BF, THEN IP@ 45 = IF BF- THEN IP@ 43 = IF BF+ THEN IP+ IP@ 0 = UNTIL ; ." .." : BF HERE 3000 ERASE HERE BL WORD 1+ BFI ; ." .." HEX : BFR 6000 1000 ERASE 7000 1000 ERASE BEGIN 6000 1000 SOURCE-ID @ READ-FILE 128 < WHILE DROP 7000 6000 BFI REPEAT ; ." .." : BF" FILE" R/O OPEN-FILE 128 < IF SOURCE-ID ! BFR SOURCE-ID @ CLOSE-FILE 0 SOURCE-ID ! ELSE ." Error open file" THEN ; ." loaded!" CR }}}