diff -rN -u old-xroar-fast/Makefile new-xroar-fast/Makefile
--- old-xroar-fast/Makefile	2008-04-24 18:13:14.000000000 +0100
+++ new-xroar-fast/Makefile	2008-04-24 18:13:14.000000000 +0100
@@ -3,7 +3,7 @@
 
 -include config.mak
 
-VERSION := 0.21
+VERSION := 0.21f1
 
 .PHONY: all usage gp32 windows32
 
diff -rN -u old-xroar-fast/events.c new-xroar-fast/events.c
--- old-xroar-fast/events.c	2008-04-24 18:13:14.000000000 +0100
+++ new-xroar-fast/events.c	2008-04-24 18:13:14.000000000 +0100
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 
 #include "events.h"
+#include "xroar.h"
 
 event_t *event_new(void) {
 	event_t *new = malloc(sizeof(event_t));
@@ -35,7 +36,6 @@
 	event->at_cycle = 0;
 	event->dispatch = NULL;
 	event->queued = 0;
-	event->list = NULL;
 	event->next = NULL;
 }
 
@@ -44,12 +44,12 @@
 	free(event);
 }
 
-void event_queue(event_t **list, event_t *event) {
+void event_queue_fast(event_t *event) {
 	event_t **entry;
 	if (event->queued)
 		event_dequeue(event);
 	event->queued = 1;
-	for (entry = list; *entry; entry = &((*entry)->next)) {
+	for (entry = &MACHINE_EVENT_LIST; *entry; entry = &((*entry)->next)) {
 		if ((int)((*entry)->at_cycle - event->at_cycle) > 0) {
 			event->next = *entry;
 			*entry = event;
@@ -57,16 +57,13 @@
 		}
 	}
 	*entry = event;
-	event->list = list;
 	event->next = NULL;
 }
 
 void event_dequeue(event_t *event) {
-	event_t **list = event->list;
+	event_t **list = &MACHINE_EVENT_LIST;
 	event_t **entry;
 	event->queued = 0;
-	if (list == NULL)
-		return;
 	if (*list == event) {
 		*list = event->next;
 		return;
diff -rN -u old-xroar-fast/events.h new-xroar-fast/events.h
--- old-xroar-fast/events.h	2008-04-24 18:13:14.000000000 +0100
+++ new-xroar-fast/events.h	2008-04-24 18:13:14.000000000 +0100
@@ -11,7 +11,6 @@
 	Cycle at_cycle;
 	void (*dispatch)(void);
 	int queued;
-	event_t **list;
 	event_t *next;
 };
 
@@ -28,8 +27,10 @@
 event_t *event_new(void);
 void event_init(event_t *event);  /* for static declarations */
 
+#define event_queue(list,event) event_queue_fast(event)
+
 void event_free(event_t *event);
-void event_queue(event_t **list, event_t *event);
+void event_queue_fast(event_t *event);
 void event_dequeue(event_t *event);
 
 #endif  /* __EVENT_H__ */
diff -rN -u old-xroar-fast/m6809.c new-xroar-fast/m6809.c
--- old-xroar-fast/m6809.c	2008-04-24 18:13:14.000000000 +0100
+++ new-xroar-fast/m6809.c	2008-04-24 18:13:14.000000000 +0100
@@ -373,9 +373,9 @@
 }
 
 void m6809_cycle(Cycle until) {
-	unsigned int op;
-	unsigned int addr;
-	unsigned int result;
+	__label__ flow_instruction_page_2_label;
+	__label__ flow_instruction_page_3_label;
+	__label__ done_m6809_cycle;
 
 	/* If nested functions are available, we can nest ea_indexed() and
 	 * copy registers to local variables, allowing for better
@@ -413,20 +413,22 @@
 
 		case flow_reset_check_halt:
 			if (halt) {
-				TAKEN_CYCLES(1);
-				continue;
+				while ((int)(m6809_current_cycle - until) < 0)
+					TAKEN_CYCLES(1);
+				goto done_m6809_cycle;
 			}
 			reg_pc = fetch_word(0xfffe);
 			TAKEN_CYCLES(1);
 			cpu_state = flow_label_a;
-			continue;
+			/* fall through */
 
 		case flow_label_a:
 			if (halt) {
-				TAKEN_CYCLES(1);
-				continue;
+				while ((int)(m6809_current_cycle - until) < 0)
+					TAKEN_CYCLES(1);
+				goto done_m6809_cycle;
 			}
-			cpu_state = flow_label_b;
+			/* cpu_state = flow_label_b; */
 			/* fall through */
 
 		case flow_label_b:
@@ -475,12 +477,14 @@
 				continue;
 			}
 			cpu_state = flow_cwai_check_halt;
-			continue;
+			/* fall through */
 
 		case flow_cwai_check_halt:
 			TAKEN_CYCLES(1);
 			if (halt) {
-				continue;
+				while ((int)(m6809_current_cycle - until) < 0)
+					TAKEN_CYCLES(1);
+				goto done_m6809_cycle;
 			}
 			cpu_state = flow_dispatch_irq;
 			continue;
@@ -492,17 +496,29 @@
 				continue;
 			}
 			cpu_state = flow_sync_check_halt;
-			continue;
+			/* fall through */
 
 		case flow_sync_check_halt:
-			TAKEN_CYCLES(1);
-			if (halt) {
-				continue;
-			}
+			do {
+				TAKEN_CYCLES(1);
+			} while ((int)(m6809_current_cycle - until) < 0);
+			if (halt)
+				goto done_m6809_cycle;
 			cpu_state = flow_sync;
-			continue;
+			goto done_m6809_cycle;
+
+		case flow_instruction_page_2:
+			goto flow_instruction_page_2_label;
+		case flow_instruction_page_3:
+			goto flow_instruction_page_3_label;
 
 		case flow_next_instruction:
+
+			while ((int)(m6809_current_cycle - until) < 0 && !halt) {
+			unsigned int op;
+			unsigned int addr;
+			unsigned int result;
+
 			/* Fetch op-code and process */
 			BYTE_IMMEDIATE(0,op);
 			switch (op) {
@@ -543,12 +559,10 @@
 			case 0x0F: OP_CLR(BYTE_DIRECT); break;
 			/* 0x10 Page 2 */
 			case 0x10:
-				   cpu_state = flow_instruction_page_2;
-				   continue;
+				   goto flow_instruction_page_2_label;
 			/* 0x11 Page 3 */
 			case 0x11:
-				   cpu_state = flow_instruction_page_3;
-				   continue;
+				   goto flow_instruction_page_3_label;
 			/* 0x12 NOP inherent */
 			case 0x12: peek_byte(reg_pc); break;
 			/* 0x13 SYNC inherent */
@@ -557,7 +571,7 @@
 				TAKEN_CYCLES(1);
 				TRACE_PRINT(reg_cc, reg_a, reg_b, reg_dp, reg_x, reg_y, reg_u, reg_s);
 				cpu_state = flow_sync;
-				continue;
+				goto done_m6809_cycle;
 			/* 0x16 LBRA relative */
 			case 0x16: BRANCHL(1); break;
 			/* 0x17 LBSR relative */
@@ -782,7 +796,7 @@
 				TAKEN_CYCLES(1);
 				TRACE_PRINT(reg_cc, reg_a, reg_b, reg_dp, reg_x, reg_y, reg_u, reg_s);
 				cpu_state = flow_dispatch_irq;
-				continue;
+				goto done_m6809_cycle;
 			} break;
 			/* 0x3D MUL inherent */
 			case 0x3d: {
@@ -1173,17 +1187,15 @@
 			default: TAKEN_CYCLES(1); break;
 			}
 			TRACE_PRINT(reg_cc, reg_a, reg_b, reg_dp, reg_x, reg_y, reg_u, reg_s);
-			cpu_state = flow_label_a;
 			continue;
 
-		case flow_instruction_page_2:
+flow_instruction_page_2_label:
 			BYTE_IMMEDIATE(0,op);
 			switch (op) {
 			/* 0x10, 0x11 Page 2 */
 			case 0x10:
 			case 0x11:
-				cpu_state = flow_instruction_page_2;
-				continue;
+				goto flow_instruction_page_2_label;
 			/* 0x1021 LBRN relative */
 			case 0x21: BRANCHL(0); break;
 			/* 0x1022 LBHI relative */
@@ -1268,17 +1280,15 @@
 			default: TAKEN_CYCLES(1); break;
 			}
 			TRACE_PRINT(reg_cc, reg_a, reg_b, reg_dp, reg_x, reg_y, reg_u, reg_s);
-			cpu_state = flow_label_a;
 			continue;
 
-		case flow_instruction_page_3:
+flow_instruction_page_3_label:
 			BYTE_IMMEDIATE(0,op);
 			switch (op) {
 			/* 0x10, 0x11 Page 3 */
 			case 0x10:
 			case 0x11:
-				cpu_state = flow_instruction_page_3;
-				continue;
+				goto flow_instruction_page_3_label;
 			/* 0x113F SWI3 inherent */
 			case 0x3f:
 				peek_byte(reg_pc);
@@ -1305,12 +1315,15 @@
 			default: TAKEN_CYCLES(1); break;
 			}
 			TRACE_PRINT(reg_cc, reg_a, reg_b, reg_dp, reg_x, reg_y, reg_u, reg_s);
-			cpu_state = flow_label_a;
 			continue;
 
+			}
+			cpu_state = flow_label_a;
+
 		}
 	}
 
