Sunday, May 21, 2017

SBTCVM: now with a custom command shell

SBTCVM Command Shell


To run it, just start MK2-CS.py in a terminal.
When it first starts. it waits for libraries to load, prints its version string, then says its ready, prompting the user with a ":".

it has various uses. From working with SBTCVM utilities, to translating a balanced ternary integer to decimal.

naturally, the first thing a new SBTCVM user would be wise to do is type "help". doing this will spit out a few lists of commands like this:

:help
Commands:
run [arguments] : SBTCVM command line launcher. use "run help" for help.
asm [arguments] : SBTCVM assembler. "asm help" for help.
gfx [arguments] : SBTCVM graphics toolkit. use "asm help" for help.
list [type]     : use "list help" for help on the list command.
help            : this text
version         : version info
about           : about info
quit            : quit SBTCVM command shell

math commands:
add    : add two balanced ternary integers (separated by a space)
sub    : subtract two balanced ternary integers (separated by a space)
div    : divide two balanced ternary integers (separated by a space)
mul    : multiply two balanced ternary integers (separated by a space)
btdec  : convert a balanced ternary integer to decimal
decbt  : convert a decimal integer to balanced ternary
invert : invert a balanced ternary integer
mpi    : calculate the Max Positive Integer for a given number of trits
mcv    : calculate the Max Combinations Value for a given number of trits



Interesting eh? those math commands mainly expose the underlying libbaltcalc integer mathematics API as various commands. also some more specialized functions are available. such as the MPI and MCV commands:

:mpi 9
9841

:mcv 9
19683










you might also have noticed the run, asm, and gfx commands. these call MK2-RUN.py, SBTCVM-asm2.py, and MK2-GFX.py respectively. You can use the same exact arguments that those utilities use:
asm -t thisisanexample
would assemble  thisisanexample.tasm and create an apropiate tracelog just like:
./SBTCVM-asm2.py -t thisisanexample

also there is the list command. it can help when trying to see what files of a specific type are available. for example:

:list streg
VMSYSTEM/ROMS/fib.streg
VMSYSTEM/ROMS/gtt.streg
VMSYSTEM/ROMS/flower.streg
VMSYSTEM/ROMS/dazzle.streg
VMSYSTEM/ROMS/colmap3.streg
VMSYSTEM/ROMS/intro.streg


No comments:

Post a Comment