anachronauts / jeff65

a compiler targeting the Commodore 64 with gold-syntax
GNU General Public License v3.0
6 stars 0 forks source link
commodore64 compiler gplv3 mos6502 python python3

jeff65

Build Status AppVeyor Coverage Status Requirements Status

jeff65 is a compiler for the Commodore 64 (and perhaps in the future, other 6502-based computers). It is implemented in Python 3 and produces .prg files which can be loaded directly in VICE, or combined into .d64 disk images, written to a floppy disk, and run on real hardware.

note: this project is currently in its early stages. Features discussed below are largely the product of wishful thinking and may change at any time.

jeff65 compiles languages using gold syntax, producing blum files as intermediate files. gold syntax provides an imperative systems language for 6502-series processors.

Primary invocation:

usage: jeff65 compile [-h] [-v] file

positional arguments:
  file           the file to compile

optional arguments:
  -h, --help     show this help message and exit
  -v, --verbose  show the output of each pass

Licensing

The jeff65 compiler itself is provided under the GPLv3 license; if you distribute a modified version of the compiler, you must also make the source code for your modified version available, as described in the license terms. A copy of the GPLv3 license is included in LICENSE.txt in the source distribution.

The standard library units and runtime library, whenever they get written, will probably be provided either using the GPL with a linking exception, or under a non-copyleft license.

Gold-syntax

Gold-syntax provides an imperative systems programming language for 6502-series processors. Features of the processor are exposed in a friendly-but-powerful way; it should be possible to understand what code will be generated by looking directly at the source file.

Gold-syntax is not associated with the Gold parser framework or the gold LLVM linker.

Here is an example file which puts a light red heart to the top-left corner of the screen, which actually works with the compiler in its current, very unfinished, state:

use mem

constant screen-corner: &u8 = mem.as-pointer(0x0400)
constant screen-corner-color: &u8 = mem.as-pointer(0xd800)

fun main()
  @screen-corner = 0x53      /* screencode for <3 */
  @screen-corner-color = 10  /* light red */
endfun