+done_m6809_cycle:
 	/* Record changed register values if we kept them local. */
 #ifdef HAVE_C_NESTED_FUNCTIONS
 	register_cc = reg_cc;
diff -rN -u old-xroar-fast/m6809.h new-xroar-fast/m6809.h
--- old-xroar-fast/m6809.h	2008-04-24 18:13:14.000000000 +0100
+++ new-xroar-fast/m6809.h	2008-04-24 18:13:14.000000000 +0100
@@ -7,10 +7,8 @@
 #define __M6809_H__
 
 #include "types.h"
-#include "events.h"
 #include "sam.h"
 #include "machine.h"
-#include "xroar.h"
 
 #define M6809_COMPAT_STATE_NORMAL (0)
 #define M6809_COMPAT_STATE_SYNC   (1)
@@ -51,9 +49,6 @@
 #define m6809_nvma_cycles(c) current_cycle += ((c) * sam_topaddr_cycles)
 
 /* Ensure all outside events are complete up to current cycle */
-#define m6809_sync() do { \
-		while (EVENT_PENDING(MACHINE_EVENT_LIST)) \
-			DISPATCH_NEXT_EVENT(MACHINE_EVENT_LIST); \
-	} while (0)
+#define m6809_sync()
 
 #endif  /* __M6809_H__ */
