This project aims to be as complete as possible an implementation of the Dcpu-16 computer. The aim is to follow the official specification, so if a feature is not officially defined by Notch, it will not be added. There will be two main projects here, an assembler and an emulator (or perhaps simulator is more correct) both of which will be built with both a command line interface and as a graphical application.
One of the things I want to focus on with this Dcpu-16 library is implementing the specification as accurate as possible, a provide something that others can build on. So the likes of a nice GUI application are of little concern compared to emulating Dcpu-16 correctly, for example you will notice (at least you should be able to) that it keeps track of cycle cost. Notch must be planning on have the in game Dcpu-16 implementation run at some limited clock speed, but currently has not specified what that is. At present a clock cycle is pulsed on press of the enter key, which helps to debug through the code. I intend to provide a built in automatic pulse generator, which I guess you could call a clock, that will run at the Hz that (presumably) will be defined at some stage by Notch; but you will also be able to set what speed you want to run the clock at (so you can run code super fast to test complex programs, or super slow to debug it) as well as allow you to provide your own pulse generation code, but enough of that for now.
Right now, I am in very early development, working on both the assembler and the emulator. The Emulator is currently able to run the code, but needs to be properly tested and I need to provide a better interface for it. The assembler is currently in Perl and not supporting labels at all, it WILL be ported to C++.
My priorities right now are to get my work so far all added to this repository, port the assembler (as it currently is) to C++ and add label support to the assembler. I guess I could use some bullet points right about here, but oh well.
I believe that I do now have code correctly running, but I need to give it some proper tests, not sure the best way to validate it though.
This is rather loose term
- Validating the work done so far (i.e., is the 'notch sample' running correctly)
- Execution of all operations
- Convert Perl script to C++
- Add label support for assembler
- Implement a decent testing system
- Update the make file (doing it in a really stupid way right now)
What's the point?
True, Notch is going to develop his own code to simulate the computer in his game, but just like red stone in minecraft, playing with it in game might not be as convenient as you would like. This project will hopefully provide the tools required to develop your Dcpu-16 code out side of the game. Who knows, if my implementation start to look good, I might start to add JNI wrappers to it, which (could) offer a more efficient implementation that can be used with in Java programs.
For the most part, this is simple because I can. It sounds like a fun project to keep me focused on C++ and with a bit of community feed back I should hopefully learn some clever tricks and better ways of doing things.
What is Dcpu-16 and 0x10c?
0x10c is a game developed (well, in development) by Notch, That Minecraft Guy. One of the great features is the inclusion of a fully programmable 16bit computer, Dcpu-16. In theory, you will be able to utilise this computer to control your space ship.