Page 1 of 1

SRAM to tackle lack of RAM?

Posted: Mon Mar 21, 2022 5:49 pm
by LIZARDRIVE
Hello,

I have tried different methods to implement undo feature in LIZARDPAINT(.com, please give it a try).

One requires a little bit more RAM than what is available (I store canvas tiles values in u32[8]).
Even after I adapted DMA buffer size as well as sprite init to the bare minimum.
My solution could work with a smaller canvas, but I believe this would be detrimental to user.

So... I wondered if I could use SRAM to store what I need.
I would need to write info there as often as user draws something.
Is it a good idea? Would not it imply a significantly faster battery wear?

Re: SRAM to tackle lack of RAM?

Posted: Mon Mar 21, 2022 6:04 pm
by cero
The battery is not used when the console is on. It's for keeping power when the console is off.

You might also use a command undo queue, instead of storing pixel-level changes.
"plot black at 12,23"
"fill area at 15,5 with green"

You'd just store the inverse commands, taking very little ram.

Re: SRAM to tackle lack of RAM?

Posted: Mon Mar 21, 2022 6:11 pm
by LIZARDRIVE
Thank you cero for your answer, I will try this approach then! :D

I also considered storing actions in a stack... But it was not covering filling properly.
Imagine drawing a black circle with a certain brush size, then filling it with the same black colour. You end up with a totally black hole.
Then how can you tell what was the initial circle state when reverting the filling operation? At least I could not!

Re: SRAM to tackle lack of RAM?

Posted: Tue Mar 22, 2022 8:17 am
by cero
Store a list of the filled pixels. As ranges, very little space taken.

Re: SRAM to tackle lack of RAM?

Posted: Sun Apr 03, 2022 12:52 pm
by cloudstrifer
I want to use sram as ram too.