diff -rN -u old-xroar-fast/machine.c new-xroar-fast/machine.c
--- old-xroar-fast/machine.c	2008-04-24 18:13:14.000000000 +0100
+++ new-xroar-fast/machine.c	2008-04-24 18:13:14.000000000 +0100
@@ -45,37 +45,24 @@
 };
 
 MachineConfig machine_defaults[NUM_MACHINE_TYPES] = {
-	{ ARCH_DRAGON32, ROMSET_DRAGON32, KEYMAP_DRAGON, TV_PAL,  CROSS_COLOUR_OFF,  32, DOS_DRAGONDOS, NULL, NULL, NULL, NULL },
-	{ ARCH_DRAGON64, ROMSET_DRAGON64, KEYMAP_DRAGON, TV_PAL,  CROSS_COLOUR_OFF,  64, DOS_DRAGONDOS, NULL, NULL, NULL, NULL },
-	{ ARCH_DRAGON64, ROMSET_DRAGON64, KEYMAP_DRAGON, TV_NTSC, CROSS_COLOUR_KBRW, 64, DOS_DRAGONDOS, NULL, NULL, NULL, NULL },
-	{ ARCH_COCO,     ROMSET_COCO,     KEYMAP_COCO,   TV_PAL,  CROSS_COLOUR_OFF,  64, DOS_RSDOS,     NULL, NULL, NULL, NULL },
-	{ ARCH_COCO,     ROMSET_COCO,     KEYMAP_COCO,   TV_NTSC, CROSS_COLOUR_KBRW, 64, DOS_RSDOS,     NULL, NULL, NULL, NULL }
+	{ ARCH_DRAGON32, ROMSET_DRAGON32, KEYMAP_DRAGON, TV_PAL,  CROSS_COLOUR_OFF,  DOS_DRAGONDOS, NULL, NULL, NULL, NULL },
+	{ ARCH_DRAGON64, ROMSET_DRAGON64, KEYMAP_DRAGON, TV_PAL,  CROSS_COLOUR_OFF,  DOS_DRAGONDOS, NULL, NULL, NULL, NULL },
+	{ ARCH_DRAGON64, ROMSET_DRAGON64, KEYMAP_DRAGON, TV_NTSC, CROSS_COLOUR_KBRW, DOS_DRAGONDOS, NULL, NULL, NULL, NULL },
+	{ ARCH_COCO,     ROMSET_COCO,     KEYMAP_COCO,   TV_PAL,  CROSS_COLOUR_OFF,  DOS_RSDOS,     NULL, NULL, NULL, NULL },
+	{ ARCH_COCO,     ROMSET_COCO,     KEYMAP_COCO,   TV_NTSC, CROSS_COLOUR_KBRW, DOS_RSDOS,     NULL, NULL, NULL, NULL }
 };
 
