How To

Persist

0

LowRes Oranges are good 2019-11-12 00:13

What is the nx equivalent of the original lowres PERSIST command?


was8bit 2019-11-12 00:26 (Edited)

Directly speaking, there isn't.. there is no way to automatically make variables PERSIST automatically

Indirectly speaking, there is a block of memory and you use PEEK and POKE to put or get data

"MY" approach is simpler... kinda... i use BG0 and BG1 to hold "data" manually, and use a trick to save and retrieve the backgrounds, making then persist..

I use this trick HERE...
https://lowresnx.inutilis.com/topic.php?id=752

A more complicated tricky method is here...
https://lowresnx.inutilis.com/topic.php?id=597



was8bit 2019-11-12 00:29

By the book... here is PEEK and POKE:

=PEEK

PEEK(a)
Returns the byte value (0-255) at memory address a.

TOUCHSCREEN
PRINT "TOUCH!"
DO
IF PEEK($FF75) AND %10 THEN
PRINT PEEK($FF72),PEEK($FF73)
END IF
WAIT VBL
LOOP
POKE

POKE a,v
Sets the memory at address a to value v. v is a numeric expression from 0 to 255; numeric expressions outside this range are truncated to 8 bits.

POKE $9000,232
POKE $9002,233


was8bit 2019-11-12 00:30

Also by the book, here is NX memory map...

Hardware Reference

Memory Map

$0000 - Cartridge ROM (32 KB)

$8000 - Character Data (4 KB)
$9000 - BG0 Data (2 KB)
$9800 - BG1 Data (2 KB)

$A000 - Working RAM (16 KB)

$E000 - Persistent RAM (4 KB)

$FE00 - Sprite Registers (256 B)
$FF00 - Color Registers (32 B)
$FF20 - Video Registers
$FF40 - Audio Registers
$FF70 - I/O Registers


was8bit 2019-11-12 00:32

So, the place in memory that will PERSIST is from $E000 to $EFFF


was8bit 2019-11-12 00:37

I will try to post an easier example you can use that is somewhat compatable with original lowres :)


was8bit 2019-11-12 01:21 (Edited)

Try looking at this... you can use this to transfer specific bits of data to and from PERISTENT memory and your variables in your game

https://lowresnx.inutilis.com/topic.php?id=754


LowRes Oranges are good 2019-11-12 01:37 (Edited)

So there isn't any really any command. You have to ether use screen memory, or access direct memory with POKE and PEEK. Hmmm now how am I going to implement that into my program? But, thank you for the help anyways.


was8bit 2019-11-12 02:00

Yea, NX is foundationally different...
Maybe tell me what you where wanting to do, maybe i can help figure something out :)


Log in to reply.