Index: emu/fdd.c
===================================================================
--- emu/fdd.c	(revision 8270a1b555559b631c448852f8177a4dfa1142eb)
+++ emu/fdd.c	(revision 9b204fae11bd78a07255cdd4b3dd11b68770155f)
@@ -44,5 +44,6 @@
 #define COM_WR_SEC 0xa2
 #define COM_INT 0xd0
-#define COM_WR_TRA 0xf0
+#define COM_WR_TRA_WP 0xf0
+#define COM_WR_TRA 0xf2
 
 #define COM_LAT_CYC 5
@@ -98,4 +99,7 @@
 		return "COM_WR_SEC";
 
+	case COM_WR_TRA_WP:
+		return "COM_WR_TRA_WP";
+
 	case COM_WR_TRA:
 		return "COM_WR_TRA";
@@ -140,10 +144,10 @@
 {
 	ver("fdd init");
-	inf("loading disk image file %s", disk);
+	inf("reading disk image file %s", disk);
 
 	SDL_RWops *ops = SDL_RWFromFile(disk, "rb");
 
 	if (ops == NULL) {
-		fail("error while opening disk image file %s", disk);
+		fail("error while opening disk image file %s for reading", disk);
 	}
 
@@ -166,4 +170,25 @@
 {
 	ver("fdd quit");
+	inf("writing disk image file %s", disk);
+
+	SDL_RWops *ops = SDL_RWFromFile(disk, "wb");
+
+	if (ops == NULL) {
+		fail("error while opening disk image file %s for writing", disk);
+	}
+
+	size_t stored = 0;
+
+	while (stored < SZ_DISK) {
+		size_t n_wr = SDL_RWwrite(ops, image + stored, 1, SZ_DISK - stored);
+
+		if (n_wr == 0) {
+			fail("error while writing disk image file %s", disk);
+		}
+
+		stored += n_wr;
+	}
+
+	SDL_RWclose(ops);
 }
 
@@ -338,4 +363,5 @@
 
 		case COM_WR_TRA:
+		case COM_WR_TRA_WP:
 			state.tra_0 = false;
 			fail("format not yet supported");
