Live data from Hacker News

Notch's Specification for the In-Game DCPU-16

0x10c.com

41–50 of 177 posts

Re: Notch's Specification for the In-Game DCPU-16

#41
post #18
post #2

Just waiting for the first post about programming this CPU to pop up on Stack Overflow ... :) It's quite an interesting architecture. From an initial perusal, I found these features note-worthy: * Explicit access to PC as a register, makes "computed goto" trivial and very natural. * Because of the above, there is no JMP instruction. * Treating operations on registers as "values" makes the instruction set very orthogo…

> No instructions for bit-manipulation. What? Plenty of opcodes for that. SHL, SHR, AND, BOR, XOR are all bitwise operators. Unless you mean bitset and bitclear macros, but no self respecting embedded programmer uses those. I've disagreed with almost everything else Notch has done, but from a simple pedagogical standpoint, he's doing the right thing by leaving those out.

Yeah, that was I meant, and they certainly don't have to be "macros", they can be full-blown instructions. Considering that even ARM's smaller "Thumb" instruction set has a bunch of them, I doubt that they're never used. Or, of course, they're just used by embedded compilers. :)

Re: Notch's Specification for the In-Game DCPU-16

#42

Context: For those who are puzzled (as I was) as to what this CPU is for , I found this: > Notch's next game, 0x10c, "will allow players to create their own spaceship in the far, far future of an alternate universe ... More exciting - especially for those versed in programming languages - is the ship's computer. It's a fully-functional 16-Bit CPU that controls the entire vessel..." http://www.dealspwn.com/notchs-spac…

It's good to see Notch working on the Little Coder problem, even if that's not his direct intention. :)

Little Coder problem = how to get people interested in coding by writing little programs. Hard to do on consoles and iPhones.

I started thinking that if I was going to get people interested in coding, I'd start with something more approachable - maybe something like a subset of Python, Java, Ruby or even JavaScript (it's where so many people write little programs anyway now). I heard Lua mentioned as a good scripting language too.

Then I wondered - is this CPU a reasonable target for those kinds of little languages? Is this a way to be language independent and have them all? If so, why not something more like the JVM to make it easy?

It seems to me that coding for this CPU is more like a mini-game in the main game; the fact that it's a challenge is part of the game.

Re: Notch's Specification for the In-Game DCPU-16

#44
post #12

Earlier quoted context omitted.

"real" python seems unlikely, given that the standard executable is well over 64KB in size. A variant like cython that compiles to this assembly? maybe...

You don't need the full python repl/compiler/interpreter/libraries, you "just" need the python virtual machine. Once there's a C compiler for the platform that should be relatively straightforward, because I sincerely doubt that takes all 128KiB.

I wonder how hard would it be to get a working DCPU-16 backend for GCC or Clang.

Re: Notch's Specification for the In-Game DCPU-16

#45
I've been tempted to learn Verilog, looks like I might have a fun project to start here, trying to pipeline this. If I were writing the instruction set I'd be tempted to put all the value codes for next word or PC next to each other so it would be easier to figure out at decode state if the PC would be doing anything wonky, but that isn't a huge impediment or anything. The instruction boundary problem with regards to going super scalar looks as bad as it is in x86, but that's straying pretty far from the design goals.

Re: Notch's Specification for the In-Game DCPU-16

#46
post #7

Earlier quoted context omitted.

I'm a self-taught programmer, and don't know much about CPUs. Would someone mind putting this into relatively plain english, I'm quite curious to know the practical implications of this. Can we expect to see Python running on it in the near future for example :) ?

Good question. To run python on this CPU, someone (you?) needs to port Cpython to it. A CPU runs assembly language, and it's not hard for a hacker to port C to a new CPU, because C is small. In addition, implementing C is the sort of thing that hackers like to do. So you can count on C running on any given CPU, virtual or real. http://en.wikipedia.org/wiki/CPython

This thing will have a total of 128kB directly addressable ram (as 64k 16b words). There's no way, no how that CPython would ever do anything remotely useful here.

Re: Notch's Specification for the In-Game DCPU-16

#47
post #2

Just waiting for the first post about programming this CPU to pop up on Stack Overflow ... :) It's quite an interesting architecture. From an initial perusal, I found these features note-worthy: * Explicit access to PC as a register, makes "computed goto" trivial and very natural. * Because of the above, there is no JMP instruction. * Treating operations on registers as "values" makes the instruction set very orthogo…

> Explicit access to PC as a register, makes "computed goto" trivial and very natural. Am I right in thinking ARM uses this model? I haven't worked on them since ARM2, but I have a hazy recollection...

Sort of. R15 is the PC, but you also have branch instructions which have very large literal values which in practice you'll always use.

http://www.wss.co.uk/pinknoise/ARMinstrs/ARMinstrs.html#Bran...

Re: Notch's Specification for the In-Game DCPU-16

#49

Now here's an interesting bit: "Question: can we trade the programs we create? How will you stop malicious viruses etc?" "yes. And I won't stop viruses, the players will have to do that themselves." ~ https://twitter.com/#!/notch/status/187474819980328962

I worry about the griefing potential here.

I can imagine nothing pissing off a noob more than getting a virus within 10 minutes of play and having no idea how to stop his ship from self destructing.

Perhaps this will need some sort of firewall system built in where ships cannot communicate unless ports have been explicitly opened. Perhaps some sort of communications proxy that can serve for safe communications.

It could have a system similar to EVE where high security systems have infrastructural to mitigate risk whereas low sec systems lack this but contain the best rewards.

Post reply on HN