mirror of
https://github.com/irmen/prog8.git
synced 2024-09-10 09:54:32 +00:00
fix resultregister crash
This commit is contained in:
parent
c098ad2b3b
commit
dcba4f4098
@ -872,7 +872,7 @@ internal class BuiltinFunctionsAsmGen(private val program: PtProgram,
|
|||||||
if(resultToStack) {
|
if(resultToStack) {
|
||||||
asmgen.out(" sta P8ESTACK_LO,x | dex")
|
asmgen.out(" sta P8ESTACK_LO,x | dex")
|
||||||
} else {
|
} else {
|
||||||
val targetReg = AsmAssignTarget.fromRegisters(resultRegister!!, signed, fcall.position, fcall.definingISub(), asmgen)
|
val targetReg = AsmAssignTarget.fromRegisters(resultRegister ?: RegisterOrPair.A, signed, fcall.position, fcall.definingISub(), asmgen)
|
||||||
assignAsmGen.assignRegisterByte(targetReg, CpuRegister.A, signed)
|
assignAsmGen.assignRegisterByte(targetReg, CpuRegister.A, signed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -884,7 +884,7 @@ internal class BuiltinFunctionsAsmGen(private val program: PtProgram,
|
|||||||
if(resultToStack) {
|
if(resultToStack) {
|
||||||
asmgen.out(" sta P8ESTACK_LO,x | sty P8ESTACK_HI,x | dex")
|
asmgen.out(" sta P8ESTACK_LO,x | sty P8ESTACK_HI,x | dex")
|
||||||
} else {
|
} else {
|
||||||
val targetReg = AsmAssignTarget.fromRegisters(resultRegister!!, signed, fcall.position, fcall.definingISub(), asmgen)
|
val targetReg = AsmAssignTarget.fromRegisters(resultRegister ?: RegisterOrPair.AY, signed, fcall.position, fcall.definingISub(), asmgen)
|
||||||
assignAsmGen.assignRegisterpairWord(targetReg, RegisterOrPair.AY)
|
assignAsmGen.assignRegisterpairWord(targetReg, RegisterOrPair.AY)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -905,7 +905,7 @@ internal class BuiltinFunctionsAsmGen(private val program: PtProgram,
|
|||||||
if(resultToStack) {
|
if(resultToStack) {
|
||||||
asmgen.out(" sta P8ESTACK_LO,x | dex")
|
asmgen.out(" sta P8ESTACK_LO,x | dex")
|
||||||
} else {
|
} else {
|
||||||
val targetReg = AsmAssignTarget.fromRegisters(resultRegister!!, signed, fcall.position, fcall.definingISub(), asmgen)
|
val targetReg = AsmAssignTarget.fromRegisters(resultRegister ?: RegisterOrPair.A, signed, fcall.position, fcall.definingISub(), asmgen)
|
||||||
asmgen.assignRegister(RegisterOrPair.A, targetReg)
|
asmgen.assignRegister(RegisterOrPair.A, targetReg)
|
||||||
}
|
}
|
||||||
} else if(fcall.type in WordDatatypes) {
|
} else if(fcall.type in WordDatatypes) {
|
||||||
@ -946,7 +946,7 @@ internal class BuiltinFunctionsAsmGen(private val program: PtProgram,
|
|||||||
if(resultToStack) {
|
if(resultToStack) {
|
||||||
asmgen.out(" sta P8ESTACK_LO,x | sty P8ESTACK_HI,x | dex")
|
asmgen.out(" sta P8ESTACK_LO,x | sty P8ESTACK_HI,x | dex")
|
||||||
} else {
|
} else {
|
||||||
val targetReg = AsmAssignTarget.fromRegisters(resultRegister!!, signed, fcall.position, fcall.definingISub(), asmgen)
|
val targetReg = AsmAssignTarget.fromRegisters(resultRegister ?: RegisterOrPair.AY, signed, fcall.position, fcall.definingISub(), asmgen)
|
||||||
asmgen.assignRegister(RegisterOrPair.AY, targetReg)
|
asmgen.assignRegister(RegisterOrPair.AY, targetReg)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -967,7 +967,7 @@ internal class BuiltinFunctionsAsmGen(private val program: PtProgram,
|
|||||||
if(resultToStack) {
|
if(resultToStack) {
|
||||||
asmgen.out(" sta P8ESTACK_LO,x | dex")
|
asmgen.out(" sta P8ESTACK_LO,x | dex")
|
||||||
} else {
|
} else {
|
||||||
val targetReg = AsmAssignTarget.fromRegisters(resultRegister!!, signed, fcall.position, fcall.definingISub(), asmgen)
|
val targetReg = AsmAssignTarget.fromRegisters(resultRegister ?: RegisterOrPair.A, signed, fcall.position, fcall.definingISub(), asmgen)
|
||||||
asmgen.assignRegister(RegisterOrPair.A, targetReg)
|
asmgen.assignRegister(RegisterOrPair.A, targetReg)
|
||||||
}
|
}
|
||||||
} else if(fcall.type in WordDatatypes) {
|
} else if(fcall.type in WordDatatypes) {
|
||||||
@ -1008,7 +1008,7 @@ internal class BuiltinFunctionsAsmGen(private val program: PtProgram,
|
|||||||
if(resultToStack) {
|
if(resultToStack) {
|
||||||
asmgen.out(" sta P8ESTACK_LO,x | sty P8ESTACK_HI,x | dex")
|
asmgen.out(" sta P8ESTACK_LO,x | sty P8ESTACK_HI,x | dex")
|
||||||
} else {
|
} else {
|
||||||
val targetReg = AsmAssignTarget.fromRegisters(resultRegister!!, signed, fcall.position, fcall.definingISub(), asmgen)
|
val targetReg = AsmAssignTarget.fromRegisters(resultRegister ?: RegisterOrPair.AY, signed, fcall.position, fcall.definingISub(), asmgen)
|
||||||
asmgen.assignRegister(RegisterOrPair.AY, targetReg)
|
asmgen.assignRegister(RegisterOrPair.AY, targetReg)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user