diff --git a/compiler/res/prog8lib/c64/floats.asm b/compiler/res/prog8lib/c64/floats.asm index 766fa42b2..2e1c02182 100644 --- a/compiler/res/prog8lib/c64/floats.asm +++ b/compiler/res/prog8lib/c64/floats.asm @@ -428,7 +428,9 @@ var_fac1_greater_f .proc cmp #1 beq + lda #0 -+ rts + rts ++ lda #1 + rts .pend var_fac1_greatereq_f .proc diff --git a/compiler/test/arithmetic/Makefile b/compiler/test/arithmetic/Makefile index 7066be806..b92c32d43 100644 --- a/compiler/test/arithmetic/Makefile +++ b/compiler/test/arithmetic/Makefile @@ -6,8 +6,8 @@ clean: rm -f *.prg *.asm *.vice-* test: clean - p8compile *.p8 >/dev/null + p8compile -target cx16 *.p8 >/dev/null for program in *.prg; do \ echo "RUNNING:" $$program ; \ - x64sc $$program >/dev/null ; \ + x16emu -run -prg $$program >/dev/null ; \ done diff --git a/compiler/test/comparisons/Makefile b/compiler/test/comparisons/Makefile index 838fa7784..9edf17729 100644 --- a/compiler/test/comparisons/Makefile +++ b/compiler/test/comparisons/Makefile @@ -5,11 +5,14 @@ all: test clean: rm -f *.prg *.asm *.vice-* test_*.p8 -test: clean +test: clean generate test_prgs + +generate: python make_tests.py p8compile -noopt -target cx16 *.p8 >/dev/null + +test_prgs: for program in *.prg; do \ echo "RUNNING:" $$program ; \ x16emu -run -prg $$program >/dev/null ; \ done - diff --git a/compiler/test/comparisons/make_tests.py b/compiler/test/comparisons/make_tests.py index 89d9f7490..45ed9b7b4 100644 --- a/compiler/test/comparisons/make_tests.py +++ b/compiler/test/comparisons/make_tests.py @@ -33,9 +33,14 @@ def gen_test(dt, comparison, left, right, expected): stmt_ok = lambda ix: f"error({ix})" stmt_else = lambda ix: "num_successes++" + def c(number): + if dt not in ("byte", "ubyte"): + return f"({number} as {dt})" + return str(number) + print( -f""" left = {left} - right = {right} +f""" left = {c(left)} + right = {c(right)} """ ) @@ -43,7 +48,7 @@ f""" left = {left} index += 1 print( f""" ; test #{index} - if {left} {comparison} {right} {{ + if {c(left)} {comparison} {c(right)} {{ {stmt_ok(index)} }} else {{ {stmt_else(index)} @@ -53,7 +58,7 @@ f""" ; test #{index} index += 1 print( f""" ; test #{index} - if {left} {comparison} right {{ + if {c(left)} {comparison} right {{ {stmt_ok(index)} }} else {{ {stmt_else(index)} @@ -63,7 +68,7 @@ f""" ; test #{index} index += 1 print( f""" ; test #{index} - if {left} {comparison} right+zero {{ + if {c(left)} {comparison} right+zero {{ {stmt_ok(index)} }} else {{ {stmt_else(index)} @@ -73,7 +78,7 @@ f""" ; test #{index} index += 1 print( f""" ; test #{index} - if left {comparison} {right} {{ + if left {comparison} {c(right)} {{ {stmt_ok(index)} }} else {{ {stmt_else(index)} @@ -103,7 +108,7 @@ f""" ; test #{index} index += 1 print( f""" ; test #{index} - if left+zero {comparison} {right} {{ + if left+zero {comparison} {c(right)} {{ {stmt_ok(index)} }} else {{ {stmt_else(index)} diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 2bc6a13c1..26403131c 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -4,7 +4,6 @@ TODO - fix errors in comparison changes (first complete the new comparison test generation tool) - fix imageviewer only showing first image (likely fixed by the one above) -- fix X register (evalstack) issue in arithmetic/builtins.prg - add cx16 vload() - optimize several inner loops in gfx2