mirror of
https://github.com/irmen/prog8.git
synced 2024-12-25 08:29:25 +00:00
fix bug in uword > comparison
This commit is contained in:
parent
b30b8b7368
commit
6780d4f562
@ -622,16 +622,15 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge
|
||||
|
||||
private fun translateUwordGreaterJump(left: Expression, right: Expression, leftConstVal: NumericLiteralValue?, rightConstVal: NumericLiteralValue?, jumpIfFalseLabel: String) {
|
||||
|
||||
// TODO verify correctness uword >
|
||||
|
||||
fun code(msbCpyOperand: String, lsbCmpOperand: String) {
|
||||
asmgen.out("""
|
||||
cpy $msbCpyOperand
|
||||
bcs $jumpIfFalseLabel
|
||||
bcc $jumpIfFalseLabel
|
||||
bne +
|
||||
cmp $lsbCmpOperand
|
||||
bcs $jumpIfFalseLabel
|
||||
+""")
|
||||
bcc $jumpIfFalseLabel
|
||||
+ beq $jumpIfFalseLabel
|
||||
""")
|
||||
}
|
||||
|
||||
if(rightConstVal!=null) {
|
||||
@ -662,8 +661,8 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge
|
||||
return code("$varname+1", varname)
|
||||
}
|
||||
|
||||
asmgen.assignExpressionToVariable(left, "P8ZP_SCRATCH_W2", DataType.UWORD, null)
|
||||
asmgen.assignExpressionToRegister(right, RegisterOrPair.AY)
|
||||
asmgen.assignExpressionToVariable(right, "P8ZP_SCRATCH_W2", DataType.UWORD, null)
|
||||
asmgen.assignExpressionToRegister(left, RegisterOrPair.AY)
|
||||
return code("P8ZP_SCRATCH_W2+1", "P8ZP_SCRATCH_W2")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user