Jumping on the bandwagon - DDCPU-16
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.
Re: Jumping on the bandwagon - DDCPU-16
Am Sun, 22 Apr 2012 11:55:35 +0200 schrieb "Bernard Helyer" : > 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
Re: Jumping on the bandwagon - DDCPU-16
On 22-04-2012 20:12, Marco Leise wrote: Am Sun, 22 Apr 2012 11:55:35 +0200 schrieb "Bernard Helyer": 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 I think the fact that you have to use 'char' as 'ushort' in Java says enough about the language and VM. ;) /me runs -- - Alex
Re: Jumping on the bandwagon - DDCPU-16
On Sunday, 22 April 2012 at 18:36:06 UTC, Alex Rønne Petersen wrote: On 22-04-2012 20:12, Marco Leise wrote: Am Sun, 22 Apr 2012 11:55:35 +0200 schrieb "Bernard Helyer": 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 I think the fact that you have to use 'char' as 'ushort' in Java says enough about the language and VM. ;) /me runs My latest issue with Java is the trend to add annotations instead of keywords, like @Override, or the new type annotations like @NotNull and so on. Its slowly going to annotation hell.
Re: Jumping on the bandwagon - DDCPU-16
I'm afraid that you not are the first that did a DCPU-16 emulator in D : https://github.com/Zardoz89/DEDCPU-16 Just now, I can't update because I have now the final examinations. I had scheduled a comple rewrite to get a better cycle count and timming acurracy and adding a real I/O support. Plus, Notch just release now, a update specs (on reddit) that broken anything using the olds specs and add HardWare & SoftWare Interrupts. If you have interest of going serius with DCPU-16, we can talk of joining our efforts. Bernard Helyer wrote: > 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. -- I'm afraid that I have a blog: http://zardoz.es
Re: Jumping on the bandwagon - DDCPU-16
On Sunday, 22 April 2012 at 20:13:01 UTC, Paulo Pinto wrote: My latest issue with Java is the trend to add annotations instead of keywords, like @Override, or the new type annotations like @NotNull and so on. Its slowly going to annotation hell. Yeah, I can see that too.
Re: Jumping on the bandwagon - DDCPU-16
Now with GUI, and the CPU is up to date with the latest spec (1.7 as of writing), and all the standard hardware (and a floppy device!) implemented. You'll need SIEGE compiled -- if you want some help there, I can supply those .lib files for windows. Linux too, but that shouldn't be difficult at all.
Re: Jumping on the bandwagon - DDCPU-16
My latest issue with Java is the trend to add annotations instead of keywords, like @Override, or the new type annotations like @NotNull and so on. Its slowly going to annotation hell. It was never clear for me why use annotations instead of proper keywords. Yes, annotations are supposed to be a kind of meta-language but, then, why to make those part of a language? If they are intended to be part of the language, they should be proper keywords, no more, no less.