News for hackers. Stuff that matters.
Re:DCPU-16 implementation in f# by jerf on Friday April 06, 2012 @12:18PM (#3807740)
OK, yes, I get it, every major programming language can implement an emulator for DCPU-16 in a few dozen lines. Can someone hurry up and post the [consults the Trendy Language Calendar] Node implementation so we can call it a day on the DCPU-16 implementations?

(Incidentally, I'm not saying DCPU-16 is uninteresting, and if somebody's got something more interesting than a straight-up implementation I'm still all ears. But... Church-Turing, you know?)

Re:DCPU-16 implementation in f# by ginko on Friday April 06, 2012 @12:37PM (#3807838)
I agree.

I would be a lot more interested into high level languages for DCPU-16.

Also, most DCPU-16 implementations I have seen so far are bytecode interpreters. I would love to see an actual JIT translating emulator that generates x86 or even better llvm code. The performance difference should be considerable.

Re:DCPU-16 implementation in f# by bozman on Friday April 06, 2012 @12:41PM (#3807856)
Re:DCPU-16 implementation in f# by ORioN63 on Friday April 06, 2012 @12:56PM (#3807924)
Re:DCPU-16 implementation in f# by haberman on Friday April 06, 2012 @02:32PM (#3808305)
I was going to write one using DynASM (it would be very short, simple, and fast) but it was unclear to me that DCPU-16 had any substantial programs written for it where you could show off a speed difference.

I have been looking for an excuse to write an article about how to use DynASM though.

Re:DCPU-16 implementation in f# by aiscott on Friday April 06, 2012 @05:16PM (#3808984)
I'd like to see an implementation in OrgASM, but it's hard to type with just one hand.
Re:DCPU-16 implementation in f# by dkersten on Sunday April 08, 2012 @08:20PM (#3815337)
JIT compiling DCPU-16 bytecode using LLVM is something I plan to do later if I get time. I imagine by then someone else will already have done it, but if not, then its something I plan to do.
Re:DCPU-16 implementation in f# by VMG on Friday April 06, 2012 @05:09PM (#3808954)
Come on, isn't it nice to see a Rosetta Stone for something that isn't math-oriented?

I think one of Notch's goals with DCPU-16 was bringing back the feeling of programming for computers with very limited specs and little complexity. I think this is proof that his plan is working.

Re:DCPU-16 implementation in f# by sehugg on Friday April 06, 2012 @03:40PM (#3808577)
Apparently the Stack Overflow questions are already rolling in: http://stackoverflow.com/questions/tagged/dcpu-16

I imagine this must be slightly entertaining to witness for Notch.

Re:DCPU-16 implementation in f# by xal on Friday April 06, 2012 @12:50PM (#3807898)
It's great to see what idiomatic code looks like in all these different languages. F# shines here.
Re:DCPU-16 implementation in f# by exim on Friday April 06, 2012 @12:18PM (#3807739)
Please forgive me my ignorance, but why are these DCPU-16 implementations in <put your favorite language> [in less than X lines] popping up in recent days?
Re:DCPU-16 implementation in f# by danieldk on Friday April 06, 2012 @12:21PM (#3807753)
It's an in-game CPU of Notch' (creator of Minecraft) new MMO:

http://0x10c.com/doc/dcpu-16.txt http://0x10c.com/

Since the DCPU-16 spec has only been announced recently, there is currently a surge in interest.

Re:DCPU-16 implementation in f# by MarkSweep on Friday April 06, 2012 @01:43PM (#3808115)
Most of these implementations change the stack pointer as a side effect of decoding a skipped instruction:

IFN a, a Set Push, 1

Is this the intended behavior?

Re:DCPU-16 implementation in f# by dkersten on Friday April 06, 2012 @04:04PM (#3808667)
Yes, I think so because branches skip full instructions and instructions may be between 1 and 3 bytes but exactly how many is unknown until the skipped instruction is decoded.
Re:DCPU-16 implementation in f# by MarkSweep on Friday April 06, 2012 @04:42PM (#3808834)
The PC needs to be incremented past the "next words". But it seems odd that a un-executed push instruction would still modify SP.
Re:DCPU-16 implementation in f# by dkersten on Sunday April 08, 2012 @08:17PM (#3815331)
This is true - I actually miss-read your comment and thought you said instruction pointer instead of stack pointer... It seems to be a bug in the implementation (from my reading of the spec, this should not happen).
Re:DCPU-16 implementation in f# by ashleyf on Saturday April 07, 2012 @12:40AM (#3809994)
I believe you're right @MarkSweep. Thanks much for pointing that out! Fixed.
Re:DCPU-16 implementation in f# by danfitch on Friday April 06, 2012 @04:13PM (#3808709)
Who is going to do this in brainfuck?
Re:DCPU-16 implementation in f# by Cieplak on Friday April 06, 2012 @02:31PM (#3808302)
Does anyone know which implementation of the DCPU-16 is the shortest?
Re:DCPU-16 implementation in f# by cpeterso on Friday April 06, 2012 @11:59AM (#3807647)
What does the D in DCPU stand for? Notch's DCPU spec does not say.
Re:DCPU-16 implementation in f# by ique on Friday April 06, 2012 @12:13PM (#3807715)
This is in the storyline:

>In 1988, a brand new deep sleep cell was released, compatible with all popular 16 bit computers.

So I've assumed from the start that the D is for Deep, because the whole story is about this deep sleep stuff. But yeah, that's really just speculation. I don't think there's any official answer to it.