mirror of
https://github.com/irmen/prog8.git
synced 2025-01-13 10:29:52 +00:00
set correct rom banks when using floats
This commit is contained in:
parent
5b890847e5
commit
d9eccd4fba
@ -9,6 +9,7 @@ import prog8.ast.statements.*
|
||||
import prog8.ast.walk.IAstVisitor
|
||||
import prog8.compiler.CompilationOptions
|
||||
import prog8.compiler.IErrorReporter
|
||||
import prog8.compiler.ZeropageType
|
||||
import prog8.compiler.functions.BuiltinFunctions
|
||||
import prog8.compiler.functions.builtinFunctionReturnType
|
||||
import prog8.compiler.target.C64Target
|
||||
@ -41,6 +42,11 @@ internal class AstChecker(private val program: Program,
|
||||
}
|
||||
}
|
||||
|
||||
if(compilerOptions.floats) {
|
||||
if (compilerOptions.zeropage !in setOf(ZeropageType.FLOATSAFE, ZeropageType.BASICSAFE, ZeropageType.DONTUSE ))
|
||||
errors.err("when floats are enabled, zero page type should be 'floatsafe' or 'basicsafe' or 'dontuse'", program.mainModule.position)
|
||||
}
|
||||
|
||||
super.visit(program)
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,11 @@ internal class AsmGen(private val program: Program,
|
||||
|
||||
// make sure that on the cx16 and c64, basic rom is banked in again when we exit the program
|
||||
when(compTarget.name) {
|
||||
Cx16Target.name -> out(" jsr main.start | lda #4 | sta $01 | rts")
|
||||
Cx16Target.name -> {
|
||||
if(options.floats)
|
||||
out(" lda #4 | sta $01") // to use floats, make sure Basic rom is banked in
|
||||
out(" jsr main.start | lda #4 | sta $01 | rts")
|
||||
}
|
||||
C64Target.name -> out(" jsr main.start | lda #31 | sta $01 | rts")
|
||||
else -> jmp("main.start")
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
- make the floats lib set rombank 4 on cx16 and set sysinit back to rombank 0 (kernal only)
|
||||
- make sure rombank is back to 4 on cx16 when program exits back to basic
|
||||
- check use of float NEGOP vs NEGFAC for cx16
|
||||
|
||||
- allow inlining of subroutines with params
|
||||
|
@ -1,6 +1,6 @@
|
||||
%import textio
|
||||
%import floats
|
||||
%zeropage basicsafe
|
||||
%zeropage floatsafe
|
||||
|
||||
main {
|
||||
|
||||
@ -21,7 +21,7 @@ main {
|
||||
f3 = cos(f3)
|
||||
floats.print_f(f3)
|
||||
|
||||
cx16.rombank(0)
|
||||
;cx16.rombank(0)
|
||||
|
||||
txt.print("ok!\n")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user