SRAM to tackle lack of RAM?

SGDK only sub forum

Moderator: Stef

Post Reply
LIZARDRIVE
Interested
Posts: 17
Joined: Fri Feb 01, 2019 10:06 am
Location: On a sunny rock
Contact:

SRAM to tackle lack of RAM?

Post by LIZARDRIVE » Mon Mar 21, 2022 5:49 pm

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?
Brewing "LIZARDPAINT" and "Perlin & Pinpin" for your SEGA Genesis / Megadrive - #pixelart by @iamgunpog
www.lizardrive.com

cero
Very interested
Posts: 340
Joined: Mon Nov 30, 2015 1:55 pm

Re: SRAM to tackle lack of RAM?

Post by cero » Mon Mar 21, 2022 6:04 pm

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.

LIZARDRIVE
Interested
Posts: 17
Joined: Fri Feb 01, 2019 10:06 am
Location: On a sunny rock
Contact:

Re: SRAM to tackle lack of RAM?

Post by LIZARDRIVE » Mon Mar 21, 2022 6:11 pm

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!
Brewing "LIZARDPAINT" and "Perlin & Pinpin" for your SEGA Genesis / Megadrive - #pixelart by @iamgunpog
www.lizardrive.com

cero
Very interested
Posts: 340
Joined: Mon Nov 30, 2015 1:55 pm

Re: SRAM to tackle lack of RAM?

Post by cero » Tue Mar 22, 2022 8:17 am

Store a list of the filled pixels. As ranges, very little space taken.

cloudstrifer
Very interested
Posts: 118
Joined: Mon Feb 19, 2018 7:31 pm

Re: SRAM to tackle lack of RAM?

Post by cloudstrifer » Sun Apr 03, 2022 12:52 pm

I want to use sram as ram too.

Post Reply