Last year I was pondering, and pondering hard about a fun, interesting, and most importantly, useful use-case for the 6502 instruction set. Then it hit me, why not create a modern Virtual Machine environment which uses the 6502 as the base instruction set, but it's goal is more similar to say a Java Virtual Machine where it's purpose isn't to emulate or run binaries from older computer hardware, but to sandbox and virtualize modern computer software in a write-one, run-anywhere runtime environment. Welcome to my latest project, ArcVM!
Now before you jump in and say that the 6502 lacks many functions modern computer software require, and how slow a 6502 CPU is, hear me out for a moment. Sure the 6502 doesn't natively support floating point math, is limited to only addressing 64kb of memory, can't multitask easily, run threads, or run the latest AI packages. However, this is when you take a pure 6502 machine from the 80s and 90s, or a true hardware version of the chipset. Running within a specialized Virtual Machine, in theory the 6502 instruction set can be easily extended with virtual devices to do almost anything in a modern CPU. ArcVM will have support for many virtual devices, these are similar to JNI or Java accessing native library functions on the host OS. These virtual devices will have a standard interface, and will allow third parties to further extend ArcVM to support various GUI toolkits, SDL, sockets, among other things. Since these virtual devices are basically plug and play, you could create a program targeting ArcVM, and use it's framebuffer library. Then to have this same binary run on a completely different graphics technology such as SDL, DirectFB, DirectX, or even an LCD screen dangling from a Raspberry Pi, you can just swap out the virtual display device with another, and your program will use that to output your graphics.
The idea behind ArcVM is total abstraction, all commands which write out to a graphical display are the same, but the output driver which ArcVM can use to display said graphics can be easily and effortless swapped. This allows for programs to be easily ported anywhere, as long as a virtual device for what your program needs is written for that target. API calls within your code can easily determine form factor, resolution, color depth, etc... and your code can use these to adapt or not. Another example to consider is a console device which can be swapped with a logger or a Splunk device. This easily enables one to see console output during development and debugging, but then easily and effortlessly swap the virtual device to have everything that was going to standard out, now going to a splunk server. Other than swapping out a virtual device from ArcVM, none of the actual code needs to be changed.
Currently, I am writing the concept/prototype in the Python language to allow for easily testing on various platforms without needing to compile. The ArcVM end-user development is done in the C language with the cc65 toolkit. The 6502 device API basically talks __fastcall__, so there is very little overhead when calling device functions, a pointer is sent directly to the native code of where the data to be used is. Then properly does a RTS in the native code to return back to the 6502 machine code. I have begun work on arclib, which is a custom C library for cc65, use code just needs to link against this library as they would with any existing library in cc65.
Other possible uses of ArcVM is to emulate other hardware such as the C64, or emulate a 6502 OS.
Once the prototyping is done, and everything is running as I'd like it. I will be porting ArcVM to Delphi(FreePascal to be exact), which can then target every popular operating system to generate a native binary. The ultimate goal is to create a singular abstracted virtual environment, which is procedurally programmed, and can run the same binary on all devices, PC, Android, and eventually in the web.
I have open sourced ArcVM to encourage healthy development, and allow it to grow. You can find the repo here:
https://bitbucket.org/kveroneau/arcvmLet me know what you guys think of this idea, and if it might cause issues with the current owners of the 6502 specification.