From 623329fb336a18398a5d084a596f4fa6d352be4d Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sun, 5 Feb 2023 17:08:24 +0100 Subject: [PATCH] fix --- codeCore/src/prog8/code/SymbolTableMaker.kt | 12 ++++++------ codeCore/src/prog8/code/ast/AstPrinter.kt | 2 +- codeCore/src/prog8/code/ast/AstStatements.kt | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/codeCore/src/prog8/code/SymbolTableMaker.kt b/codeCore/src/prog8/code/SymbolTableMaker.kt index 8bd140be9..4c6101a7f 100644 --- a/codeCore/src/prog8/code/SymbolTableMaker.kt +++ b/codeCore/src/prog8/code/SymbolTableMaker.kt @@ -22,12 +22,12 @@ class SymbolTableMaker(private val program: PtProgram, private val options: Comp if(options.compTarget.name != VMTarget.NAME) { listOf( - PtMemMapped("P8ZP_SCRATCH_B1", DataType.UBYTE, options.compTarget.machine.zeropage.SCRATCH_B1, Position.DUMMY), - PtMemMapped("P8ZP_SCRATCH_REG", DataType.UBYTE, options.compTarget.machine.zeropage.SCRATCH_REG, Position.DUMMY), - PtMemMapped("P8ZP_SCRATCH_W1", DataType.UWORD, options.compTarget.machine.zeropage.SCRATCH_W1, Position.DUMMY), - PtMemMapped("P8ZP_SCRATCH_W2", DataType.UWORD, options.compTarget.machine.zeropage.SCRATCH_W2, Position.DUMMY), - PtMemMapped("P8ESTACK_LO", DataType.UBYTE, options.compTarget.machine.ESTACK_LO, Position.DUMMY), - PtMemMapped("P8ESTACK_HI", DataType.UBYTE, options.compTarget.machine.ESTACK_HI, Position.DUMMY) + PtMemMapped("P8ZP_SCRATCH_B1", DataType.UBYTE, options.compTarget.machine.zeropage.SCRATCH_B1, null, Position.DUMMY), + PtMemMapped("P8ZP_SCRATCH_REG", DataType.UBYTE, options.compTarget.machine.zeropage.SCRATCH_REG, null, Position.DUMMY), + PtMemMapped("P8ZP_SCRATCH_W1", DataType.UWORD, options.compTarget.machine.zeropage.SCRATCH_W1, null, Position.DUMMY), + PtMemMapped("P8ZP_SCRATCH_W2", DataType.UWORD, options.compTarget.machine.zeropage.SCRATCH_W2, null, Position.DUMMY), + PtMemMapped("P8ESTACK_LO", DataType.ARRAY_UB, options.compTarget.machine.ESTACK_LO, 256u, Position.DUMMY), + PtMemMapped("P8ESTACK_HI", DataType.ARRAY_UB, options.compTarget.machine.ESTACK_HI, 256u, Position.DUMMY) ).forEach { st.add(StMemVar(it.name, it.type, it.address, null, it, Position.DUMMY)) } diff --git a/codeCore/src/prog8/code/ast/AstPrinter.kt b/codeCore/src/prog8/code/ast/AstPrinter.kt index 0e706dde8..cf58367b2 100644 --- a/codeCore/src/prog8/code/ast/AstPrinter.kt +++ b/codeCore/src/prog8/code/ast/AstPrinter.kt @@ -66,7 +66,7 @@ fun printAst(root: PtNode, output: (text: String) -> Unit) { } } is PtBlock -> { - val addr = if(node.address==null) "" else "@${node.address?.toHex()}" + val addr = if(node.address==null) "" else "@${node.address.toHex()}" val align = if(node.alignment==PtBlock.BlockAlignment.NONE) "" else "align=${node.alignment}" "\nblock '${node.name}' $addr $align" } diff --git a/codeCore/src/prog8/code/ast/AstStatements.kt b/codeCore/src/prog8/code/ast/AstStatements.kt index 662537d03..7f2caa30b 100644 --- a/codeCore/src/prog8/code/ast/AstStatements.kt +++ b/codeCore/src/prog8/code/ast/AstStatements.kt @@ -214,7 +214,7 @@ class PtConstant(name: String, override val type: DataType, val value: Double, p } -class PtMemMapped(name: String, val type: DataType, val address: UInt, val arraySize: UInt?, position: Position) : PtNamedNode(name, position) { +class PtMemMapped(name: String, override val type: DataType, val address: UInt, val arraySize: UInt?, position: Position) : PtNamedNode(name, position), IPtVariable { override fun printProperties() { print("&$type $name = ${address.toHex()}") }