DEV Community

Discussion on: I'm the lead developer of SBTCVM, a FOSS balanced ternary VM project, Ask Me Anything!

 
thomasthespacefox profile image
Thomas Leathers • Edited

Basically SBTCVM simulates a ternary computer. It has 19683 words of memory, (all ram) and at the moment programs are primarily loaded as memory images called troms (or ternary roms), but disk-based programs are in future plans. (we just haven't written the disk system yet. :p)

As far as what SBTCVM is actually useful for, learning and experimenting with balanced ternary is what lead to the first prototype in the first place, and remains an important part of the project.

what balanced ternary is

while regular ternary has 0, 1, & 2, balanced ternary has +1, 0, & -1

counting

That negative digit can be quite confusing to beginners. For example:
lets count to 4 in Balanced ternary (p/+=+1 n/-=-1)

center: standard SBTCVM notation, right: alphanumeric notation which is less confusing in written math.

1 0+ 0p
2 +- pnHuh? where's zero?
3 +0 p0
4 ++ pp
Obvious in hindsight: the negative trit (trit: same idea as a bit) comes before zero.

converting to decimal

the second trit (left) is worth 31 (3)
the first is 30 (1)

so taking 2 as an example:

pn = +3-1 = 2

As as result of the negative digit, balanced ternary is never unsigned. So things like addresses start at the Max Negative Integer (or MNI for short.), and zero tends to fall in the middle of things.

github of latest version:
github.com/SBTCVM/SBTCVM-Gen2-9
the blog has some guides and such as well:
sbtcvm.blogspot.com/