Index: firmware/Makefile
===================================================================
--- firmware/Makefile	(revision 46)
+++ firmware/Makefile	(revision 47)
@@ -19,7 +19,7 @@
 MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
 
 MAIN_PRJ = JustStartAtari
-MAIN_SRC = main.c regs.c atari_drive_emulator.c pokey/uart.c hexdump.c printf/printf.c fat/pff_file.c fat/pff.c common/utils.c sd_direct/diskio_mmc.c sd_direct/spi.c sd_direct/mmc.c
+MAIN_SRC = main.c regs.c freeze.c atari_drive_emulator.c pokey/uart.c hexdump.c printf/printf.c fat/pff_file.c fat/pff.c common/utils.c sd_direct/diskio_mmc.c sd_direct/spi.c sd_direct/mmc.c
 #gcc -g -O0 -DLITTLE_ENDIAN test_drive.c atari_drive_emulator.c native/uart.c hexdump.c printf/printf.c fat/pff_file.c fat/pff.c common/utils.c native/diskio_image.c -I. -Iprintf -Ifat -Icommon
 #MAIN_SRC = stuff.c
 MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
Index: firmware/freeze.c
===================================================================
--- firmware/freeze.c	(revision 46)
+++ firmware/freeze.c	(revision 47)
@@ -1,50 +1,67 @@
 #include "freeze.h"
 
-void freeze()
+#include "regs.h"
+
+unsigned char store_portb;
+unsigned volatile int * store_mem;
+unsigned volatile char * store_custom;
+unsigned volatile char * custom_mirror;
+unsigned volatile char * atari_base;
+
+void freeze_init(void * memory)
 {
-	// Copy base 64k to ...
+	store_mem  = memory;
+	store_custom = memory;
 
-	unsigned volatile char * store  = 0xf80000; // SRAM...
-	unsigned volatile char * store2 = 0xfc0000; // custom chips...
+	custom_mirror = (unsigned volatile char *)atari_regmirror;
+	atari_base = (unsigned volatile char *)atari_regbase;
+}
 
-	mem = 0x9c00 + 0x10000;
-	// Copy 1k from 0x$9c00 to sdram
-	// 0x200000; sram
-	// 0x800000; sdram (always use...)
-	for (i=0x0; i!=1024; i++)
-	{
-		store[i] = mem[i];
-	}
-	for (i=0x40; i!=1024; i++)
-	{
-		mem[i] = 0;
-	}
-
+void freeze()
+{
+	int i;
 	// store custom chips
 	store_portb = *atari_portb;
 	{
 		//gtia
-		mem2 = 0x20000;
-		mem3 = 0x10000;
 		for (i=0xd000; i!=0xd01f; i++)
 		{
-			store2[i] = mem2[i];
-			mem3[i] = 0;
+			store_custom[i] = custom_mirror[i];
+			atari_base[i] = 0;
 		}
 		//pokey1/2
 		for (i=0xd200; i!=0xd21f; i++)
 		{
-			store2[i] = mem2[i];
-			mem3[i] = 0;
+			store_custom[i] = custom_mirror[i];
+			atari_base[i] = 0;
 		}
 		//antic
 		for (i=0xd400; i!=0xd40f; i++)
 		{
-			store2[i] = mem2[i];
-			mem3[i] = 0;
+			store_custom[i] = custom_mirror[i];
+			atari_base[i] = 0;
 		}
 	}
 
+	*atari_portb = 0xff;
+
+	// Copy 64k ram to sdram
+	// Atari screen memory...
+	for (i=0x0; i!=0x3400; ++i)
+	{
+		store_mem[i] = atari_base[i];
+	}
+	for (i=0x3600; i!=0x4000; ++i)
+	{
+		store_mem[i] = atari_base[i];
+	}
+
+	//Clear, except dl (first 0x40 bytes)
+	for (i=0x40; i!=1024; i++)
+	{
+		atari_base[i] = 0;
+	}
+
 	// Put custom chips in a safe state
 	// write a display list at 9c00
 	char dl[] = {
@@ -58,9 +75,10 @@
 		0x70,
 		0x41,0x00,0x9c
 	};
-	for (i=0; i!=sizeof(dl); ++i)
+	int end=0x9c00+sizeof(dl);
+	for (i=0x9c00; i!=end; ++i)
 	{
-		mem[i] = dl[i];
+		atari_base[i] = dl[i];
 	}
 
 	// point antic at my display list
@@ -72,7 +90,6 @@
 	*atari_prior = 0x00;
 	*atari_chbase = 0xe0;
 	*atari_dmactl = 0x22;
-	*atari_portb = 0xff;
 	*atari_skctl = 0x3;
 	*atari_chactl = 0x2;
 }
@@ -79,30 +96,34 @@
 
 void restore()
 {
+	int i;
+
 	// Restore memory
-	mem = 0x9c00 + 0x10000;
-	for (i=0x040; i!=1024; i++)
+	for (i=0x0; i!=0x3400; ++i)
 	{
-		mem[i] = store[i];
+		atari_base[i] = store_mem[i];
 	}
+	for (i=0x3600; i!=0x4000; ++i)
+	{
+		atari_base[i] = store_mem[i];
+	}
 
 	// Restore custom chips
 	{
 		//gtia
-		mem3 = 0x10000;
 		for (i=0xd000; i!=0xd01f; i++)
 		{
-			mem3[i] = store2[i];
+			atari_base[i] = store_custom[i];
 		}
 		//pokey1/2
 		for (i=0xd200; i!=0xd21f; i++)
 		{
-			mem3[i] = store2[i];
+			atari_base[i] = store_custom[i];
 		}
 		//antic
 		for (i=0xd400; i!=0xd40f; i++)
 		{
-			mem3[i] = store2[i];
+			atari_base[i] = store_custom[i];
 		}
 	}
 
Index: firmware/freeze.h
===================================================================
--- firmware/freeze.h	(revision 46)
+++ firmware/freeze.h	(revision 47)
@@ -3,6 +3,9 @@
 // Allow us to take over the system
 // NB: CPU should be frozen before calling these!
 
+// Provide 128K of RAM...
+void freeze_init(void * memory);
+
 // Set hardware registers to 'neutral'
 // Back up system ram
 void freeze();
Index: firmware/main.c
===================================================================
--- firmware/main.c	(revision 46)
+++ firmware/main.c	(revision 47)
@@ -43,6 +43,13 @@
 	*reg = val; \
 }
 
