Am Sun, 22 Apr 2012 11:55:35 +0200 schrieb "Bernard Helyer" <[email protected]>:
> https://github.com/bhelyer/DDCPU-16 > > DDCPU-16 is a D implementation of Notch's (of Minecraft fame) > DCPU-16, a fictional 16 bit CPU for his upcoming game, 0x10c. > More info at http://0x10c.com, including specs. > > You'll see a grand total of two source files, and one is only > really there for my testing. The only interesting module is > dcpu16.cpu, which contains a class CPU with two public methods of > note: load(ushort[]) to load code and run(int) to run it for a > minimum number of cycles. > > The CPU code is completely freestanding, with no dependencies > (even on Phobos) and is @safe ready, and pure where possible. > > Manu is planning on hooking up some virtual hardware to it (which > is described in basic form elsewhere). No real reason for this, > just needed something to fill a Sunday. > > I've only tested it to the extent that I've stepped through > Notch's > example in the spec (the one loaded in main.d) and verified that > works, but I'm sure there'll be more bugs lurking. If you find > the bugs that I'm sure are still lurking, create an issue on > GitHub. > > > -Bernard. Haha, just today I watched a video about it and thought "D"CPU .. well if that isn't a call for action ;) Unfortunately Java has a native unsigned 16-bit data type (char). Otherwise Notch would probably have chosen D for writing 0x10^c. ;) As with Minecraft, I like the vision and technical realisation, but I wouldn't pay for and play them. I'm sure you had fun writing the CPU simulator. We wrote one (as a class project) at a vocational school a while back - in Java. It was for an 8086 and I did the CPU core logic. Most functions could be classified (like logical OR/XOR/..., accesses regs,mem,...) but for the rest I didn't find any pattern and called the corresponding class (translated) "ThenAMiracleHappens", referring to the well known comic: http://blog.wisefaq.com/wp-content/uploads/2008/05/amoh-small.jpg It was spiced with a two lines long ternary operator :? expression and no further comments. :D -- Marco
