Inspired by Jason Turner’s talk at CppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17”
I got interested in writing a Zilog Z80 backend for LLVM. Jason actually did no such thing, but instead wrote a x86-to-6502 translator (reassembler he calls it) https://github.com/lefticus/x86-to-6502
So I’m now trying to bootstrap this project.
- be able to use C++17 (or whatever is supported of that in clang-master) on my Z80 based MSX2 computer.
why? you might ask, well, just because I’m a software engineer and I like doing something I have not tried before.
In the past I have created a PC-to-MSX USB-interface called the ‘nowind’ interface (http://nowind.nl/)
It is actually a MSX2-compatible cartridge that from the MSX2 perspective appears to be a diskdrive, but actually the ‘disk’ is a disk-image file on the PC.
The host-software is written in c++98 and the z80-software (residing in flashrom) is written in z80-assembly, which I mastered quite well back then.
So why am I telling you this?
I would like to get some pointers on how to get started.
My development environment is currently windows, but if there is any advantage in switching to linux, that is also fine.
I have gcc/gdb experience but its a little rusty.
so I started reading http://llvm.org/docs/GettingStarted.html, and downloaded http://llvm.org/releases/3.9.0/LLVM-3.9.0-win64.exe precompiled binaries to get the hang of the toolchain.
Couple of questions:
- First thing I noticed is that clang-dis is not part of the pre-compiled package?
- What is a wise approach, should I compile clang from scratch to get clang-dis?
- are LLVM backends for clang also in the trunk http://llvm.org/git/llvm.git ?
- should I start by examining and existing backend, if so, where do I find one?
I hope anyone can give me some guidance to bootstrap this…