News for hackers. Stuff that matters.
Re:DCPU16 Assembler in less than 200 lines of Ruby by judofyr on Thursday April 05, 2012 @10:46AM (#3802733)
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).

Re:DCPU16 Assembler in less than 200 lines of Ruby by alpatters on Thursday April 05, 2012 @09:35AM (#3802460)
is the 200 lines a brag? It is in fact longer than the C++ version posted earlier.
Re:DCPU16 Assembler in less than 200 lines of Ruby by tophercyll on Thursday April 05, 2012 @10:16AM (#3802620)
Not a brag--just wanted emphasize how straightforward and fun something like this can be.
Re:DCPU16 Assembler in less than 200 lines of Ruby by sarbogast on Thursday April 05, 2012 @08:56AM (#3802336)
Who will be the first one to build a DCPU16 computer inside Minecraft?
Re:DCPU16 Assembler in less than 200 lines of Ruby by jgrahamc on Thursday April 05, 2012 @09:10AM (#3802381)
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.
Re:DCPU16 Assembler in less than 200 lines of Ruby by msarnoff on Thursday April 05, 2012 @11:30AM (#3802986)
> 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.

Re:DCPU16 Assembler in less than 200 lines of Ruby by ORioN63 on Thursday April 05, 2012 @09:22AM (#3802414)
More important: Who will be the first one to code Minecraft on a DCPU16 computer?
Re:DCPU16 Assembler in less than 200 lines of Ruby by pavel_lishin on Thursday April 05, 2012 @09:25AM (#3802423)
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.)

Re:DCPU16 Assembler in less than 200 lines of Ruby by angli on Thursday April 05, 2012 @11:22AM (#3802941)
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.

Re:DCPU16 Assembler in less than 200 lines of Ruby by knewter on Thursday April 05, 2012 @01:46PM (#3803675)
who will implement a DCPU16 in Conway's game of life.
Re:DCPU16 Assembler in less than 200 lines of Ruby by chj on Thursday April 05, 2012 @09:58AM (#3802537)
while (> 100 lines) { zzzzZZZZZzzzz.. }
Re:DCPU16 Assembler in less than 200 lines of Ruby by jenius on Thursday April 05, 2012 @09:32AM (#3802450)
Hate to be that guy, but this isn't actually less than 200 lines... perhaps "about 200 lines" would have been a better title?
Re:DCPU16 Assembler in less than 200 lines of Ruby by ashleyf on Thursday April 05, 2012 @11:52AM (#3803101)
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-...
Re:DCPU16 Assembler in less than 200 lines of Ruby by ORioN63 on Thursday April 05, 2012 @09:36AM (#3802464)
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.
Re:DCPU16 Assembler in less than 200 lines of Ruby by ianterrell on Thursday April 05, 2012 @09:34AM (#3802455)
Whitespace doesn't count.
Re:DCPU16 Assembler in less than 200 lines of Ruby by _quasimodo on Thursday April 05, 2012 @11:11AM (#3802869)
DCPU16 Assembler in 0 lines of Whitespace :)
Re:DCPU16 Assembler in less than 200 lines of Ruby by ATPase on Thursday April 05, 2012 @09:41AM (#3802479)
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?
Re:DCPU16 Assembler in less than 200 lines of Ruby by quaunaut on Thursday April 05, 2012 @09:58AM (#3802535)
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.

Re:DCPU16 Assembler in less than 200 lines of Ruby by chernevik on Thursday April 05, 2012 @10:46AM (#3802728)
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.

Re:DCPU16 Assembler in less than 200 lines of Ruby by sp332 on Thursday April 05, 2012 @10:51AM (#3802757)
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. :)