summaryrefslogtreecommitdiff
path: root/source/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/main.c')
-rw-r--r--source/main.c50
1 files changed, 48 insertions, 2 deletions
diff --git a/source/main.c b/source/main.c
index 5bef185..c196608 100644
--- a/source/main.c
+++ b/source/main.c
@@ -35,10 +35,13 @@
#include "config.h"
#include "textmode.h"
#include "monitor.h"
+#include "snapshot.h"
#include "splashimg_bin.h"
#include "rom_font_bin.h"
+#include "ds81_debug.h"
+
#ifndef DS81_VERSION
#define DS81_VERSION "DEV " __TIME__ "/" __DATE__
#endif
@@ -53,6 +56,12 @@ static const char *main_menu[]=
"Configure",
"Map Joypad to Keys",
"Machine Code Monitor",
+#ifndef DS81_DISABLE_FAT
+ "Save Memory Snapshot",
+ "Load Memory Snapshot",
+ "Save Joypad Mappings",
+ "Load Joypad Mappings",
+#endif
"Cancel",
NULL
};
@@ -64,6 +73,12 @@ typedef enum
MenuConfigure,
MenuMapJoypad,
MenuMonitor,
+#ifndef DS81_DISABLE_FAT
+ MenuSaveSnapshot,
+ MenuLoadSnapshot,
+ MenuSaveMappings,
+ MenuLoadMappings
+#endif
} MenuOpt;
/* ---------------------------------------- IRQ FUNCS
@@ -83,8 +98,9 @@ static void Splash(void)
" "
"Welcome to DS81, a ZX81 emulator for the Ninetendo DS. "
"You can safely ignore this message. I was just bored for half an "
- "hour. "
- "Thanks to Slay Radio for coding fuel."
+ "hour. And no retro item is complete without a side-scroller... "
+ "Thanks to Slay Radio, the Genki Rockets and the High Voltage SID "
+ "Collection for coding fuel."
};
static const char *text[]=
@@ -144,6 +160,7 @@ static void Splash(void)
if (res)
{
ZX81EnableFileSystem(TRUE);
+ SNAP_Enable(TRUE);
FB_Centre("Found a FAT device.",y,COL_WHITE,COL_TRANSPARENT);
y += 8;
@@ -167,6 +184,7 @@ static void Splash(void)
else
{
ZX81EnableFileSystem(FALSE);
+ SNAP_Enable(FALSE);
FB_Centre("Sorry, but you don't have a",y,COL_WHITE,COL_TRANSPARENT);
y += 8;
@@ -374,10 +392,20 @@ int main(int argc, char *argv[])
SK_SetSticky(SK_SHIFT,DS81_Config[DS81_STICKY_SHIFT]);
+ if (DS81_Config[DS81_LOAD_DEFAULT_SNAPSHOT])
+ {
+ SNAP_Load(z80, "AUTO");
+ }
+
while(1)
{
+ static unsigned cycle;
+
SoftKeyEvent ev;
+ DS81_DEBUG_STATUS("PC = %4.4x I = %u", z80->PC, cycle);
+ cycle++;
+
Z80Exec(z80);
while(SK_GetEvent(&ev))
@@ -412,6 +440,24 @@ int main(int argc, char *argv[])
case MenuMonitor:
MachineCodeMonitor(z80);
break;
+
+#ifndef DS81_DISABLE_FAT
+ case MenuSaveSnapshot:
+ SNAP_Save(z80);
+ break;
+
+ case MenuLoadSnapshot:
+ SNAP_Load(z80, NULL);
+ break;
+
+ case MenuSaveMappings:
+ // TODO
+ break;
+
+ case MenuLoadMappings:
+ // TODO
+ break;
+#endif
}
SK_DisplayKeyboard();