From 7303c0029653201134104ee88cf994e108016dda Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Thu, 3 Nov 2022 22:42:49 +0100 Subject: [PATCH] vm: prog8lib.wordarray_contains() fixed --- compiler/res/prog8lib/virtual/prog8_lib.p8 | 4 +--- docs/source/todo.rst | 1 + examples/test.p8 | 18 +++++++++++++----- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/compiler/res/prog8lib/virtual/prog8_lib.p8 b/compiler/res/prog8lib/virtual/prog8_lib.p8 index 91a6e7f90..318baafea 100644 --- a/compiler/res/prog8lib/virtual/prog8_lib.p8 +++ b/compiler/res/prog8lib/virtual/prog8_lib.p8 @@ -1,7 +1,5 @@ ; Internal library routines - always included by the compiler -%import textio - prog8_lib { %option force_output @@ -25,7 +23,7 @@ prog8_lib { return false } - sub wordarray_contains(ubyte needle, uword haystack_ptr, ubyte num_elements) -> ubyte { + sub wordarray_contains(uword needle, uword haystack_ptr, ubyte num_elements) -> ubyte { haystack_ptr += (num_elements-1) * 2 while num_elements { if peekw(haystack_ptr)==needle diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 98bdc1f56..4f240ac97 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,6 +3,7 @@ TODO For next release ^^^^^^^^^^^^^^^^ +- fix error when passing boolean expression as ubyte param to a functioncall - fix expericodegen crashes from missing functions from virtual/prog8_lib.p8 ... diff --git a/examples/test.p8 b/examples/test.p8 index 1ce3a2084..12aabae94 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -1,13 +1,21 @@ -%import floats %import textio %zeropage basicsafe main { - float[10] flt + + str name1 = "abc" + str name2 = "irmen" + ubyte v1 + ubyte v2 + + sub func(ubyte value) { + value++ + } sub start() { - flt[1] = 42.42 - flt[1] = -flt[1] - floats.print_f(flt[1]) + func(v1==v2) + func(v1>v2) + func(name1 == name2) + func(name1 > name2) } }