-static struct {
-	const char *option;
-	const char *description;
-	int value;
-} cross_colour_options[NUM_CROSS_COLOUR_RENDERERS] = {
-	{ "simple", "four colour palette", CROSS_COLOUR_SIMPLE },
 #ifndef FAST_VDG
-	{ "5bit",   "5-bit lookup table",  CROSS_COLOUR_5BIT   },
-#endif
-};
-#ifdef FAST_VDG
-int cross_colour_renderer = CROSS_COLOUR_SIMPLE;
-#else
 int cross_colour_renderer = CROSS_COLOUR_5BIT;
 #endif
 
 int requested_machine = 1;
 MachineConfig requested_config = {
-	ANY_AUTO, ANY_AUTO, ANY_AUTO, ANY_AUTO, ANY_AUTO, ANY_AUTO, ANY_AUTO, NULL, NULL, NULL, NULL
+	ANY_AUTO, ANY_AUTO, ANY_AUTO, ANY_AUTO, ANY_AUTO, ANY_AUTO, NULL, NULL, NULL, NULL
 };
 int running_machine;
 MachineConfig running_config;
 
-unsigned int machine_ram_size = 0x10000;  /* RAM in bytes, up to 64K */
 uint8_t ram0[0x10000];
 uint8_t rom0[0x8000];
 uint8_t rom1[0x8000];
@@ -140,7 +127,6 @@
 	puts("  -pal                  emulate PAL (50Hz) video");
 	puts("  -ntsc                 emulate NTSC (60Hz) video");
 	puts("  -ccr RENDERER         specify cross-colour renderer (-ccr help for list)");
-	puts("  -ram KBYTES           specify amount of RAM in K");
 #ifndef FAST_SOUND
 	puts("  -fast-sound           faster but less accurate sound");
 #endif
@@ -195,26 +181,10 @@
 		} else if (!strcmp(argv[i], "-nodos")) {
 			requested_config.dos_type = DOS_NONE;
 			requested_config.dos_rom = NULL;
-		} else if (!strcmp(argv[i], "-ram") && i+1<argc) {
-			requested_config.ram = strtol(argv[++i], NULL, 0);
 		} else if (!strcmp(argv[i], "-pal")) {
 			requested_config.tv_standard = TV_PAL;
 		} else if (!strcmp(argv[i], "-ntsc")) {
 			requested_config.tv_standard = TV_NTSC;
-		} else if (!strcmp(argv[i], "-ccr") && i+1<argc) {
-			int j;
-			i++;
-			if (!strcmp(argv[i], "help")) {
-				for (j = 0; j < NUM_CROSS_COLOUR_RENDERERS; j++) {
-					printf("\t%-10s%s\n", cross_colour_options[j].option, cross_colour_options[j].description);
-				}
-				exit(0);
-			}
-			for (j = 0; j < NUM_CROSS_COLOUR_RENDERERS; j++) {
-				if (!strcmp(argv[i], cross_colour_options[j].option)) {
-					cross_colour_renderer = cross_colour_options[j].value;
-				}
-			}
 		}
 #ifndef FAST_SOUND
 		else if (!strcmp(argv[i], "-fast-sound")) {
@@ -303,8 +273,6 @@
 			running_config.tv_standard = defaults->tv_standard % NUM_TV_STANDARDS;
 		if (running_config.cross_colour_phase == ANY_AUTO)
 			running_config.cross_colour_phase = defaults->cross_colour_phase % NUM_CROSS_COLOUR_PHASES;
-		if (running_config.ram == ANY_AUTO)
-			running_config.ram = defaults->ram;
 		if (running_config.dos_type == ANY_AUTO)
 			running_config.dos_type = defaults->dos_type % NUM_DOS_TYPES;
 		/* Load appropriate ROMs */
@@ -334,7 +302,6 @@
 		keyboard_set_keymap(running_config.keymap);
 		/* Configure RAM */
 		memset(ram0, 0x00, sizeof(ram0));
-		machine_set_ram_size(running_config.ram * 1024);
 	}
 	if (IS_DRAGON64)
 		PIA1.b.port_input |= (1<<2);
@@ -361,7 +328,6 @@
 	requested_config.keymap = ANY_AUTO;
 	requested_config.tv_standard = ANY_AUTO;
 	requested_config.cross_colour_phase = ANY_AUTO;
-	requested_config.ram = ANY_AUTO;
 	requested_config.dos_type = ANY_AUTO;
 	requested_config.bas_rom = NULL;
 	requested_config.extbas_rom = NULL;
@@ -369,15 +335,6 @@
 	requested_config.dos_rom = NULL;
 }
 
-/* Set RAM size */
-void machine_set_ram_size(unsigned int size) {
-	if (size > 0x10000)
-		size = 0x10000;
-	machine_ram_size = size;
-	if (size < 0x10000)
-		memset(ram0 + size, 0x7e, 0x10000 - size);
-}
-
 /**************************************************************************/
 
 /* load_rom searches a path (specified in ROMPATH macro at compile time) to
diff -rN -u old-xroar-fast/machine.h new-xroar-fast/machine.h
--- old-xroar-fast/machine.h	2008-04-24 18:13:14.000000000 +0100
+++ new-xroar-fast/machine.h	2008-04-24 18:13:14.000000000 +0100
@@ -59,12 +59,13 @@
  * or with a 5-bit lookup table */
 #ifdef FAST_VDG
 # define NUM_CROSS_COLOUR_RENDERERS (1)
+# define cross_colour_renderer (0)
 #else
 # define NUM_CROSS_COLOUR_RENDERERS (2)
+extern int cross_colour_renderer;
 #endif
 #define CROSS_COLOUR_SIMPLE (0)
 #define CROSS_COLOUR_5BIT   (1)
-extern int cross_colour_renderer;
 
 /* NTSC cross-colour can either be switched off, or sychronised to one
  * of two phases (a real CoCo does not emit a colour burst in high resolution
@@ -80,7 +81,6 @@
 	int keymap;
 	int tv_standard;
 	int cross_colour_phase;
-	int ram;
 	int dos_type;
 	const char *bas_rom;
 	const char *extbas_rom;
@@ -96,7 +96,6 @@
 extern MachineConfig requested_config;
 extern MachineConfig running_config;
 
-extern unsigned int machine_ram_size;  /* RAM in bytes, up to 64K */
 extern uint8_t ram0[0x10000];
 extern uint8_t rom0[0x8000];
 extern uint8_t rom1[0x8000];
@@ -113,6 +112,4 @@
 
 void machine_clear_requested_config(void);
 
-void machine_set_ram_size(unsigned int size);
-
 #endif  /* __MACHINE_H__ */
diff -rN -u old-xroar-fast/sam.c new-xroar-fast/sam.c
--- old-xroar-fast/sam.c	2008-04-24 18:13:14.000000000 +0100
+++ new-xroar-fast/sam.c	2008-04-24 18:13:15.000000000 +0100
@@ -32,18 +32,17 @@
 
 static uint8_t *selected_rom;
 static unsigned int map_type;
-static unsigned int ram_page_bit;
 
 unsigned int sam_register;
 
-static unsigned int sam_vdg_base;
+unsigned int sam_vdg_base;
 unsigned int sam_vdg_mode;
 unsigned int sam_vdg_address;
 static unsigned int sam_vdg_mod_xdiv;
 static unsigned int sam_vdg_mod_ydiv;
 unsigned int sam_vdg_mod_clear;
-static unsigned int sam_vdg_xcount;
-static unsigned int sam_vdg_ycount;
+unsigned int sam_vdg_xcount;
+unsigned int sam_vdg_ycount;
 #ifdef VARIABLE_MPU_RATE
 unsigned int sam_topaddr_cycles;
 #endif
@@ -52,21 +51,7 @@
 static unsigned int vdg_mod_ydiv[8] = { 12, 1, 3, 1, 2, 1, 1, 1 };
 static unsigned int vdg_mod_clear[8] = { ~30, ~14, ~30, ~14, ~30, ~14, ~30, ~0 };
 
