Discussion

PEEKL and POKEL Bug?

0

nathanielbabiak 2019-11-22 21:55

I think I found a bug. The PEEKL and POKEL instructions don’t work as expected for the full range of possible 4 byte signed integer values (likely because LowRes NX may model variables as floats, not doubles). (Or are these commands intended to take only 3 byte signed integer values, for which they work just fine?)

Any thoughts anyone?

If this gets confirmed, I’d recommend removing these two commands from the language.


was8bit 2019-11-23 00:23

From manual...

POKEL

POKEL a,v
Writes a four-byte value at memory address a. v is a numeric expression from -2147483648 to 2147483647; numeric expressions outside this range are truncated to 32 bits.


was8bit 2019-11-23 00:27

4bit straight out is 4284967294


Timo 2019-11-23 03:26

Never checked if the full range is available. Numbers in NX are “float” values.


nathanielbabiak 2019-11-23 03:38

Yeah, I can peekl and pokel 2^24, which is pretty near the upper integer limit of a float, but much higher and the least significant bits get truncated (as expected for floats)


Timo 2019-11-23 20:28

Ok yes, it's a bit silly that you can PEEKL a value which might not fit into a variable, didn't think about it. I thought the other way around: POKEL/PEEKL were necessary to store and read the highest possible variable values. Could be a POKEF (float), but I preferred the simpler integer format. In any case I should make it clear in the manual.


Mrlegoboy 2019-12-20 18:53

*starts chanting POKE F! POKE F! POKE F!


nathanielbabiak 2022-02-16 01:14 (Edited)

done


Log in to reply.