Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
DCPU16 Assembler in less than 200 lines of Ruby (github.com/toph)
32 points by tophercyll on April 5, 2012 | hide | past | favorite | 20 comments


For Rubyists who wants to play with DCPU-16:

https://github.com/judofyr/rcpu

It's a DCPU assembler (written in a Ruby DSL) and an emulator/debugger (which allows you to step/run through the execution).

Next up I'm going to implement library support and write some I/O functions. Much of the code is already in place though (e.g. https://github.com/judofyr/rcpu/blob/master/examples/screen.... which maps 0x8000-0x8400 to the terminal).


is the 200 lines a brag? It is in fact longer than the C++ version posted earlier.


Not a brag--just wanted emphasize how straightforward and fun something like this can be.


Who will be the first one to build a DCPU16 computer inside Minecraft?


I'd love to see one made using discrete logic. It's a pretty simple CPU so it looks to me like you could pretty easily build it out of 74 series.


> It's a pretty simple CPU

16-bit address and data buses? Hardware multiplier, divider, and barrel shifter? I wouldn't exactly call it simple. The cost to build one out of discrete logic probably approaches the quadruple digits.

Magic-1 (http://www.homebrewcpu.com/) is a 16-bit, microcoded homebrew CPU that took about 4 years to build, and it doesn't have any of the above features.


More important: Who will be the first one to code Minecraft on a DCPU16 computer?


And who will implement Conway's game of life on top of that?

(I'm psychic: the next comment will ask who will implement a DCPU16 in Conway's game of life.)


Who will implement a DCPU16 in Conway's game of life?

Seriously though, the fact that we're able to ask questions like this is a breath of fresh air... as a market, Notch has done a hell of a job appealing to us.


who will implement a DCPU16 in Conway's game of life.


while (> 100 lines) { zzzzZZZZZzzzz.. }


Hate to be that guy, but this isn't actually less than 200 lines... perhaps "about 200 lines" would have been a better title?


If we're playing line-count-golf, how 'bout in "about 50 lines" of F#? :) http://blogs.msdn.com/b/ashleyf/archive/2012/04/04/notch-is-...


If you remove empty lines, the code will be under 200 lines, so I think it's kind of fair to say it has less than 200 lines.


Whitespace doesn't count.


DCPU16 Assembler in 0 lines of Whitespace :)


What's the hype about this DCPU16 thing? The game hasn't been released yet and people starting to write assemblers. Are you totally bored out of your life?


There are dozens of reasons people do things like this. It's good programming practice for those of us who aren't as confident in our abilities. It gets you some notoriety in the community, maybe even a community you're a big part of. It's something that can go on a resume really easily, if used.

Or maybe, you just wanted to have fun so you spent a night doing this. It isn't a big deal. If you don't waste one night of your life every once in awhile, you're pretty unlike the rest of humanity.


I want to motivate my 12-year old son to learn programming.

He loves Minecraft.

I'm dangling this game in front of him like a ball of twine in front of a kitten.


The DCPU was designed to be easy to emulate. It's a lot of fun to hack on, and simple enough that you can write assemblers for it and still have a life. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: