diff --git a/codeCore/src/prog8/code/target/c64/C64Zeropage.kt b/codeCore/src/prog8/code/target/c64/C64Zeropage.kt index c7974d229..8f1b99ead 100644 --- a/codeCore/src/prog8/code/target/c64/C64Zeropage.kt +++ b/codeCore/src/prog8/code/target/c64/C64Zeropage.kt @@ -56,7 +56,7 @@ class C64Zeropage(options: CompilationOptions) : Zeropage(options) { if(options.zeropage!= ZeropageType.DONTUSE) { // add the free Zp addresses // these are valid for the C-64 but allow BASIC to keep running fully *as long as you don't use tape I/O* - free.addAll(listOf(0x04, 0x05, 0x06, 0x0a, 0x0e, + free.addAll(listOf(0x02, 0x03, 0x04, 0x05, 0x06, 0x0a, 0x0e, 0x92, 0x96, 0x9b, 0x9c, 0x9e, 0x9f, 0xa5, 0xa6, 0xb0, 0xb1, 0xbe, 0xbf, 0xf9).map{it.toUInt()}) } else { diff --git a/compiler/src/prog8/compiler/astprocessing/AstPreprocessor.kt b/compiler/src/prog8/compiler/astprocessing/AstPreprocessor.kt index 7bf6717bb..f4c186d13 100644 --- a/compiler/src/prog8/compiler/astprocessing/AstPreprocessor.kt +++ b/compiler/src/prog8/compiler/astprocessing/AstPreprocessor.kt @@ -7,10 +7,7 @@ import prog8.ast.expressions.* import prog8.ast.statements.* import prog8.ast.walk.AstWalker import prog8.ast.walk.IAstModification -import prog8.code.core.CompilationOptions -import prog8.code.core.Encoding -import prog8.code.core.IErrorReporter -import prog8.code.core.NumericDatatypes +import prog8.code.core.* import prog8.code.target.C64Target import prog8.code.target.Cx16Target @@ -21,7 +18,11 @@ class AstPreprocessor(val program: Program, override fun before(program: Program): Iterable { if(options.compTarget.name==C64Target.NAME) { - relocateCx16VirtualRegisters(program, 0x0004u) // unfortunately, can't be the same address as CommanderX16 + if(options.zeropage==ZeropageType.KERNALSAFE || options.zeropage==ZeropageType.FULL) { + // there is enough space in the zero page to put the cx16 virtual registers there. + // unfortunately, can't be the same address as CommanderX16. + relocateCx16VirtualRegisters(program, 0x0004u) + } } else if(options.compTarget.name!=Cx16Target.NAME) { relocateCx16VirtualRegisters(program, options.compTarget.machine.ESTACK_HI) diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 066ca40b7..15d4f1e73 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,8 +3,6 @@ TODO For next release ^^^^^^^^^^^^^^^^ -- check that all examples still function correctly - ... diff --git a/examples/bsieve.p8 b/examples/bsieve.p8 index 14665c5d3..93d9db3a8 100644 --- a/examples/bsieve.p8 +++ b/examples/bsieve.p8 @@ -17,7 +17,7 @@ main { uword prime uword k const uword SIZEPL = 8191 - uword flags_ptr = memory("flags", SIZEPL, $100) + uword @zp flags_ptr = memory("flags", SIZEPL, $100) txt.print("calculating...\n") diff --git a/examples/test.p8 b/examples/test.p8 index 0b6e72c09..dfa3312aa 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -1,30 +1,21 @@ %import textio %zeropage basicsafe + main { sub start() { - uword crc = $ffff - if crc & $8000 ; msb(crc) & $80 - txt.print("yes") - else - txt.print("fail!") - if crc & $1234 - txt.print("yes") - else - txt.print("fail!") - } + uword @zp flags_ptr = memory("flags", 200, 0) + txt.print("calculating...\n") + txt.print_uwhex(flags_ptr, true) + txt.nl() -; sub start2() { -; ubyte[] arr = [1,2,3,4] -; uword pointer -; ubyte ix -; -; arr[ix] = arr[ix]+1 -; -;; arr[3] = arr[3]+1 -;; pointer[3] = pointer[3]+1 -; -; txt.print_ub(arr[3]) -; } + repeat 10 { + txt.print("new iter\n") + txt.print_ub(@($06)) + sys.memset(flags_ptr, 200, 0) + } + + txt.print("done\n") + } }