Brainf*ck Interpreter for ZX81

Discussion about ZX80 / ZX81 Software
Post Reply
User avatar
Math123
Posts: 44
Joined: Sun May 11, 2008 11:14 pm
Location: Germany Wuppertal
Contact:

Brainf*ck Interpreter for ZX81

Post by Math123 »

Inspired by a request on the German ZX81 forum http://forum.tlienhard.com/phpBB3/viewforum.php?f=2 I made an interpreter for the BRAINF*CK programming language. The p-file is http://www.swatosch.de/zx81/brainfuck.p

Its completely written in Assembler. It uses 16 bit cells. All program input is in REM lines.
The commands are:
+ - > < . , ( )

A good summary to this language is in wikipedia http://en.wikipedia.org/wiki/Brainfuck.
And a just impressive video on how to use this language is this http://www.youtube.com/watch?v=OnQobTyqEd0.

So don't be scared by the dirty name...
Its a somehow fascinating language.
Matthias
User avatar
Math123
Posts: 44
Joined: Sun May 11, 2008 11:14 pm
Location: Germany Wuppertal
Contact:

Re: Brainf*ck Interpreter for ZX81

Post by Math123 »

And additionally to the 8 command you can us the "?" to make a Cell-Dump of the first 22 cells.
So this code with a "?" in the first loop:

Code: Select all

  10 REM
  20 REM +++++++++
  30 REM (->+++++++++?<)
  40 REM >+++++++++.--.<
  50 REM +++++(->-----<)
  60 REM >-------.-------.<
  70 REM
will lead to this dump after some keystrokes. (The interpreter stops after a dump and awaits a key to go on. This is very handy to watch the cells change in value and the pointer stepping up and down.)

Image
Post Reply