General Information
Author: Carsten Strotmann
Language: FORTH
Compiler/Interpreter: XFORTH
Published: 2003
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.
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.
All commands are executed sequentially, except when specified differently. Other characters are skipped, thus considered as comments. The execution terminates when the end of the program is reached.
This interpreter is written in XFORTH
From MyDOS, start BF.COM, then BF" D:filename.BF"
Have fun!
( Brainf*ck in FORTH ) ( 2003, Carsten Strotmann ) CR ." BrainF*ck " 0 VARIABLE IP : IP+ IP @ 1+ IP ! ; : IP- IP @ 1 - IP ! ; : IP@ IP @ C@ ; : 2DUP DUP DUP ; : BF+ 2DUP C@ 1+ SWAP C! ; : BF- 2DUP C@ 1 - SWAP C! ; : BF> 1+ ; : BF< 1 - ; : BF. DUP C@ EMIT ; : BF, DUP KEY SWAP C! ; : BF[ DUP C@ 0= IF BEGIN IP+ IP@ 93 = UNTIL THEN ; : BF] BEGIN IP- IP@ 91 = UNTIL ; ." .." : 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