vm: prog8lib.wordarray_contains() fixed

This commit is contained in:
Irmen de Jong 2022-11-03 22:42:49 +01:00
parent fc55b34d84
commit 7303c00296
3 changed files with 15 additions and 8 deletions

View File

@ -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

View File

@ -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
...

View File

@ -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)
}
}