c128: no FP support

This commit is contained in:
Irmen de Jong 2023-04-28 17:43:42 +02:00
parent ea78d3ec9a
commit f8d35f9502
3 changed files with 16 additions and 5 deletions

View File

@ -13,6 +13,10 @@ class AtariZeropage(options: CompilationOptions) : Zeropage(options) {
override val SCRATCH_W2 = 0xcfu // temp storage 2 for a word $cf+$d0 TODO is $d0 okay to use?
init {
if (options.floats) {
throw InternalCompilerException("Atari target doesn't yet support floating point routines")
}
if (options.floats && options.zeropage !in arrayOf(
ZeropageType.FLOATSAFE,
ZeropageType.BASICSAFE,

View File

@ -16,6 +16,10 @@ class C128Zeropage(options: CompilationOptions) : Zeropage(options) {
override val SCRATCH_W2 = 0xfdu // temp storage 2 for a word $fd+$fe
init {
if (options.floats) {
throw InternalCompilerException("C128 target doesn't yet support floating point routines")
}
if (options.floats && options.zeropage !in arrayOf(
ZeropageType.FLOATSAFE,
ZeropageType.BASICSAFE,
@ -45,13 +49,13 @@ class C128Zeropage(options: CompilationOptions) : Zeropage(options) {
0xb0u, 0xb1u, 0xb4u, 0xb5u, 0xb6u
))
if(options.zeropage==ZeropageType.BASICSAFE) {
// can also clobber the FP locations
// if(options.zeropage==ZeropageType.BASICSAFE) {
// can also clobber the FP locations (unconditionally, because the C128 target doesn't support floating point calculations in prog8 at this time0
free.addAll(listOf(0x14u, 0x28u, 0x29u, 0x2au, 0x2bu, 0x2cu,
0x50u, 0x51u, 0x52u, 0x53u, 0x54u, 0x59u, 0x5au, 0x5bu, 0x5cu, 0x5du, 0x5eu, 0x5fu, 0x60u, 0x61u, 0x62u,
0x63u, 0x64u, 0x65u, 0x66u, 0x67u, 0x68u,
0x6au, 0x6bu, 0x6cu, 0x6du, 0x6eu, 0x6fu, 0x71u))
}
// }
}
ZeropageType.DONTUSE -> {
free.clear() // don't use zeropage at all

View File

@ -1,7 +1,10 @@
; Prog8 definitions for floating point handling on the Commodore 128
%option enable_floats
%import floats_functions
; NOTE: it can't currently be used at all because the float variables
; on the c128 have to be stored in memory bank 1 (separate bank)
; and prog8 can't do that now (it just inlines everything)
%option enable_floats ; this is here to trigger the compiler error.
floats {
; ---- this block contains C-128 compatible floating point related functions ----