mirror of
https://github.com/irmen/prog8.git
synced 2024-11-03 13:07:54 +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) {
|
private fun translateUwordGreaterJump(left: Expression, right: Expression, leftConstVal: NumericLiteralValue?, rightConstVal: NumericLiteralValue?, jumpIfFalseLabel: String) {
|
||||||
|
|
||||||
// TODO verify correctness uword >
|
|
||||||
|
|
||||||
fun code(msbCpyOperand: String, lsbCmpOperand: String) {
|
fun code(msbCpyOperand: String, lsbCmpOperand: String) {
|
||||||
asmgen.out("""
|
asmgen.out("""
|
||||||
cpy $msbCpyOperand
|
cpy $msbCpyOperand
|
||||||
bcs $jumpIfFalseLabel
|
bcc $jumpIfFalseLabel
|
||||||
bne +
|
bne +
|
||||||
cmp $lsbCmpOperand
|
cmp $lsbCmpOperand
|
||||||
bcs $jumpIfFalseLabel
|
bcc $jumpIfFalseLabel
|
||||||
+""")
|
+ beq $jumpIfFalseLabel
|
||||||
|
""")
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rightConstVal!=null) {
|
if(rightConstVal!=null) {
|
||||||
@ -662,8 +661,8 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge
|
|||||||
return code("$varname+1", varname)
|
return code("$varname+1", varname)
|
||||||
}
|
}
|
||||||
|
|
||||||
asmgen.assignExpressionToVariable(left, "P8ZP_SCRATCH_W2", DataType.UWORD, null)
|
asmgen.assignExpressionToVariable(right, "P8ZP_SCRATCH_W2", DataType.UWORD, null)
|
||||||
asmgen.assignExpressionToRegister(right, RegisterOrPair.AY)
|
asmgen.assignExpressionToRegister(left, RegisterOrPair.AY)
|
||||||
return code("P8ZP_SCRATCH_W2+1", "P8ZP_SCRATCH_W2")
|
return code("P8ZP_SCRATCH_W2+1", "P8ZP_SCRATCH_W2")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user