diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt index c7556b624..c1c0caf1c 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt @@ -74,10 +74,12 @@ class AsmGen6502(val prefixSymbols: Boolean, private val lastGeneratedLabelSeque } } is PtJump -> { - val stNode = st.lookup(node.identifier!!.name) ?: throw AssemblyError("name not found ${node.identifier}") - if(stNode.astNode.definingBlock()?.options?.noSymbolPrefixing!=true) { - val index = node.parent.children.indexOf(node) - nodesToPrefix += node.parent to index + if(node.address==null) { + val stNode = st.lookup(node.identifier!!.name) ?: throw AssemblyError("name not found ${node.identifier}") + if (stNode.astNode.definingBlock()?.options?.noSymbolPrefixing != true) { + val index = node.parent.children.indexOf(node) + nodesToPrefix += node.parent to index + } } } is PtBlock -> prefixNamedNode(node) diff --git a/compiler/test/TestScoping.kt b/compiler/test/TestScoping.kt index 5ac75fa22..20e194750 100644 --- a/compiler/test/TestScoping.kt +++ b/compiler/test/TestScoping.kt @@ -364,7 +364,7 @@ class TestScoping: FunSpec({ } } """ - compileText(C64Target(), false, text, writeAssembly = false) shouldNotBe null + compileText(C64Target(), false, text, writeAssembly = true) shouldNotBe null } test("various wrong goto targets") { diff --git a/docs/source/programming.rst b/docs/source/programming.rst index e68a80a87..48a08551d 100644 --- a/docs/source/programming.rst +++ b/docs/source/programming.rst @@ -1001,7 +1001,7 @@ Normally, every subroutine parameter will get its own local variable in the subr will be stored when the subroutine is called. In certain situations, this may lead to many variables being allocated. You *can* instruct the compiler to not allocate a new variable, but instead to reuse one of the *virtual registers* R0-R15 (accessible in the code as ``cx16.r0`` - ``cx16.r15``) for the parameter. This is done by adding a ``@Rx`` tag -to the parameter. This can only be done for byte and word types. +to the parameter. This can only be done for booleans, byte, and word types. Note: the R0-R15 *virtual registers* are described in more detail below for the Assembly subroutines. Here's an example that reuses the R0 and the R1L (lower byte of R1) virtual registers for the paremeters::