diff --git a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt index 7c70ff319..a806fbb39 100644 --- a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt +++ b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt @@ -174,7 +174,7 @@ internal class AstChecker(private val program: Program, else -> false } if (!ok) { - errors.err("statement occurs in a block, where it will never be executed. Use it in a subroutine instead.", statement.position) + errors.err("non-declarative statement occurs in block scope, where it will never be executed. Move it to a subroutine instead.", statement.position) break } } diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 114a54d8b..4488b90fb 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -2,8 +2,6 @@ TODO ==== -- alllow uword xx=memory() initialization in block scope. - - hoist all variable declarations up to the subroutine scope *before* even the constant folding takes place (to avoid undefined symbol errors when referring to a variable from another nested scope in the subroutine) - optimize swap of two memread values with index, using the same pointer expression/variable, like swap(@(ptr+1), @(ptr+2)) - optimize several inner loops in gfx2 (highres 4 color mode) diff --git a/examples/test.p8 b/examples/test.p8 index 84e92a775..bf6c5f695 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -1,16 +1,9 @@ %import textio +%zeropage basicsafe main { -; $1F9C0 - $1F9FF PSG registers - sub start() { - txt.print("tone") - - uword freq = 1181 - cx16.vpoke(1, $f9c0, lsb(freq)) - cx16.vpoke(1, $f9c1, msb(freq)) - cx16.vpoke(1, $f9c2, %11111111) ; volume - cx16.vpoke(1, $f9c3, %11000000) ; triangle waveform + txt.print("done\n") } }