Skip to content
LLVM backend for dcpu-16 processor
C++ Objective-C Assembly Shell C OCaml Other
Pull request Compare This branch is 3 commits behind llvm-dcpu16:dcpu16.
Failed to load latest commit information.
projects Remove 'check-dg', a wrapper around 'check-local-dg' which was just Jun 28, 2012
test Fix test failures. Currently, test/CodeGen/X86/early-ifcvt.ll fails, … Jul 4, 2012
unittests Merge branch 'master' into dcpu16 Jul 4, 2012
utils Merge branch 'master' into dcpu16 Jul 4, 2012
CREDITS.TXT Alphabetize. Jun 19, 2012
Makefile.rules Remove 'check-dg', a wrapper around 'check-local-dg' which was just Jun 28, 2012 DCPU16: Fixed small typo in the May 16, 2012
configure Merge branch 'master' into dcpu16 Jul 4, 2012

LLVM backend for DCPU-16

DCPU-16 is the processor from Mojang's new game 0x10c. This project has a goal to make a full-featured LLVM backend for DCPU-16 and port Clang to support this architecture.

Currently llvm backend and Clang support are nearly fully implemented.

Simple C SDK

You can download a simple C SDK, which includes clang with the binutils port for dcpu16. It is Makefile based and contains a very simple C test program to demonstrate how you can develop your own program.


You can find different precompiled packages for linux here.

There is also a very simple build script, which will assemble all needed parts for building the SDK yourself.

Please, let us know, if it does not work for you.


First, of all, you need to install prerequisites:

sudo apt-get install gcc g++ git subversion git-svn make\
 perl gawk expect tcl texinfo bison autoconf automake cmake

Note, that when your python executable points to python3 (you can check that by running python --version) you have to replace "cmake .." with "cmake -DPYTHON_EXECUTABLE=/path/to/python2 .." in the following steps (path is /usr/bin/python2 in most cases)

Next, get the sources and build it:

git clone git:// # Checkout LLVM
cd llvm-dcpu16/tools
git clone git:// # Checkout Clang
mkdir ../cbuild
cd ../cbuild
cmake ..
make -j4


Consider the following C file:


int fib(int n) {
  int cur = 1;
  int prev = 1;
  for (int i = 0; i < n; i++) {
    int next = cur+prev;
    prev = cur;
    cur = next;
  return cur;

int main(void) {
  return fib(5);

Now, let's translate C to DCPU16 assembly:

bin/clang -ccc-host-triple dcpu16 -S fib.c -o fib.s

We generate DCPU16 v1.7 ASM with GAS compatible syntax. Most online assemblers won't work. Please use the binutils port for DCPU16 to assemble and link your program and then use an DCPU16 v1.7 compatible emulator to test your program.

Enjoy and, please, report bugs!

Something went wrong with that request. Please try again.