8000 GitHub - msp729/bfvm: the BF VM, heavy WIP
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

msp729/bfvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

the BFVM interprets BFB, a Brainfuck-based binary format.

conceptually, there are two tapes of memory, and six "free" registers.

the big 8

<> move left and right on the current tape.

+- increment and decrement the current tape.

[] do a loop-like thing, the same as Brainfuck.

,. read input and write output, again see Brainfuck.

4 for tape control

$ jumps between tapes.

# moves to tape 0.

& writes the tape index to the r register.

^ reads tape index from r, and jumps to it.

&^ and && are equivalent to &.

32 instructions: registers

r* and R* read from, and write to, a register *. The other operand is always the tape.

there are three "special" registers, and thirteen "regular" ones.

regular: abcdeABCDErxy

i increments on every instruction processed. ri at the start of execution reads 0, as does Riri.

m increments on every > and decrements on every <.

t increments on every $ and is zeroed on every #.

6 binary operations

~ flips all bits of the current tape cell.

| is binary OR. one operand (and the return value) is always the current position on the tape.

0 writes 0.

) is right-shift, ( is left-shift.

25 for arithmetic

ALL ARITHMETIC OPERATIONS WRITE THEIR RESULTS TO THE r REGISTER.

also, most (except %) have an alternate floating-point version by prefixing '.

all binary ones operate on x and y registers.

!+ is addition, !- is subtraction. * is multiplication, / is division % is modulus, = is greater-or-equal abs is absolute value, sgn is signum.

with ', the following unary functions (operating on x) are available:

sin, cos, tan, asin, acos, atan sinh, cosh, tanh, asinh, acosh, atan exp, ln

4FB0

comments

the ; character signifies a one-line comment

About

the BF VM, heavy WIP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0