Re: [cc65] Lightly Off topic: Need some advice on saving data

From: Oliver Schmidt <ol.sc1web.de>
Date: 2012-01-27 21:47:58
Hi Payton,

> I need some advice on saving data for my game.  I would like to use cbm_save
> to simply save a block of memory containing the state of the game to disk,
> basically just a memory dump.  I think I should be safe to simply save
> everything in my RAM segment.  My question is whether or not this will
> include the software stack so that after doing a cbm_load everything will be
> kosher and ready to go?

This just won't work out that way. The "internal state" of your
program consists of much more than one (or more) segments. With the
software stack you already detected one additional aspect - which by
the way would be the only one you might not want to save. Anyway there
are things like the heap and the zeropage content. But even if you
could take of all of this you'd still have program state that lives
outside the program - i.e. in the OS. When a c65 program is run then
quite some initialization is done which you as C programmer don't have
control over or access to. From my perspective it is basically
impossible to try to "retrofit" some saved state on this already
partly initialized state.

What seems rather plausible to me is to place all "application-level"
state in fields of a (large) struct. Then you can save / restore that
struct.

Regards,
Oliver
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Jan 27 21:48:07 2012

This archive was generated by hypermail 2.1.8 : 2012-01-27 21:48:11 CET