fix asmgen for call $3000

This commit is contained in:
Irmen de Jong 2024-12-13 22:33:26 +01:00
parent 1679ca79b4
commit 697d54e10a
3 changed files with 8 additions and 6 deletions

View File

@ -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)

View File

@ -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") {

View File

@ -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::