retro /

C++4Z80

Modern C++ for the Z80 — bringing today’s language to 8-bit machines like the MSX2.

  • C++
  • GCC
  • Z80 / MSX2

Summary

C++4Z80 is a GCC-based compiler backend effort that targets Z80-family processors, so that modern C++ can run on classic computers such as the MSX2.

Purpose

Retro platforms are traditionally programmed in assembly or C. This project explores how far the expressiveness of modern C++ — and its promise of zero-overhead abstractions — can be taken on a resource-constrained 8-bit CPU, extending the life and fun of older hardware.

Key features

  • Built on the GCC infrastructure
  • Targets the Z80 processor family
  • Focus on the MSX2 home computer
  • Getting-started guide included

Examples

int main ()
{
  std_print("Hello from MSX-DOS!\r\n"_s);
  return 0;
}

This compiles down to 35 bytes of hello.com. Even though there is quite a bit of compile-time (constexpr) machinery behind it, see:

Check it out on C++4Z80’s Github page

Technology

C++ compiler development on top of GCC16. Early-stage project — a labour of love for retro computing.