All Projects → ioncodes → Llvm8

ioncodes / Llvm8

Statically recompiling CHIP8 to Windows and macOS using LLVM

Projects that are alternatives of or similar to Llvm8

C2goasm
C to Go Assembly
Stars: ✭ 1,072 (+1409.86%)
Mutual labels:  llvm
Steam Buddy
A web interface for managing Steam remotely
Stars: ✭ 61 (-14.08%)
Mutual labels:  emulation
Bizhawk
BizHawk is a multi-system emulator written in C#. BizHawk provides nice features for casual gamers such as full screen, and joypad support in addition to full rerecording and debugging tools for all system cores.
Stars: ✭ 1,138 (+1502.82%)
Mutual labels:  emulation
Breachdetector
Detect root, emulation, debug mode and other security concerns in your Xamarin apps
Stars: ✭ 57 (-19.72%)
Mutual labels:  emulation
Cxxctp
DEPRECATED. USE INSTEAD github.com/blockspacer/flextool
Stars: ✭ 58 (-18.31%)
Mutual labels:  llvm
M680x0 Llvm
M68K LLVM Port
Stars: ✭ 62 (-12.68%)
Mutual labels:  llvm
Llvm D
D bindings for LLVM
Stars: ✭ 50 (-29.58%)
Mutual labels:  llvm
Kai
An expressive low level programming language
Stars: ✭ 68 (-4.23%)
Mutual labels:  llvm
Zapcc
zapcc is a caching C++ compiler based on clang, designed to perform faster compilations
Stars: ✭ 1,109 (+1461.97%)
Mutual labels:  llvm
Avalonstudio
Cross platform IDE and Shell
Stars: ✭ 1,132 (+1494.37%)
Mutual labels:  llvm
Echo
Generic static analysis framework.
Stars: ✭ 55 (-22.54%)
Mutual labels:  emulation
Retrobat
RetroBat is the best way to play your ROMs collection on Windows !
Stars: ✭ 58 (-18.31%)
Mutual labels:  emulation
Play
Play! - PlayStation 2 Emulator
Stars: ✭ 1,117 (+1473.24%)
Mutual labels:  emulation
Visualnes
Visual NES simulates the CPU & PPU of a NES at the transistor level.
Stars: ✭ 55 (-22.54%)
Mutual labels:  emulation
Cclyzer
A tool for analyzing LLVM bitcode using Datalog.
Stars: ✭ 67 (-5.63%)
Mutual labels:  llvm
Llvm Hs Examples
Examples for Haskell bindings to LLVM
Stars: ✭ 51 (-28.17%)
Mutual labels:  llvm
Whack
The Whack Programming Language
Stars: ✭ 61 (-14.08%)
Mutual labels:  llvm
Unidbg
Allows you to emulate an Android ARM32 and/or ARM64 native library, and an experimental iOS emulation
Stars: ✭ 1,168 (+1545.07%)
Mutual labels:  emulation
Llvm Heat Printer
LLVM Profiling Visualization
Stars: ✭ 68 (-4.23%)
Mutual labels:  llvm
Optviewer Demo
Demonstration of LLVM's opt-viewer tool
Stars: ✭ 63 (-11.27%)
Mutual labels:  llvm

llvm8

Lifting CHIP8 to LLVM and recompiling to any architecture.

What is this?

llvm8 aims to lift a CHIP8 ROM to LLVM which gives us the capability to recompile the ROM to any LLVM-supported architecture. This allows us to run old ROMs without the use of emulation. This is also called static recompilation.

How does it work?

Here's a rough overview of what is going on:

  1. Disassemble ROM file
  2. Lift instructions to LLVM
  3. Write original ROM file to a global array in the LLVM bitcode
  4. Simulate CHIP8 architecture registers through global variables
  5. Link against external/lib.cpp which contains GUI code and general high level handlers for the ROM

How do I build this?

Download this LLVM distribution created by mrexodia. I installed the files to C:\LLVM10\, if you use a different path make sure to change the path below and the paths set in make.bat and make.sh.

git clone https://github.com/ioncodes/llvm8
cd llvm8
mkdir build && cd build
cmake -DCMAKE_PREFIX_PATH=C:/LLVM10 ..

Open up the solution in your IDE and build it! The binary is called llvm8{.exe}.

How do I use this?

llvm8 requires you to tell it which bytes are actually executable instructions (and not data), you can do so by providing a comma seperated list to --code. When in doubt just use 0-{FILE_SIZE_HERE}. To find out the code paths use any CHIP8 disassembler or this emulator. To recompile a ROM execute the following command:

# this assumes that llvm.exe is placed in the project root folder.
llvm.exe --rom ./roms/boot.ch8 --code "0-88"

This will write a new file called boot.ch8.ll. To recompile this to Windows or macOS use the make.bat and make.sh scripts respectively:

make.bat boot.ch8.ll

This will recompile it to a native image and start it up for debugging purposes.

What is missing?

A lot of instructions are currently missing (for example call & ret). I used a few test ROMs I found online to create a recompiler that works with most test ROMs I used. There is also no keyboard support but implementing that is just a matter of plugging SDLs keyboard support to the ROM registers.
There's also a bug where the UI can not be created on macOS but you can just enable the NOGUI flag in external/lib.cpp and it will output to the terminal instead.

Images?

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].