-/* SAM Data Sheet,
- *   Figure 6 - Signal routing for address multiplexer */
-static unsigned int ram_row_masks[4] = { 0x007f, 0x007f, 0x00ff, 0x00ff };
-static int ram_col_shifts[4] = { 2, 1, 0, 0 };
-static unsigned int ram_col_masks[4] = { 0x3f00, 0x7f00, 0xff00, 0xff00 };
-static unsigned int ram_row_mask;
-static unsigned int ram_col_shift;
-static unsigned int ram_col_mask;
-static unsigned int ram_ras1;
-#define VRAM_TRANSLATE(a) ( \
-		((a << ram_col_shift) & ram_col_mask) \
-		| (a & ram_row_mask) \
-		| (!(a & 0x4000) ? ram_ras1 : 0) \
-	)
-#define RAM_TRANSLATE(a) (VRAM_TRANSLATE(a) | ram_page_bit)
+#define VRAM_TRANSLATE(a) (a)
 
 static void update_from_register(void);
 
@@ -79,25 +64,17 @@
 }
 
 unsigned int sam_read_byte(unsigned int addr) {
-	while (EVENT_PENDING(MACHINE_EVENT_LIST))
-		DISPATCH_NEXT_EVENT(MACHINE_EVENT_LIST);
 	addr &= 0xffff;
+	current_cycle += CPU_SLOW_DIVISOR;
 	if (addr < 0x8000 || (map_type && addr < 0xff00)) {
 		/* RAM access */
-		unsigned int ram_addr = RAM_TRANSLATE(addr);
-		current_cycle += CPU_SLOW_DIVISOR;
-		if (ram_addr < machine_ram_size)
-			return ram0[ram_addr];
-		return 0x7e;
+		return ram0[addr];
 	}
 	if (addr < 0xff00) {
 		/* ROM access */
-		current_cycle += sam_topaddr_cycles;
 		return selected_rom[addr-0x8000];
 	}
 	if (addr < 0xff20) {
-		/* PIA0 */
-		current_cycle += CPU_SLOW_DIVISOR;
 		if (IS_COCO) {
 			return mc6821_read(&PIA0, addr & 3);
 		} else {
@@ -111,7 +88,6 @@
 		}
 		return 0x7e;
 	}
-	current_cycle += sam_topaddr_cycles;
 	if (addr < 0xff40) {
 		return mc6821_read(&PIA1, addr & 3);
 	}
@@ -138,29 +114,18 @@
 }
 
 void sam_store_byte(unsigned int addr, unsigned int octet) {
-	while (EVENT_PENDING(MACHINE_EVENT_LIST))
-		DISPATCH_NEXT_EVENT(MACHINE_EVENT_LIST);
 	addr &= 0xffff;
+	current_cycle += CPU_SLOW_DIVISOR;
 	if (addr < 0x8000 || (map_type && addr < 0xff00)) {
 		/* RAM access */
-		unsigned int ram_addr = RAM_TRANSLATE(addr);
-		current_cycle += CPU_SLOW_DIVISOR;
-		if (IS_DRAGON32 && addr >= 0x8000 && machine_ram_size <= 0x8000) {
-			if (ram_addr < machine_ram_size)
-				ram0[ram_addr] = rom0[addr & 0x7fff];
-			return;
-		}
-		if (ram_addr < machine_ram_size)
-			ram0[ram_addr] = octet;
+		ram0[addr] = octet;
 		return;
 	}
 	if (addr < 0xff00) {
 		/* ROM access */
-		current_cycle += sam_topaddr_cycles;
 		return;
 	}
 	if (addr < 0xff20) {
-		current_cycle += CPU_SLOW_DIVISOR;
 		if (IS_COCO) {
 			mc6821_write(&PIA0, addr & 3, octet);
 		} else {
@@ -174,7 +139,6 @@
 		}
 		return;
 	}
-	current_cycle += sam_topaddr_cycles;
 	if (addr < 0xff40) {
 		mc6821_write(&PIA1, addr & 3, octet);
 		if ((addr & 3) == 2 && IS_DRAGON64 && !map_type) {
@@ -212,12 +176,6 @@
 	}
 }
 
-void sam_vdg_fsync(void) {
-	sam_vdg_address = sam_vdg_base;
-	sam_vdg_xcount = 0;
-	sam_vdg_ycount = 0;
-}
-
 uint8_t *sam_vdg_bytes(int number) {
 	unsigned int addr = VRAM_TRANSLATE(sam_vdg_address);
 	unsigned int b15_5 = sam_vdg_address & ~0x1f;
@@ -250,28 +208,12 @@
 }
 
 static void update_from_register(void) {
-	int memory_size = (sam_register >> 13) & 3;
 	sam_vdg_mode = sam_register & 0x0007;
 	sam_vdg_base = (sam_register & 0x03f8) << 6;
 	sam_vdg_mod_xdiv = vdg_mod_xdiv[sam_vdg_mode];
 	sam_vdg_mod_ydiv = vdg_mod_ydiv[sam_vdg_mode];
 	sam_vdg_mod_clear = vdg_mod_clear[sam_vdg_mode];
 
-	ram_row_mask = ram_row_masks[memory_size];
-	ram_col_shift = ram_col_shifts[memory_size];
-	ram_col_mask = ram_col_masks[memory_size];
-	switch (memory_size) {
-		case 0: /* 4K */
-		case 1: /* 16K */
-			ram_page_bit = 0;
-			ram_ras1 = 0x8080;
-			break;
-		default: /* 64K */
-			ram_page_bit = (sam_register & 0x0400) << 5;
-			ram_ras1 = 0;
-			break;
-	}
-
 	if ((map_type = sam_register & 0x8000)) {
 		/* Map type 1 */
 #ifdef VARIABLE_MPU_RATE
diff -rN -u old-xroar-fast/sam.h new-xroar-fast/sam.h
--- old-xroar-fast/sam.h	2008-04-24 18:13:14.000000000 +0100
+++ new-xroar-fast/sam.h	2008-04-24 18:13:14.000000000 +0100
@@ -26,19 +26,27 @@
 #endif
 
 extern unsigned int sam_register;
+extern unsigned int sam_vdg_base;
 extern unsigned int sam_vdg_mode;
 extern unsigned int sam_vdg_address;
 extern unsigned int sam_vdg_mod_clear;
+extern unsigned int sam_vdg_xcount;
+extern unsigned int sam_vdg_ycount;
 
 static inline void sam_vdg_hsync(void) {
 	sam_vdg_address &= sam_vdg_mod_clear;
 }
 
+static inline void sam_vdg_fsync(void) {
+	sam_vdg_address = sam_vdg_base;
+	sam_vdg_xcount = 0;
+	sam_vdg_ycount = 0;
+}
+
 void sam_init(void);
 void sam_reset(void);
 unsigned int sam_read_byte(unsigned int addr);
 void sam_store_byte(unsigned int addr, unsigned int octet);
-void sam_vdg_fsync(void);
 uint8_t *sam_vdg_bytes(int number);
 void sam_set_register(unsigned int value);
 
diff -rN -u old-xroar-fast/snapshot.c new-xroar-fast/snapshot.c
--- old-xroar-fast/snapshot.c	2008-04-24 18:13:14.000000000 +0100
+++ new-xroar-fast/snapshot.c	2008-04-24 18:13:14.000000000 +0100
@@ -73,19 +73,16 @@
 	fs_write_byte(fd, running_config.romset);
 	fs_write_byte(fd, running_config.keymap);
 	fs_write_byte(fd, running_config.tv_standard);
-	fs_write_byte(fd, running_config.ram);
+	fs_write_byte(fd, 64);
 	fs_write_byte(fd, running_config.dos_type);
 	fs_write_byte(fd, running_config.cross_colour_phase);
 	/* RAM page 0 */
-	fs_write_byte(fd, ID_RAM_PAGE0);
-	fs_write_word16(fd, machine_ram_size > 0x8000 ? 0x8000 : machine_ram_size);
-	fs_write(fd, ram0, machine_ram_size > 0x8000 ? 0x8000 : machine_ram_size);
+	fs_write_byte(fd, ID_RAM_PAGE0); fs_write_word16(fd, 0x8000);
+	fs_write(fd, ram0, 0x8000);
 	/* RAM page 1 */
-	if (machine_ram_size > 0x8000) {
-		fs_write_byte(fd, ID_RAM_PAGE1);
-		fs_write_word16(fd, machine_ram_size - 0x8000);
-		fs_write(fd, ram0 + 0x8000, machine_ram_size - 0x8000);
-	}
+	fs_write_byte(fd, ID_RAM_PAGE1);
+	fs_write_word16(fd, 0x8000);
+	fs_write(fd, ram0 + 0x8000, 0x8000);
 	/* PIA state written before CPU state because PIA may have
 	 * unacknowledged interrupts pending already cleared in the CPU
 	 * state */
@@ -290,8 +287,8 @@
 				requested_config.keymap = tmp8;
 				fs_read_byte(fd, &tmp8);
 				requested_config.tv_standard = tmp8;
+				/* ignore 'ram' size */
 				fs_read_byte(fd, &tmp8);
-				requested_config.ram = tmp8;
 				fs_read_byte(fd, &tmp8);
 				requested_config.dos_type = tmp8;
 				size -= 7;
diff -rN -u old-xroar-fast/ui_gp32.c new-xroar-fast/ui_gp32.c
--- old-xroar-fast/ui_gp32.c	2008-04-24 18:13:14.000000000 +0100
+++ new-xroar-fast/ui_gp32.c	2008-04-24 18:13:15.000000000 +0100
@@ -94,7 +94,6 @@
 const char *cart_opts[] = { "Insert...", "Remove" };
 const char *artifact_opts[] = { "Off", "Blue-red", "Red-blue" };
 const char *keymap_opts[] = { "Auto", "Dragon", "Tandy" };
-const char *ram_opts[] = { "Auto", "4K", "16K", "32K", "64K" };
 const char *onoff_opts[] = { "Disabled", "Enabled" };
 const char *reset_opts[] = { "Soft", "Hard" };
 
@@ -106,7 +105,6 @@
 static void artifact_callback(unsigned int);
 static void machine_callback(unsigned int);
 static void keymap_callback(unsigned int);
-static void ram_callback(unsigned int);
 static void extbas_callback(unsigned int);
 static void dos_callback(unsigned int);
 static void reset_callback(unsigned int);
@@ -121,7 +119,6 @@
 	{ "Hi-res artifacts", &running_config.cross_colour_phase, 0, 3, artifact_opts, NULL, artifact_callback },
 	{ "Emulated machine", &requested_machine, 1, 5, machine_names, machine_callback, NULL },
 	{ "Keyboard layout", &requested_config.keymap, 0, 3, keymap_opts, keymap_callback, NULL },
-	{ "RAM", NULL, 4, 5, ram_opts, do_hard_reset, ram_callback },
 	{ "Extended BASIC", NULL, 1, 2, onoff_opts, do_hard_reset, extbas_callback },
 	{ "DOS", NULL, 1, 2, onoff_opts, do_hard_reset, dos_callback },
 	{ "Reset", NULL, 0, 2, reset_opts, reset_callback, NULL },
@@ -524,11 +521,6 @@
 	keyboard_set_keymap(opt - 1);
 }
 
-static void ram_callback(unsigned int opt) {
-	int opt_trans[5] = { ANY_AUTO, 4, 16, 32, 64 };
-	requested_config.ram = opt_trans[opt % 5];
-}
-
 static void extbas_callback(unsigned int opt) {
 	noextbas = opt;
 }
diff -rN -u old-xroar-fast/xroar.c new-xroar-fast/xroar.c
--- old-xroar-fast/xroar.c	2008-04-24 18:13:14.000000000 +0100
+++ new-xroar-fast/xroar.c	2008-04-24 18:13:14.000000000 +0100
@@ -46,7 +46,6 @@
 int frameskip;
 int noratelimit = 0;
 
-event_t *xroar_ui_events = NULL;
 event_t *xroar_machine_events = NULL;
 
 static const char *snapshot_load = NULL;
diff -rN -u old-xroar-fast/xroar.h new-xroar-fast/xroar.h
--- old-xroar-fast/xroar.h	2008-04-24 18:13:14.000000000 +0100
+++ new-xroar-fast/xroar.h	2008-04-24 18:13:14.000000000 +0100
@@ -30,9 +30,8 @@
 extern int frameskip;
 extern int noratelimit;
 
-#define UI_EVENT_LIST xroar_ui_events
+#define UI_EVENT_LIST xroar_machine_events
 #define MACHINE_EVENT_LIST xroar_machine_events
-extern event_t *xroar_ui_events;
 extern event_t *xroar_machine_events;
 
 void xroar_getargs(int argc, char **argv);