+#define BIT_REG_RO(op,mask,shift,name,reg) \
+int get_ ## name() \
+{ \
+	int val = *reg; \
+	return op((val>>shift)&mask); \
+}
+
 BIT_REG(,0x1,0,pause_6502,zpu_out1)
 BIT_REG(,0x1,1,reset_6502,zpu_out1)
 BIT_REG(,0x3f,2,turbo_6502,zpu_out1)
@@ -49,6 +56,11 @@
 BIT_REG(,0x7,8,ram_select,zpu_out1)
 BIT_REG(,0x3f,11,rom_select,zpu_out1)
 
+BIT_REG_RO(,0x1,0,hotkey_softboot,zpu_in1)
+BIT_REG_RO(,0x1,1,hotkey_coldboot,zpu_in1)
+BIT_REG_RO(,0x1,2,hotkey_fileselect,zpu_in1)
+BIT_REG_RO(,0x1,3,hotkey_settings,zpu_in1)
+
 void
 wait_us(int unsigned num)
 {
@@ -78,10 +90,10 @@
 }
 
 void
-coldstart(int clearram)
+reboot(int cold)
 {
 	set_reset_6502(1);
-	if (clearram)
+	if (cold)
 	{
 		clear_64k_ram();
 	}
@@ -129,16 +141,22 @@
 void char_out ( void* p, char c)
 {
 	unsigned char val = toatarichar(c);
-	//*(baseaddr+debug_pos) = val;
-	//++debug_pos;
+	if (debug_pos>0)
+	{
+		*(baseaddr+debug_pos) = val;
+		++debug_pos;
+	}
 }
 
 // Memory usage...
 // 0x410000-0x41FFFF (0xc10000 in zpu space) = directory cache - 64k
+// 0x420000-0x43FFFF (0xc20000 in zpu space) = freeze backup
 
 int main(void)
 {
-	debug_pos = 0;
+	freeze_init((void*)0xc20000); // 128k
+
+	debug_pos = -1;
 	baseaddr = (unsigned char volatile *)(40000 + atari_regbase);
 	set_reset_6502(1);
 	set_turbo_6502(1);
@@ -145,8 +163,6 @@
 
 	init_printf(0, char_out);
 
-	debug_pos = 0;
-
 	// TODO...
 
 	printf("Hello World\n I am an Atari!\n");
@@ -154,36 +170,68 @@
 	if (SimpleFile_OK == dir_init((void *)0xc10000, 65536))
 	{
 		printf("DIR init ok\n");
-		struct SimpleFile * file = alloca(file_struct_size());
-		printf("Opening file\n");
-		if (SimpleFile_OK == file_open_name("GUNPOWDR.ATR",file))
-		{
-			printf("FILE open ok\n");
-			init_drive_emulator();
-
-			set_drive_status(0,file);
-
-			coldstart(1);
-
-			run_drive_emulator();
-		}
-		else
-		{
-			printf("FILE open failed\n");
-		}
+		init_drive_emulator();
+		reboot(1);
+		run_drive_emulator();
 	}
 	else
 	{
 		printf("DIR init failed\n");
 	}
-
-	for(;;) actions();
+	reboot(1);
+	for (;;) actions();
 }
 
+//		struct SimpleFile * file = alloca(file_struct_size());
+//		printf("Opening file\n");
+//		if (SimpleFile_OK == file_open_name("GUNPOWDR.ATR",file))
+//		{
+//			printf("FILE open ok\n");
+//
+//			set_drive_status(0,file);
+//
+//		}
+//		else
+//		{
+//			printf("FILE open failed\n");
+//		}
+
 void actions()
 {
-	// NOP
+	// Show some activity!
 	*atari_colbk = *atari_random;
+	
+	// Hot keys
+	if (get_hotkey_softboot())
+	{
+		reboot(0);	
+	}
+	else if (get_hotkey_coldboot())
+	{
+		reboot(1);	
+	}
+	else if (get_hotkey_settings())
+	{
+		set_pause_6502(1);
+		freeze();
+		debug_pos = 0;	
+		printf("Hello world - settings");
+		debug_pos = -1;
+		wait_us(1000000);
+		restore();
+		set_pause_6502(0);
+	}
+	else if (get_hotkey_fileselect())
+	{
+		set_pause_6502(1);
+		freeze();
+		debug_pos = 0;	
+		printf("Hello world - fileselect");
+		debug_pos = -1;
+		wait_us(1000000);
+		restore();
+		set_pause_6502(0);
+	}
 }
 
 
Index: firmware/regs.h
===================================================================
--- firmware/regs.h	(revision 46)
+++ firmware/regs.h	(revision 47)
@@ -2,6 +2,7 @@
 #define regs_h
 
 #define atari_regbase  0x10000
+#define atari_regmirror  0x20000
 
 extern int volatile * zpu_in1;
 extern int volatile * zpu_in2;
