? VC3 complete software collection ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password

VC3 complete software collection

Submitted
Updated
Author
bluekrill
Public Key
4KH314RD
Min. Compat.
All
Version
1.0
Rating
3 votes
Description VC3 is a virtual machine like Chip-8 and the successor to VC2, an earlier project of mine. VC3's improvements over VC2 include:
  1. More versatile instructions. Now, any register can be a source or a destination.
  2. Debugging features. Add breakpoints and record logs!
  3. Saving/loading data and text.
  4. 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/Ek9ByA9
Instructions To 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.

CLIP

Displays the contents of the clipboard.

HELLO

Obligatory "Hello, world!" program, demonstrating use of relocation and the upper display pointer.

LIFE

It's Conway's game of life. Press A to place cells and B to remove them and Y to start the simulation.

PRIME

Outputs all primes that can fit in 16-bits, then halts. Demonstrates the _NUM and _TERMINAL2 subroutines.

SCROLL

A simple demo that allows the user to scroll up and down through memory.

SORT

A bubble sort algorithm with an output. Sorts the contents of the clipboard and writes it to the output string.

TRIPLE

A demo showing off three subroutines: _KEYBOARD, _NUM and _TERMINAL2. Displays the character typed and the unicode character code for it.

TWIN

A demo showing off just _TERMINAL2 and _KEYBOARD. Writes keyboard input to output and allows deletion and newlines.

_KEYBOARD

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.

_NUM

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.

RPN

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.

VC1 interpreter

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.

Compatibility problems

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

  1. Copy a compiled VC1 program into the clipboard.
  2. Paste it into the editor and add a newline and exclamation point onto the end.
  3. After this, anything in the clipboard is clipboard input for the VC1 program.
  4. Run the VC1 interpreter the same way you would run any VC3 program.
Not formatting the input correctly will result in an infinite loop.

Example

This VC1 program will be run, and it will see the clipboard as containing only the word "TEST". *#20 #1 #0 #23 #24 !TEST

BEFUNGE

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.

TEXTEDIT

Unfinished text editor

Library code

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.
Notes Please contribute ideas for VC4 here: http://smilebasicsource.com/forum?ftid=1953
Categories
Keywords
  • computer
  • virtual
  • cpu
  • emulation
  • interpreter
5 Comment(s) kilijelo kilijelo Very impressive; however, I can't seem to get it to work. I've tried many programs, and each of them display texual garbage and then the emulator ends with Illegal function call in 2:2(SAVE). Looking in that slot, it seems that the code there attempts to save the clipboard contents to an unnamed file. DT$=CLIPBOARD() SAVE "TXT:",DT$ HTV04 HTV04 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Avatar Taboo I didn't change my avatar for 180 days Website Second Year My account is over 2 years old Website From that line of code, it looks like it's trying to save a file named whatever's in your clipboard. Trying copying something like "TEST" and then running the program. kilijelo kilijelo When save is used with that syntax it is used to save a string to a file. This code was generated by the main code. My hunch is that there's an empty string variable somewhere that is meant to have a string. HTV04 HTV04 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Avatar Taboo I didn't change my avatar for 180 days Website Second Year My account is over 2 years old Website Oh, I see. I mistook the comma for a plus. I'll contact bluekrill about the issue. bluekrill bluekrill Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Video Games I like to play video games! Hobbies What do you mean by "I've tried many programs"?