DEV Community

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

Collapse
 
thomasthespacefox profile image
Thomas Leathers • Edited

Here are some of the main ones:

Research:

SBTCVM has its own architecture for a reason. one of the key challenges has been translating elements from more modern computers to balanced ternary. You see, the last actual hardware example was built in the late 50s in Russia. So we don't have a massive amount of examples to build on.

Building the whole programming workflow

SBTCVM, having its own architecture, and not even being binary in the first place, can't use any common tools or compilers. So not only is the VM running on a custom math library, everything from SBTCVM assembly to SSTNPL to the romdump utility has been built from scratch.

having to design encodings and devices from scratch.

SBTCVM has involved inventing things from the start. the simplest of these creations is the 2 text encodings it has used: SBTCVM-BTT-6 and SBTCVM-BTT2 (current).

While SBTGA, sbtcvm's graphics system, is yet to be implemented in the new codebase, it can't use standard resolutions or color modes for obvious reasons.

Codebase & implementation

Along with the design challenges, actually implementing the architecture is quite a task. the latest codebase runs the CPU at 6.5Khz. that doesn't sound like much, but for python, it is.

The new codebase uses plenty of python classes in a modular architecture design that keeps the primary components separated (and has allowed us to plan multiple frontends i.e. curses, pygame, tk).

the assembler and SSTNPL's compiler are also class-based, but divide the instruction-specific parsing into class instances in a large list. This has allowed a variety of powerful features, and has somewhat simplified their upkeep.

programming the VM

Another challenge has been writing programs to make the VM more useful, and acting as examples for proper programs. The latest codebase doesn't have much outside the usual barrage of test programs, but the previous codebase did manage to run an RPN calculator.