Giter Site home page Giter Site logo

krasin / llvm-dcpu16 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from llvm-dcpu16/llvm-dcpu16

29.0 4.0 1.0 114.67 MB

LLVM backend for dcpu-16 processor

License: Other

Vim Script 0.04% C++ 68.25% OCaml 1.04% C 2.02% Shell 5.18% Perl 0.10% Objective-C 12.33% Assembly 10.11% Python 0.89% Emacs Lisp 0.03%

llvm-dcpu16's Introduction

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.

####Download#### 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.

Building

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://github.com/llvm-dcpu16/llvm-dcpu16.git # Checkout LLVM
cd llvm-dcpu16/tools
git clone git://github.com/llvm-dcpu16/clang.git # Checkout Clang
mkdir ../cbuild
cd ../cbuild
cmake ..
make -j4

Using LLVM-DCPU16

Consider the following C file:

fib.c:

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!

llvm-dcpu16's People

Contributors

lattner avatar isanbard avatar resistor avatar stoklund avatar ddunbar avatar mbrukman avatar cunningbaldrick avatar asl avatar nlewycky avatar espindola avatar d0k avatar bob-wilson avatar echristo avatar sampo3k avatar bcardosolopes avatar eefriedman avatar atrick avatar jimlaskey avatar ggreif avatar ahatanak avatar greened avatar topperc avatar chandlerc avatar alkis avatar bigcheese avatar chapuni avatar tlattner avatar tkremenek avatar zwarich avatar lhames avatar

Stargazers

NKanato avatar Hannes Winkler avatar lensfrex avatar Alexx Saver avatar Philip Herron avatar Masanori Ohgita avatar Matt Sylvia avatar Dylan Bourgeois avatar Wojciech Miłkowski avatar tianchen avatar Chris Dew avatar Chris Dzombak avatar Tyler Holien avatar David Figueroa avatar Theodore Lee avatar Alejandro Baez avatar Eric Gallager avatar Therin Irwin avatar Daniel Fagnan avatar Павел "Malo" Скрылёв  avatar Andres Riofrio avatar Rutger Storm avatar Hiroshi Yamamoto avatar Jevin Sweval avatar Rohit Yadav avatar Peter Kristensen avatar Ivan Krasin avatar  avatar Cliff Rowley avatar

Watchers

Ivan Krasin avatar James Cloos avatar jneeout avatar  avatar

Forkers

heicks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.