Example

Peek or Poke Floating Point Numbers to Memory

4

nathanielbabiak 2021-07-14 03:04 (Edited)

PEEKF and POKEF read and write 32-bit floating-point values to a four-byte memory address (similar to how PEEKL and POKEL write to four bytes of memory).

You can tap or click on-screen to randomize a new value.

I needed these functions for my KSP knock-off, figured I'd share them with everybody in case they're useful.

Note that the bit storage format differs from IEEE 754 slightly. The exponent's bits are stored byte-aligned for speed, and the functions probably won't work well with INF, -INF, and -0.

Updated to eliminate both bit-iteration loops. (It's weird the optimizations you can make in basic!)

PEEKFnPOKEF 1.0.nx | Open in app
2021-07-14 03:04

was8bit 2021-07-14 04:05

I've ur technical stuff... if I had spare time I would be all over your stuff :D


nathanielbabiak 2021-07-16 01:16 (Edited)

I've updated the post title for ease of searching - Timo could you enable search-by-body-text rather than only search-by-heading? It would improve the forum search too!


Log in to reply.