nousername010 2020-12-10 05:14
Want to edit your ROM data with overkill programs? Then this is the tool for you.
-POKE, POKEW, and POKEL
-Edit from ROM 0 to 15
-Up to 16 KB
This was made with the leftovers of the "Persistent RAM Editor" idea of mine. It didn't work, but i did not want to leave the graphics to waste.
Timo 2020-12-10 12:54
PEEKL and POKEL won't work correctly because of a problem in LowRes NX: All number variables are stored as floats. Very large 32-bit numbers don't fit into float, so values will be incorrect.
I don't have a solution for this though...
GAMELEGEND 2020-12-10 13:11 (Edited)
why are they all stored as floats
nousername010 2020-12-10 13:12
I didn't know that... thanks for telling!
Hm... I'll try to experiment with it by splitting the value into two separate values of 16 bits each and use POKEW/PEEKW for each. If it works well, I'll update it :)
nathanielbabiak 2020-12-10 21:44 (Edited)
LowRes stores all numeric varables in single-precision (32-bit) floating point format, even whole numbers. When encoding long (32-bit) integers as floats, only the most significant 24 bits are recorded, and any less significant bits are reset to zero. It's explained here: https://en.wikipedia.org/wiki/Single-precision_floating-point_format#Precision_limitations_on_integer_values
So you can have big numbers using bits 31 through 8, but you loose-out on those last 8 bits of digits. I personally just stick to using only the lowest 24 bits if using long integers.
It confuses me that this (amazing!) retro-style fantasy console is even able to handle 32-bit memory operations. (I appreciate that 24 bit "medium" integers let me "cheat" with some algorithms, and "free" floating point math makes things so much faster!)
At some point in the future, maybe Timo will change the LowRes source code, and replace every "float" with "double"... So that long integers could be stored inside doubles without truncation? (That might lead to a new form of "cheating" though!)
nousername010 2020-12-11 01:50
That is really interesting info :)
That said, I think the replacement of the "float" with a "double" would be best since there's, at least for now, one system variable that uses more than 24 bits: TIMER.
nathanielbabiak 2020-12-11 03:19 (Edited)
Per the manual entry for timer, "the value wraps to 0 when 5184000 is reached, which is about 24 hours." Also, ln(5184000)/ln(2)=22.3, meaning TIMER uses 23 bits, not more.
If TIMER were wrapped at 16 bits instead, it would go 18.2 minutes (2^16/60/60). It could be forced to run for 15 minutes if it wrapped around at 54000...
nousername010 2020-12-11 03:39
Ah, I see. I'm not very good with binary and hexadecimal math, so thanks for correcting me.
nathanielbabiak 2020-12-11 03:49
No worries, the binary stuff is crazy hard. :-)
nathanielbabiak 2020-12-20 03:43 (Edited)
As a follow-up to my earlier comment (just in case Timo ever reads this)... please Please PLEASE don't take away
POKEL since I've found a new use for the raster interrupt, and I really need it to do something amazing.
Timo 2020-12-20 08:11
Don’t worry, POKEL will stay. I added it mainly for writing large numbers from variables to the memory (highscores etc.), so it does its job.