DescriptionVC3 is a virtual machine like Chip-8 and the successor to VC2, an earlier project of mine.
VC3's improvements over VC2 include:
More versatile instructions. Now, any register can be a source or a destination.
Debugging features. Add breakpoints and record logs!
Saving/loading data and text.
Stability. The program no longer crashes on incorrect register arguments and always ensures memory accesses are in the correct range.
Included with the virtual machine itself are a few demonstration programs and a few subroutines. Subroutine names begin with an underscore and are intended to be copied into other programs.
Join the virtual computers discord server: https://discord.gg/Ek9ByA9InstructionsTo load a VC3 program, start the program called --VC3 and select "load from file" and type the name of the program you wish to run.
Complete documentation here: https://drive.google.com/file/d/1XiwDwLBWW2CDCWXqRb11ydeacaqX1FPG/view
BYTEBF and TBF
These are two versions of the same brainfuck interpreter. A program separated from its input by ! is loaded from the clipboard. BYTEBF has 8-bit cells and TBF has 16-bit cells. The upper screen displays output using the _TERMINAL2 subroutine and the lower screen shows the data tape. Press B to refresh the screen once per brainfuck instruction and A to refresh once per brainfuck output.
Displays the contents of the clipboard.
Obligatory "Hello, world!" program, demonstrating use of relocation and the upper display pointer.
It's Conway's game of life. Press A to place cells and B to remove them and Y to start the simulation.
Outputs all primes that can fit in 16-bits, then halts. Demonstrates the _NUM and _TERMINAL2 subroutines.
A simple demo that allows the user to scroll up and down through memory.
A bubble sort algorithm with an output. Sorts the contents of the clipboard and writes it to the output string.
A demo showing off three subroutines: _KEYBOARD, _NUM and _TERMINAL2. Displays the character typed and the unicode character code for it.
A demo showing off just _TERMINAL2 and _KEYBOARD. Writes keyboard input to output and allows deletion and newlines.
A keyboard routine. Call it and it will return the pressed key in register 0. Fun fact: the keyboard is its own lookup table. Try stepping through it with debug mode on to see how this works.
Requires _TERMINAL or _TERMINAL2. Outputs a number in decimal with leading zeroes.
_TERMINAL and _TERMINAL2
These both output a character in a manner similar to a dumbterminal display from the 1960's or 1970's. TERMINAL2 contains speed improvements in the scrolling routine.
Input a number (and no other characters) then press the down arrow to put a number on the stack.
Input an operation and press the down arrow to perform that operation.
Input C and press the down arrow to clear the stack.
This is an implementation of Bluekrill's virtual computer or VC1 (http://smilebasicsource.com/page?pid=1159) made for virtual computer 3, meaning that VC1 programs now run on multiple platforms! heh.
This program is both a loader writing compiled VC1 programs into memory and an interpreter running VC1 code. During the loading sequence, the screen refreshes once per word loaded.
Alternative version (YK38XDQM)
There are two versions of this interpreter. VC1CM (The displayed download code) starts the VC1 interpreter at &HF000 and starts the simulated stack pointer at &HFFFF. This is compatible with all of my VC1 programs, but if the stack gets too full, it may start to overwrite the interpreter.
VC1IRW (YK38XDQM) puts the interpreter further to the top of memory and starts the stack pointer before itself, not after. This allows for the stack's length to be much longer but breaks compatibility with my bubble sort VC1 program.
VC1 and VC3 have exactly the same amount of RAM, so not all VC1 programs can be run. Programs which write data or code in the area used by the interpreter may crash the interpreter. This problem is inevitable and not fixable. Fortunately, none of my VC1 programs write data in this area, but if yours do, you will need to rewrite your programs to run with this interpreter.
VC1's display size is 32x16 characters. VC3's display size is 32x24 characters. This means that the lower third of the screen is displaying areas of RAM not displayed in the real VC1 and that LIFE's touch input is offset.
How to use this program
Copy a compiled VC1 program into the clipboard.
Paste it into the editor and add a newline and exclamation point onto the end.
After this, anything in the clipboard is clipboard input for the VC1 program.
Run the VC1 interpreter the same way you would run any VC3 program.
Not formatting the input correctly will result in an infinite loop.
This VC1 program will be run, and it will see the clipboard as containing only the word "TEST".
Run, load and save Befunge programs in VC3!
This is possibly the first non-trivial program I've made for VC3 and not smileBASIC first. Also, it was just sort of hacked together without any sort of planning and it shows. The source code is very, very messy!
The program intelligently places newlines between input and output, and writes befunge output to the output string. It's limited to a 32x24 grid
In order to load a befunge program, type its name. In order to create a new befunge program, type its name. Befunge programs are saved and loaded as VC3 data files. Programs are automatically saved before the interpreter starts.
The editor allows you to place characters anywhere on the grid. Touch the screen and choose a character. The key labeled "N" is a null character and the key labeled "L" is the last character at that location before it was selected. Never lose your work!
Most of how the program works is explained within the program itself.
Unfinished text editor
Files with the prefix _OS were intended for the operating system that I was going to write. Open these files for instructions on how to incorporate them into programs.NotesPlease contribute ideas for VC4 here: http://smilebasicsource.com/forum?ftid=1953