diff --git a/compiler/src/prog8/ast/statements/AstStatements.kt b/compiler/src/prog8/ast/statements/AstStatements.kt index ed463ce50..c2ce6d307 100644 --- a/compiler/src/prog8/ast/statements/AstStatements.kt +++ b/compiler/src/prog8/ast/statements/AstStatements.kt @@ -270,7 +270,7 @@ open class VarDecl(val type: VarDeclType, // a vardecl used only for subroutine parameters class ParameterVarDecl(name: String, declaredDatatype: DataType, position: Position) - : VarDecl(VarDeclType.VAR, declaredDatatype, ZeropageWish.NOT_IN_ZEROPAGE, null, name, null, null, false, true, position) + : VarDecl(VarDeclType.VAR, declaredDatatype, ZeropageWish.DONTCARE, null, name, null, null, false, true, position) class ArrayIndex(var index: Expression, override val position: Position) : Node { diff --git a/compiler/src/prog8/compiler/target/c64/codegen/AsmGen.kt b/compiler/src/prog8/compiler/target/c64/codegen/AsmGen.kt index 2a311fb51..16182ed9a 100644 --- a/compiler/src/prog8/compiler/target/c64/codegen/AsmGen.kt +++ b/compiler/src/prog8/compiler/target/c64/codegen/AsmGen.kt @@ -247,7 +247,6 @@ internal class AsmGen(private val program: Program, out("; vars allocated on zeropage") val variables = statements.filterIsInstance().filter { it.type==VarDeclType.VAR } for(variable in variables) { - // should NOT allocate subroutine parameters on the zero page val fullName = variable.makeScopedName(variable.name) val zpVar = allocatedZeropageVariables[fullName] if(zpVar==null) { diff --git a/docs/source/todo.rst b/docs/source/todo.rst index ebde311bc..9f1800b25 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -2,7 +2,6 @@ TODO ==== -- allocate sub params in zeropage as well (it already allows @zp tag on them!) - optimize assignment codegeneration - get rid of all TODO's ;-) - make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as '_' diff --git a/examples/plasma.p8 b/examples/plasma.p8 index 9465cbcaf..74017e23e 100644 --- a/examples/plasma.p8 +++ b/examples/plasma.p8 @@ -71,10 +71,9 @@ main { } c2A += 2 c2B -= 3 - uword @zp scrptr = screen for y in 24 downto 0 { for x in 39 downto 0 { - @(scrptr) = xbuf[x] + ybuf[y] + @(screen) = xbuf[x] + ybuf[y] ; %asm {{ ; ldy x ; lda xbuf,y @@ -82,9 +81,9 @@ main { ; clc ; adc ybuf,y ; ldy #0 -; sta (scrptr),y +; sta (screen),y ; }} - scrptr++ + screen++ } } } diff --git a/examples/test.p8 b/examples/test.p8 index e15d02d8d..856de1a11 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -4,9 +4,12 @@ main { sub start() { - uword addr=$d020 - ubyte q =2 - @(addr) += q + + subje(12345) + } + + sub subje(uword xx) { + @($c000) = lsb(xx) } }