www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Jumping on the bandwagon - DDCPU-16

reply "Bernard Helyer" <b.helyer gmail.com> writes:
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.
Apr 22 2012
next sibling parent reply Marco Leise <Marco.Leise gmx.de> writes:
Am Sun, 22 Apr 2012 11:55:35 +0200
schrieb "Bernard Helyer" <b.helyer gmail.com>:

 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
Apr 22 2012
parent reply =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= <xtzgzorex gmail.com> writes:
On 22-04-2012 20:12, Marco Leise wrote:
 Am Sun, 22 Apr 2012 11:55:35 +0200
 schrieb "Bernard Helyer"<b.helyer gmail.com>:

 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
Apr 22 2012
parent reply "Paulo Pinto" <pjmlp progtools.org> writes:
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"<b.helyer gmail.com>:

 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.
Apr 22 2012
next sibling parent "SomeDude" <lovelydear mailmetrash.com> writes:
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.
Apr 28 2012
prev sibling parent "akaz" <nemo utopia.com> writes:
 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.
May 05 2012
prev sibling next sibling parent Luis Panadero =?UTF-8?B?R3VhcmRlw7Fv?= <luis.panadero gmail.com> writes:
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
Apr 24 2012
prev sibling parent "Bernard Helyer" <b.helyer gmail.com> writes:
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.
Apr 28 2012