mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 16:29:21 +00:00
fix possible register corruption when calling asmsubs that require Carry flag as a parameter
This commit is contained in:
parent
1da0c59182
commit
8d177beb78
@ -141,13 +141,14 @@ internal class FunctionCallAsmGen(private val program: PtProgram, private val as
|
|||||||
}
|
}
|
||||||
is PtIdentifier -> {
|
is PtIdentifier -> {
|
||||||
val sourceName = asmgen.asmVariableName(value)
|
val sourceName = asmgen.asmVariableName(value)
|
||||||
|
// note: cannot use X register here to store A because it might be used for other arguments
|
||||||
asmgen.out("""
|
asmgen.out("""
|
||||||
tax
|
pha
|
||||||
clc
|
clc
|
||||||
lda $sourceName
|
lda $sourceName
|
||||||
beq +
|
beq +
|
||||||
sec
|
sec
|
||||||
+ txa""")
|
+ pla""")
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
asmgen.assignExpressionToRegister(value, RegisterOrPair.A)
|
asmgen.assignExpressionToRegister(value, RegisterOrPair.A)
|
||||||
|
Loading…
Reference in New Issue
Block a user