7 ms·
LLVM backend for DCPU-16
- RDeckard 15y agoExcuse the ignorance, but what is the big deal about DCPU-16?
- jensnockert 15y agoIt is the basis of http://0x10c.com/ http://0x10c.com/, an upcoming game from Notch/Mojang of Minecraft fame.
- jsprinkles 15y agoI'm not sure that answers the specific question being asked here, which I read to be about HN, not the impetus.
- stephengillie 15y agoFor some people, it's "another CPU I can write a compiler for". For others, we love playing Minecraft and are excited for Notch's next game. Still other people are intrigued by the complex gameplay Notch has described and have confidence from the success of Minecraft. And others will find it evidence of the further sub-redditing of HN.
- greggman 15y agoYes, I don't get it either. As far as I can tell it's just that people love Notch (he's pretty cool) so anything he does is automatically cool as well. It's not like there haven't been games with instruction sets before. http://en.wikipedia.org/wiki/Core_War http://en.wikipedia.org/wiki/Core_War http://en.wikipedia.org/wiki/RobotWar http://en.wikipedia.org/wiki/RobotWar
- Deestan 15y ago> It's not like there haven't been games with instruction sets before. So what if it's not conceptually new? Why would people not be excited about a very good-looking entry to a fantastic genre?
- zoul 15y agoA lot of us intially entered the computer field to do something like program our spaceships' guns and shields, so this rings an important string inside us. Also, the CPU is so simple that everything around it (the spec, various emulators, assemblers and compilers) is quite accessible even to people who have little experience with this low-level stuff. In short, if the DCPU-16 and related technology do not fit the "fun hacking" label, then I don't know what does.
- Natsu 15y agoIt's a toy CPU that's perfect for learning. It's about to be part of Notch's new game (he created Minecraft). So it's a great combination of fun + educational. Honestly, I'm surprised no one has made one of these CPUs in Minecraft yet. I can guarantee that it's possible. In other words, this has a lot of people excited about a game that doesn't even exist yet. Oh, and given the popularity of Notch's games and the buzz for this one, I'm sure that a few people will manage to turn a tidy profit based on their fun. There are more than a few highly popular Minecraft websites, YouTube channels, etc. So there are a lot of things that appeal to hackers. It's a great toy system to play with, it's going to be an important part of an interesting game, etc. Note that some people have already learned about electronics by building redstone circuits in Minecraft. It abstracts away everything but the logic, so it's a fun way to play with logic gates and whatnot to build something interesting. For example, I have a giant circuit hooked to a redstone clock to periodically flood the spawning pads of the gigantic mob grinder that covers my base camp and increase the number of items I get. It's enormous, but not particularly exceptional by Minecraft standards. It does help me produce a lot of TNT, though. I put a record player in the item collection room to pass the time.
- i386 15y agoPost a video please :-)
- Natsu 15y agoI'll do you one better and give you the whole world: http://www.mediafire.com/?6ywsyy18qhening http://www.mediafire.com/?6ywsyy18qhening Note that it's in the new format. I deleted the parts in the old format to make it smaller. The mob grinder is the huge thing in the sky. The items fall into a room in the upper level of the house.
- i386 15y agoAwesome! Can't wait to give it a go :)
- 15y ago
- swalsh 15y agoRight now it's a toy, but there's a whole new group of programmers who have never touched any kind of low level programming before. People are taking new world ideas, and applying them to what one might call old world problems. Look at this: http://dwilliamson.github.com/ http://dwilliamson.github.com/ its a real time asm editor... there's going to be a lot of really cool toys that come out of this, and potentially those toys might inspire someone to make something that's more than a toy.
- kylemaxwell 15y agoIt's a reasonable question. When you combine the concept of a very simple CPU + instruction set (which reminds many of us of the systems we used when first learning to hack) with a system based on a much-loved and much-imitated older game, you have a recipe for success among a certain class of geek. I think it tickles some of the same interest points as Corewars[1], but a little less abstract and with a newly-galvanized and potentially larger community. [1]: http://corewars.org http://corewars.org
- judofyr 15y agoToo bad it doesn't follow the calling conventions proposed on #0x12-dev: https://github.com/0x10cStandardsCommittee/0x10c-Standards/blob/master/ABI/Draft_ABI_1.txt https://github.com/0x10cStandardsCommittee/0x10c-Standards/b...
- krasin 15y ago(dcpu16 llvm backend developer here) That ABI is hard to implement in LLVM, mostly because of SP can't be addressed as [4+SP] in DCPU-16. So, DCPU16 LLVM backend uses C register as a frame pointer (to store local variables and other data) and SP as a stack pointer to store ret addresses. There're other "flaws" in that ABI which increase the cost of developing an LLVM backend. I am going to make the supported ABI closer to #0x12-dev ABI in v0.0.5 and report them the most annoying features of their ABI.
- tkahn6 15y agoDude seriously this is awesome. Good work. DCPU-16 is perfect for learning about all these cool aspects of computer science. It's so stripped down (lacking, for example, instruction pipelining) that it's easy to get into and see what's going on at a very basic level. I look forward to looking over the repo later today (after I've slept).
- zxer 15y agoI don't think it makes any sense to follow any community-agreed guidelines until Notch finalizes his design. Do you plan to make a short description of what exactly it took to create the backend? I thought this would be an excellent excuse to learn about llvm, so been reading about its internals the past few days, and even though I realized that starting with MSP430 this would be relatively simple for someone who knows llvm, I am apparently too late to the party :) Nonetheless I would be interested in some overview.
- viraptor 15y agoGreat work :) I just spotted something in the compiled example and wonder if this: SET J, [4+C] ; The Notch order ADD J, 1 ; The Notch order SET [4+C], J ; The Notch order Is not transformed to ADD [4+C], 1 due to some assumptions in llvm, or do you not handle the literal values as arguments yet?
- swdunlop 15y ago"Binary distribution for Linux x64 is available. (v0.0.2, 170MB)" 170MB to emulate and compile targeting a 128kb virtual machine. Funny how things have bloated.
- derleth 15y ago"Bloat" being "Every feature I'm not using right this instant."
- zoul 15y agoIt’s a reasonable price for the convenient abstraction. What’s interesting is the size of the binaries and the compression ratio of the whole thing (0.2): zoul@naima:llvm-dcpu16 $ du -sh * 286M bin 13M include 522M lib 76K share What’s in the binaries so that they are so huge and compress so well?
- viraptor 15y agoI'm tempted to point at various graph fragments and other cpu descriptions which are partly auto-generated. It's a guess though, I'd like to know a real answer too. Is is a high price to pay for a framework which allows people to port compilers to a whole new architecture in a matter of days? Also this binary may actually include all targets, not just dcpu16.
- baq 15y agoguess: unstripped debug info? llvm is c++ after all...
- tkahn6 15y agoThis is so cool! Just finished my implementation and it runs the fib example flawlessly†! https://github.com/tkahn6/dcpu16-haskell/ https://github.com/tkahn6/dcpu16-haskell/ † Because mine is a pure state machine and Haskell is lazy, I had to introduce a HLT instruction instead of using `:crash SET PC, crash`. Nothing ever gets printed using the latter convention.
- carterschonwald 15y agoYou can use a monad to thread the computation for strictness while retaining purity.
- 10098 15y agoThis is so incredibly cool! But how did you implement I/O?
- dalore 15y agoCertain memory areas correspond to the console. If you have a look at Notch's Hello World example you see him putting letters in memory areas. Now if this is how it will communicate with the rest of the ship, I don't know.
- richdougherty 15y agoA few days ago he was thinking of a message queue... not sure how it would work though. http://twitter.com/#!/notch/status/187448370107912192 http://twitter.com/#!/notch/status/187448370107912192
- viraptor 15y agoSince he wants to simulate the cpus all the time and there's no sleep / wait which actually stops execution, tight wait loops shouldn't be an issue. Just wait for some mmaped [msg_no_ptr] to be >0.
- deleted 15y ago[deleted]
- Zr40 15y agoI'm also working on a compiler targeting the DCPU-16. It doesn't compile C code, instead there's a simple C-like language supporting modules and pointers. It's not really finished and can surely produce better code, but I wanted to share it anyway. Here's the fib example from the LLVM backend's README: https://gist.github.com/2336867 https://gist.github.com/2336867. My compiler currently manages to compile fib to 30 instructions (0x2E words) compared to 38 instructions (0x41 words) for the LLVM backend. Here's the source: https://github.com/zr40/dcc https://github.com/zr40/dcc
- colinmarc 15y agoNext up: compile a JVM and run the game within the game??? Joking aside, what are some scripting languages with tiny interpreters that could feasibly compile eventually?
- sp332 15y agoJust a suggestion: there's a lot of cool stuff going on with this project, and it would be a shame if interested people missed out on it. At the same time, posting every cool thing to HN could flood the front page for months :) So let's move discussion of new implementations, assemblers, and disassemlers (at least) to the DCPU subreddit? http://www.reddit.com/r/dcpu16 http://www.reddit.com/r/dcpu16
- vyrotek 15y agoThanks. I didn't know there was a subreddit for this. Oh dear. DCPU emulation on DCPU? http://www.reddit.com/r/dcpu16/comments/rz6fd/dcpu_emulation_on_dcpu/ http://www.reddit.com/r/dcpu16/comments/rz6fd/dcpu_emulation...