Re:Pacman running on DCPU-16
by vajrabum on Friday April 20, 2012 @11:04AM
(#3868150)
How long will it be before somebody ports a nice VM to DCPU-16 or targets a compiler for it? The architecture is so simple and familiar I'm guessing that's not a terribly hard job. Folks are probably not going to write their programs in DCPU-16 assembler.
[ Parent
| on HN ]
It does exist: https://github.com/llvm-dcpu16/llvm-dcpu16. The only problem is that there's not going to exist a compiler in-game. People will have to import the compiled assembly code, which isn't nearly as fun as staying in the game during the whole process.
Re:Pacman running on DCPU-16
by RodgerTheGreat on Friday April 20, 2012 @11:17AM
(#3868235)
Which is a pretty good argument for building a self-hosted Forth. You get a compiler and REPL suitable for commanding the computer in a package that will fit easily in the limited memory resources available. If you use threaded code with an "inner interpreter", it's possible to generate very compact code and fit a lot in a small space, or you could emit machine code directly ("subroutine threaded code") for speed.
Someone's done that! http://matt.immute.net/files/goforth/
There are already a number of compilers targeted at it. Browse through reddit.com/r/dcpu16 and you'll see a new one pop up every few days. I'm curious how long it will take before we see compilers that are good at optimization. Pretty much every compiler I've seen crop up makes admissions that it's generating terrible code.