ASM brainfuck Interpreter
About
This is a fairly basic brainfuck interpreter written in 64-bit ASM (GAS syntax). It’s designed to be simple, and was written primarily as a way of becoming more familiar with ASM — it’s therefore quite well documented. Currently it hard-limits tape position (30,000 slots) and rolls values 0-256 around in both directions.
It’s mostly missing regular calling conventions and code structure, which is sacrificed to run the interpreter in two or three otherwise spare registers. I like to think this keeps it quick, but the difference is probably negligible.
Download
Download BFASM.tar.gz.
Use
Compilation should be as simple as running make, if you have GNU AS installed.
To use the thing, just point it at a brainfuck source file:
$ ./bfi
USAGE:
bfi [EOF] FILE
EOF can be:
z : Set EOF == 0.
n : Set EOF == -1.
Default behaviour is to set EOF == 0. The code doesn’t support unchanged tape on EOF yet, since it requires a slower buffering mechanism.