From 606011ea3893080e6749fc668ce09df0ba85d945 Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Sat, 3 Mar 2018 21:41:49 +0100 Subject: [PATCH] New target: C64 with SuperCPU in native mode --- doc/api/target-platforms.md | 4 +++- include/c64_scpu16.ini | 22 +++++++++++++++++++ include/loader_0801_16bit.mfk | 21 ++++++++++++++++++ src/main/scala/millfork/parser/MfParser.scala | 2 +- 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 include/c64_scpu16.ini create mode 100644 include/loader_0801_16bit.mfk diff --git a/doc/api/target-platforms.md b/doc/api/target-platforms.md index a1a41905..75f2c892 100644 --- a/doc/api/target-platforms.md +++ b/doc/api/target-platforms.md @@ -9,7 +9,9 @@ The following platforms are currently supported: * `c64` – Commodore 64 -* `c64_scpu` – Commodore 64 with SuperCPU (very buggy) +* `c64_scpu` – Commodore 64 with SuperCPU in emulation mode + +* `c64_scpu16` – Commodore 64 with SuperCPU in native, 16-bit mode (very buggy) * `c16` – Commodore 16 diff --git a/include/c64_scpu16.ini b/include/c64_scpu16.ini new file mode 100644 index 00000000..9a23e400 --- /dev/null +++ b/include/c64_scpu16.ini @@ -0,0 +1,22 @@ +; Commodore 64 with a SuperCPU, running in native mode +; assuming a program loaded from disk or tape +; This has lower compatibility with inline assembly, but it's clearly faster. + +[compilation] +arch=65816 +modules=c64_hardware,loader_0801_16bit,c64_kernal,c64_panic,stdlib +emit_65816=native + +[allocation] +main_org=$811 +zp_pointers=$C1,$C3,$FB,$FD,$39,$3B,$3D,$43,$45,$47,$4B +himem_style=per_bank +himem_start=after_code +himem_end=$9FFF + +[output] +style=per_bank +format=startaddr,allocated +extension=prg + + diff --git a/include/loader_0801_16bit.mfk b/include/loader_0801_16bit.mfk new file mode 100644 index 00000000..a38d8296 --- /dev/null +++ b/include/loader_0801_16bit.mfk @@ -0,0 +1,21 @@ +array _basic_loader @$801 = [ + $0b, + $08, + 10, + 0, + $9e, + $32, + $30, + $36, + $31, + 0, + 0, + 0 + ] + + +asm void __init_16bit() @$80D { + clc + xce + sep #$30 +} \ No newline at end of file diff --git a/src/main/scala/millfork/parser/MfParser.scala b/src/main/scala/millfork/parser/MfParser.scala index dc20d296..97c733a8 100644 --- a/src/main/scala/millfork/parser/MfParser.scala +++ b/src/main/scala/millfork/parser/MfParser.scala @@ -486,7 +486,7 @@ case class MfParser(filename: String, input: String, currentDirectory: String, o case _ => false }) ErrorReporting.warn("Assembly non-interrupt function `$name` contains RTI, did you mean RTS?", options, Some(p)) } - if (!flags("macro")) { + if (!name.startsWith("__") && !flags("macro")) { xs.last match { case AssemblyStatement(Opcode.RTS, _, _, _) => () // OK case AssemblyStatement(Opcode.RTI, _, _, _) => () // OK