At the moment, we have 6 native functions to peek and poke the memory :
v=peek(addr, [n] ) you also have v=@addr that is equivalent to peek(addr,1) and peek(addr)
v=peek2(addr, [n] ) and v=%addr
v=peek4(addr, [n] ) and v=$addr
poke ( addr, [value,] [...] )
poke2( addr, [value,] [...] )
poke4( addr, [value,] [...] )
What could be a good extension of this ? The problem is not really the coding part, but rather coming up with conventions that fit well withing the pico8 universe...
poke3 seems like a simple addition, but what three bytes should be copied from the value ?
Pico8 is a little endian universe
XXXX read from value
..... ignored
[ pico8 numeric value ]
[fraction ] [integer ]
Byte0 Byte1 Byte2 Byte3
poke ..... ..... XXXXX .....
poke2 ..... ..... XXXXX XXXXX
poke3 ????? XXXXX XXXXX ?????
poke4 XXXXX XXXXX XXXXX XXXXX |
Since our standard pico8 numbers are 16.16 bits, we can't go further, poke5 wouldn't make sense.





3 comments