summaryrefslogtreecommitdiff
path: root/source/z80.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/z80.c')
-rw-r--r--source/z80.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/source/z80.c b/source/z80.c
index 36c5793..d4205c5 100644
--- a/source/z80.c
+++ b/source/z80.c
@@ -31,6 +31,8 @@
#include "z80.h"
#include "z80_private.h"
+#include "stream.h"
+
static const char ident[]="$Id$";
static const char ident_z80_header[]=Z80_H;
static const char ident_z80_private_header[]=Z80_PRIVATE_H;
@@ -328,4 +330,67 @@ const char *Z80Disassemble(Z80 *cpu, Z80Word *pc)
#endif
}
+
+void Z80SaveSnapshot(Z80 *cpu, FILE *fp)
+{
+ STRPUT(fp, cpu->PC);
+ STRPUT(fp, cpu->AF);
+ STRPUT(fp, cpu->BC);
+ STRPUT(fp, cpu->DE);
+ STRPUT(fp, cpu->HL);
+ STRPUT(fp, cpu->AF_);
+ STRPUT(fp, cpu->BC_);
+ STRPUT(fp, cpu->DE_);
+ STRPUT(fp, cpu->HL_);
+ STRPUT(fp, cpu->IX);
+ STRPUT(fp, cpu->IY);
+ STRPUT(fp, cpu->SP);
+ STRPUT(fp, cpu->IFF1);
+ STRPUT(fp, cpu->IFF2);
+ STRPUT(fp, cpu->IM);
+ STRPUT(fp, cpu->I);
+ STRPUT(fp, cpu->R);
+ STRPUT(fp, cpu->R);
+
+ STRPUT(fp, cpu->priv->cycle);
+ STRPUT(fp, cpu->priv->halt);
+ STRPUT(fp, cpu->priv->shift);
+ STRPUT(fp, cpu->priv->raise);
+ STRPUT(fp, cpu->priv->devbyte);
+ STRPUT(fp, cpu->priv->nmi);
+ STRPUT(fp, cpu->priv->callback);
+ STRPUT(fp, cpu->priv->last_cb);
+}
+
+void Z80LoadSnapshot(Z80 *cpu, FILE *fp)
+{
+ STRGET(fp, cpu->PC);
+ STRGET(fp, cpu->AF);
+ STRGET(fp, cpu->BC);
+ STRGET(fp, cpu->DE);
+ STRGET(fp, cpu->HL);
+ STRGET(fp, cpu->AF_);
+ STRGET(fp, cpu->BC_);
+ STRGET(fp, cpu->DE_);
+ STRGET(fp, cpu->HL_);
+ STRGET(fp, cpu->IX);
+ STRGET(fp, cpu->IY);
+ STRGET(fp, cpu->SP);
+ STRGET(fp, cpu->IFF1);
+ STRGET(fp, cpu->IFF2);
+ STRGET(fp, cpu->IM);
+ STRGET(fp, cpu->I);
+ STRGET(fp, cpu->R);
+ STRGET(fp, cpu->R);
+
+ STRGET(fp, cpu->priv->cycle);
+ STRGET(fp, cpu->priv->halt);
+ STRGET(fp, cpu->priv->shift);
+ STRGET(fp, cpu->priv->raise);
+ STRGET(fp, cpu->priv->devbyte);
+ STRGET(fp, cpu->priv->nmi);
+ STRGET(fp, cpu->priv->callback);
+ STRGET(fp, cpu->priv->last_cb);
+}
+
/* END OF FILE */