VIDEO: Minecraft CPU Has Memory, Performs Division
It's a virtual machine performing inside of a virtual machine. Excellent.
Over on the Minecraft forums, user "Salaja" spent the last month creating a virtual redstone CPU within the popular block-building game Minecraft. According to Salaja, the virtual machine (within a virtual machine) can actually hold up to 16 lines of code in its memory, execute said code, and then print out the result in hexadecimal onto 7 segment displays.
"This CPU was made with extensive use of INVedit, MCedit and peaceful difficulty, and wouldn't have been possible without them," he said, adding that anyone can use his designs as long as (1) he receives some credit, and (2) they're used for non-commercial purposes. "What I want to avoid is people claiming that they made this CPU, when they really didn't."
"I only had a basic understanding of logic gates, flipflops, and adders before starting this project," he said when asked how he figured out how to build the working CPU. "I built it step by step, adding whatever I thought it need. I didn't follow any existing CPU architecture, so it is possible that mine is completely unique."
Salaja started by deciding on sizes for instruction (16-bit) and ALU (8-bit). He then built a giant block of memory and a way to write values for each one-- this can be done by numerous levers or a counter that selects which line you're writing to. Next he built a bus along the outputs of the memory flip flops, and added another counter to select only one instruction to be sent onto the bus at any one time.
"The counter activates a heap on AND gates on only one of the memory slots, meaning all the other slots are having their output blocked from getting onto the bus," he said, adding that builders should keep going "until it does stuff."