summaryrefslogtreecommitdiff
path: root/source/zx81.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/zx81.c')
-rw-r--r--source/zx81.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/source/zx81.c b/source/zx81.c
index c0af981..a8620c3 100644
--- a/source/zx81.c
+++ b/source/zx81.c
@@ -31,10 +31,14 @@
#include "zx81.h"
#include "gui.h"
+#include "stream.h"
+
#include "config.h"
#include "zx81_bin.h"
+#include "ds81_debug.h"
+
#ifndef TRUE
#define TRUE 1
#endif
@@ -77,6 +81,9 @@ static int hires=FALSE;
static int hires_dfile;
static int last_I;
+static unsigned prev_lk1;
+static unsigned prev_lk2;
+
#define SCR_W 256
#define SCR_H 192
#define TXT_W 32
@@ -313,7 +320,7 @@ static FILE *OpenTapeFile(Z80Word addr, int *cancelled)
if (!(fp = fopen(fn,"rb")))
{
- char full_fn[FILENAME_MAX+11] = "/ZX81SNAP/";
+ char full_fn[FILENAME_MAX] = DEFAULT_SNAPDIR;
strcat(full_fn,fn);
fp = fopen(full_fn,"rb");
@@ -603,7 +610,6 @@ static void FindHiresDFILE(void)
*/
static void ZX81HouseKeeping(Z80 *z80)
{
- static unsigned prev_lk1,prev_lk2;
unsigned row;
unsigned lastk1;
unsigned lastk2;
@@ -1073,4 +1079,34 @@ void ZX81Reconfigure(void)
}
+void ZX81SaveSnapshot(FILE *fp)
+{
+ STRPUT(fp, mem);
+ STRPUT(fp, matrix);
+ STRPUT(fp, waitkey);
+ STRPUT(fp, started);
+ STRPUT(fp, RAMBOT);
+ STRPUT(fp, RAMTOP);
+ STRPUT(fp, prev_lk1);
+ STRPUT(fp, prev_lk2);
+}
+
+
+void ZX81LoadSnapshot(FILE *fp)
+{
+ STRGET(fp, mem);
+ STRGET(fp, matrix);
+ STRGET(fp, waitkey);
+ STRGET(fp, started);
+ STRGET(fp, RAMBOT);
+ STRGET(fp, RAMTOP);
+ STRGET(fp, prev_lk1);
+ STRGET(fp, prev_lk2);
+
+ /* Reset last_I to force hi/lo res detection
+ */
+ last_I = 0;
+}
+
+
/* END OF FILE */