fix IR long comparisons (used in for loops for instance)

This commit is contained in:
Irmen de Jong
2026-03-01 01:45:07 +01:00
parent da6e47d422
commit 8911f58bd2
2 changed files with 20 additions and 1 deletions
@@ -677,7 +677,7 @@ class IRCodeGen(
when (loopvarDtIr) {
IRDataType.BYTE -> rangeEndExclusiveUntyped and 255
IRDataType.WORD -> rangeEndExclusiveUntyped and 65535
else -> rangeEndExclusiveUntyped and 0x7fffffff
else -> rangeEndExclusiveUntyped
}
val result = mutableListOf<IRCodeChunkBase>()
val chunk = IRCodeChunk(null, null)
+19
View File
@@ -2,6 +2,11 @@
%zeropage basicsafe
%option no_sysinit
; TODO fix:
; long lv
; lv--
main {
; Test the routine
sub start() {
@@ -10,11 +15,25 @@ main {
for lv in 4000 to 94000-1 {
counter++
}
for lv in 70000-1 downto 0 {
counter++
}
for lv in 94000-1 downto 4000 {
counter++
}
for lv in 4000 to 94000-1 step 10 {
counter++
}
for lv in 70000-1 downto 0 step -10 {
counter++
}
for lv in 94000-1 downto 4000 step -10 {
counter++
}
txt.print_l(counter)
txt.nl()
txt.print_l(275000)
txt.nl()
}
}