vaxerski / Holy6800

A small HolyC compiler for the Motorola 6800.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Holy6800

A simple (not feature-complete) HolyC compiler for the Motorola 6800 released in 1974.


Language feature support

  • Types: U8, I8, U0, 16-bit pointers
  • Functions
  • Locals
  • if/else statements
  • switch statements
  • while loops
  • continue, break in switches & loops
  • Multi-argument expressions parsed with respect of the order of operations
  • Operators
  • Bytecode optimizer

Running

See holy6800 --help for options.

Building

Depends on CMake. Run make all to build.

Notes

  • else if is NOT supported.
  • () in expressions are NOT supported (e.g. 2 * (2 - 2))
  • Not battle tested. Expect bugs.
  • / (div) is NOT supported.
  • The 6800 has an 8-bit data bus. Arithmetic on pointers may overflow. See tests/manualPtrs.hc for a solution if you want to do pointers manually.

Calling convention

Holy6800 uses a cdecl-like calling convention.

Parameters are pushed and popped by the caller, in the order they appear in the function signature.

The function's return value is stored in A.

Examples

See tests/.

About

A small HolyC compiler for the Motorola 6800.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C++ 96.5%Language:CMake 2.0%Language:HolyC 1.1%Language:Makefile 0.4%