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.
Notch's Specification for the In-Game DCPU-16
41–50 of 177 posts
Re: Notch's Specification for the In-Game DCPU-16
#42Context: 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. :)
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
#43Re: Notch's Specification for the In-Game DCPU-16
#44Earlier 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.
Re: Notch's Specification for the In-Game DCPU-16
#45Re: Notch's Specification for the In-Game DCPU-16
#46Earlier 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
Re: Notch's Specification for the In-Game DCPU-16
#47Just 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...
http://www.wss.co.uk/pinknoise/ARMinstrs/ARMinstrs.html#Bran...
Re: Notch's Specification for the In-Game DCPU-16
#48Re: Notch's Specification for the In-Game DCPU-16
#49Now 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 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.
Re: Notch's Specification for the In-Game DCPU-16
#50Conditional branching is strange.