DAVE'S LIFE ON HOLD

Small Programs

So I've been doing my damnedest to avoid the whole MEGA SOFTWARE PROBLEM and have been working on a few projects in a sort of back to basics fashion. My recent projects include:


What is incredible about all of this is not what you can do with these systems, but with how incredibly independent of the underlying operating system they could be. The amount of change required to run the NewScript VM on bare hardware consists of using a boot loader, writing to video memory rather than my faked up one, and handling a keyboard interrupt. The compiler itself is easy to rewrite in NewScript, and will be the project for next week. I'm estimating the native Intel compiler for the NewScript VM at 96 lines of NewScript. 32 lines for the opcodes, and 64 lines to do everything else. I'll be happy as long as it weighs in under 200 lines though, which is pretty slick for an native optimizing compiler.

Some preliminary tests on some of the code generation tricks and VM layout puts the performance of the generated code at that of GCC -O2 optimizations, with all of the functions inlined. That happens to be exactly what the current C code base compiles with, but not for debugging because GDB goes into convulsions, (and because -O3 optimizations occasionally break things). Compared to its own C version, the native version will be at least 20-30% faster, as the code will be direct rather than indirect threaded.

Once the new VM is compiling itself, I'll then go back and port the Javascript environment (all 500 lines of it) to NewScript to serve as the basis for a standard library. That will make the tool set pretty much complete. My guess is a fully functional VM + Compiler + Graphics + Sound + IDE + Networking will be around ~600 lines of NewScript code. A full fledged user app, say a small education game, could be built in under 1000 lines of code. The old NewScriptVM code base was 594 statements in 964 lines of C, and had the VM + Complier + Sound + 3D Graphics + Network all in C. So this doesn't even sound unreasonable.