mirror of
https://github.com/irmen/prog8.git
synced 2024-11-20 03:32:05 +00:00
labels are now prefixed with underscore in assembly to fix undefined symbol errors from the assembler
This commit is contained in:
parent
a995867deb
commit
68ce4a1bf0
@ -750,7 +750,7 @@ internal class AsmGen(private val program: Program,
|
||||
}
|
||||
|
||||
private fun translate(stmt: Label) {
|
||||
out(stmt.name)
|
||||
out("_${stmt.name}") // underscore prefix to make sure it's a local label
|
||||
}
|
||||
|
||||
private fun translate(scope: AnonymousScope) {
|
||||
@ -819,7 +819,14 @@ internal class AsmGen(private val program: Program,
|
||||
|
||||
private fun getJumpTarget(jmp: Jump): String {
|
||||
return when {
|
||||
jmp.identifier!=null -> asmIdentifierName(jmp.identifier)
|
||||
jmp.identifier!=null -> {
|
||||
val target = jmp.identifier.targetStatement(program.namespace)
|
||||
val asmName = asmIdentifierName(jmp.identifier)
|
||||
if(target is Label)
|
||||
"_$asmName" // prefix with underscore to jump to local label
|
||||
else
|
||||
asmName
|
||||
}
|
||||
jmp.generatedLabel!=null -> jmp.generatedLabel
|
||||
jmp.address!=null -> jmp.address.toHex()
|
||||
else -> "????"
|
||||
|
@ -38,7 +38,6 @@ main {
|
||||
ubyte y = y1
|
||||
|
||||
if dx >= dy {
|
||||
; TODO fix assembler problem when defining label here
|
||||
forever {
|
||||
c64scr.setcc(x, y, 42, 5)
|
||||
if x==x2
|
||||
@ -51,7 +50,6 @@ main {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
; TODO fix assembler problem when defining label here
|
||||
forever {
|
||||
c64scr.setcc(x, y, 42, 5)
|
||||
if y == y2
|
||||
|
@ -1,8 +1,18 @@
|
||||
%zeropage basicsafe
|
||||
|
||||
main 23232323 {
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
if A>Y {
|
||||
label1:
|
||||
Y=0
|
||||
goto label1
|
||||
} else {
|
||||
label2:
|
||||
Y=1
|
||||
goto label2
|
||||
}
|
||||
|
||||
c64scr.print("spstart:")
|
||||
print_stackpointer()
|
||||
sub1()
|
||||
|
Loading…
Reference in New Issue
Block a user