mirror of
https://github.com/irmen/prog8.git
synced 2025-11-25 13:17:41 +00:00
implement long comparisons > and <=
This commit is contained in:
@@ -1474,8 +1474,14 @@ _jump jmp (${target.asmLabel})
|
||||
jump: PtJump?,
|
||||
stmt: PtIfElse
|
||||
) {
|
||||
if(operator=="<" || operator ==">=") {
|
||||
assignmentAsmGen.assignExpressionToRegister(right, RegisterOrPair.R2R3_32, left.type.isSigned)
|
||||
assignmentAsmGen.assignExpressionToRegister(left, RegisterOrPair.R0R1_32, left.type.isSigned)
|
||||
} else {
|
||||
// flip operands
|
||||
assignmentAsmGen.assignExpressionToRegister(left, RegisterOrPair.R2R3_32, left.type.isSigned)
|
||||
assignmentAsmGen.assignExpressionToRegister(right, RegisterOrPair.R0R1_32, left.type.isSigned)
|
||||
}
|
||||
asmgen.out("""
|
||||
sec
|
||||
lda cx16.r0
|
||||
@@ -1487,19 +1493,13 @@ _jump jmp (${target.asmLabel})
|
||||
lda cx16.r0+3
|
||||
sbc cx16.r2+3""")
|
||||
when(operator) {
|
||||
"<" -> {
|
||||
"<", ">" -> {
|
||||
if (jump != null)
|
||||
translateJumpElseBodies("bmi", "bpl", jump, stmt.elseScope)
|
||||
else
|
||||
translateIfElseBodies("bpl", stmt)
|
||||
}
|
||||
">" -> {
|
||||
TODO("long > value ${left.position}")
|
||||
}
|
||||
"<=" -> {
|
||||
TODO("long <= value ${left.position}")
|
||||
}
|
||||
">=" -> {
|
||||
">=", "<=" -> {
|
||||
if (jump != null)
|
||||
translateJumpElseBodies("bpl", "bmi", jump, stmt.elseScope)
|
||||
else
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
LONG TYPE
|
||||
---------
|
||||
- implement long > and <= in compareLongValues()
|
||||
|
||||
|
||||
STRUCTS and TYPED POINTERS
|
||||
--------------------------
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ main {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
txt.print("<=\n")
|
||||
lv1 = $77777777
|
||||
lv2 = $55555555
|
||||
@@ -71,10 +70,8 @@ main {
|
||||
else
|
||||
txt.print("error3 ")
|
||||
txt.nl()
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
txt.print(">\n")
|
||||
lv1 = $77777777
|
||||
lv2 = $55555555
|
||||
@@ -105,7 +102,6 @@ main {
|
||||
else
|
||||
txt.print("ok3 ")
|
||||
txt.nl()
|
||||
*/
|
||||
|
||||
|
||||
txt.print(">=\n")
|
||||
|
||||
Reference in New Issue
Block a user