Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Ever since Notch (of Minecraft fame) announced his next project will include programmable 16-bit CPUs ingame everybody seems to want to write VM's for the specification Notch has written up. I've seen them written in C, C++, Go, JavaScript, CoffeeScript, etc.

What's so special about the specification Notch wrote up or is it just that it's the first game that actually contains a CPU ingame that you can do whatever you want with? It sparked my curiosity, but I fail to grasp the thing that makes it so special suddenly everybody needs to write up code for it?

share|improve this question

closed as off topic by thorsten müller, Karl Bielefeldt, gnat, Walter, Yannis Rizos Apr 5 '12 at 17:26

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Implementing a small and simple architecture is fun :) I was going to ignore this game, but maybe I'll write such VM too... –  delnan Apr 5 '12 at 7:18
1  
search for LittleBigPlanet logic on youtube and be amazed, you can create a turing machine with the logic available in LBP1 but the extra logic available in LBP2 makes this muich easier though less visualy impressive –  ratchet freak Apr 5 '12 at 7:24
    
has anyone written a C compiler for it already? –  ratchet freak Apr 5 '12 at 7:25
4  
so you can write a virus, place it on the internet (claim it's a great mining algorithm) and take over your opponents ships. –  thorsten müller Apr 5 '12 at 7:27
10  
Before Notch announced a programmable 16bit CPU for his game, people implemented actual CPUs in Minecraft using nothing but torches and ground stone. It's just something that people do because they can. –  Kovensky Apr 5 '12 at 10:54
add comment

2 Answers 2

up vote 11 down vote accepted

I wouldn't say it was the first. Core War at least has been around since 1984.

Core War (or Core Wars) is a programming game in which two or more battle programs (called "warriors") compete for the control of the "Memory Array Redcode Simulator" virtual computer ("MARS"). These battle programs are written in an abstract assembly language called Redcode. At the start each battle program is put into the memory array at a random location, after which each battle program can execute one instruction in turn. The object of the game is to cause all processes of the opposing program(s) to terminate (which happens if it executes a special instruction), leaving the victorious program in sole possession of the machine.

share|improve this answer
13  
This does not answer the question. –  cgt Apr 5 '12 at 12:53
4  
The original poster asked "is it just that it's the first game that actually contains a CPU ingame that you can do whatever you want with? " It is an answer to that question. –  Alan B Apr 5 '12 at 18:07
add comment

The popularity come first from exposure: the Minecraft community isn't small and there is a non-insignificant subset of them that likes to mess around with specifics and technicalities and would see imlpementing the DCPU-16 emulator as a personal challenge.

Second, it's a very compact specification geared towards easy implementation (*). I'd be able to implement the basic emulator in 15 minutes to an hour in a language I know well.

(*) For example deciding what to read for one of the arguments is as "easy" as:

short arg;
switch(a&0x28){
    case 0x00: arg=registers[a&0x7];
               break;
    case 0x08: arg=ram[registers[a&0x7]];cycle();
               break;
    case 0x10: arg=ram[ram[cp++]+registers[a&0x7]];cycle();
               break;
    case 0x18: switch(a){
                   case 0x18: arg=ram[SP++];
                              break;
                   case 0x19: arg=ram[SP];
                              break;
                   case 0x1a: arg=ram[--SP]
                              break;
                   case 0x1b: arg=SP;
                              break;
                   case 0x1c: arg=PC;
                              break;
                   case 0x1d: arg=O;
                              break;
                   case 0x1e: arg=ram[ram[PC++]];
                              cycle();
                              break;
                   case 0x1f: arg=ram[PC++];
                              cycle();
                              break;
               }
               break;
    default: arg=a;
}

You have this part twice (once for reading and once for writing) or only once if you get a pointer where you can assign it to.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.