Index: firmware/atari_drive_emulator.c
===================================================================
--- firmware/atari_drive_emulator.c	(revision 61)
+++ firmware/atari_drive_emulator.c	(revision 62)
@@ -31,6 +31,8 @@
 #define MAX_DRIVES 4
 
 struct SimpleFile * drives[MAX_DRIVES];
+unsigned char drive_info[MAX_DRIVES];
+enum DriveInfo {DI_XD=0,DI_SD=1,DI_MD=2,DI_DD=3,DI_BITS=3,DI_RO=4};
 
 struct ATRHeader
 {
@@ -180,8 +182,10 @@
 {
 	int read = 0;
 	int xfd = 0;
+	unsigned char info;
 
 	drives[driveNumber] = 0;
+	drive_info[driveNumber] = 0;
 
 	if (!file) return;
 
@@ -223,7 +227,7 @@
 		atr_header.wMagic = 0x296;
 		atr_header.wPars = file_size(file)/16;
 		atr_header.wSecSize = 0x80;
-		atr_header.btFlags = 0;
+		atr_header.btFlags |= file_readonly(file);
 	}
 	else if (atr_header.wMagic == 0xFFFF) // XEX
 	{
@@ -241,6 +245,7 @@
 	{
 		//printf("ATR ");
 		offset = 16;
+		atr_header.btFlags |= file_readonly(file);
 	}
 	else
 	{
@@ -248,20 +253,25 @@
 		return;
 	}
 
+	if (atr_header.btFlags&1)
+	{
+		info |= DI_RO;
+	}
+
 	if (atr_header.wSecSize == 0x80)
 	{
-	/*	if (atr_header.wPars>(720*128/16))
-			printf("MD ");
+		if (atr_header.wPars>(720*128/16))
+			info |= DI_MD;
 		else
-			printf("SD ");*/
+			info |= DI_SD;
 	}
 	else if (atr_header.wSecSize == 0x100)
 	{
-		//printf("DD ");
+		info |= DI_DD;
 	}
 	else if (atr_header.wSecSize < 0x100)
 	{
-		//printf("XD ");
+		info |= DI_XD;
 	}
 	else
 	{
@@ -272,6 +282,7 @@
 	//printf("0\n");
 
 	drives[driveNumber] = file;
+	drive_info[driveNumber] = info;
 	//printf("appears valid\n");
 }
 
@@ -389,7 +400,10 @@
 			clearAtariSectorBuffer();
 
 			status = 0x10; // Motor on;
-			status |= 0x08; // write protected; // no write support yet...
+			if (atr_header.btFlags&1)
+			{
+				status |= 0x08; // write protected; // no write support yet...
+			}
 			if (atr_header.wSecSize == 0x80) // normal sector size
 			{
 				if (atr_header.wPars>(720*128/16))
@@ -430,6 +444,13 @@
 
 			//printf("WACK:");
 			USART_Transmit_Mode();
+			if (file_readonly(file))
+			{
+				send_NACK();
+				USART_Wait_Transmit_Complete();
+				USART_Receive_Mode();
+				return;
+			}
 			send_ACK();
 			USART_Wait_Transmit_Complete();
 			USART_Receive_Mode();
@@ -728,3 +749,40 @@
 	printf("%d",check_sum);
 	printf(")");*/
 }
+
+void describe_disk(int driveNumber, char * buffer)
+{
+	if (drives[driveNumber]==0)
+	{
+		buffer[0] = 'N';
+		buffer[1] = 'O';
+		buffer[2] = 'N';
+		buffer[3] = 'E';
+		buffer[4] = '\0';
+		return;
+	}
+//enum DriveInfo {DI_XD=0,DI_SD=1,DI_MD=2,DI_DD=3,DI_BITS=3,DI_RO=4};
+	unsigned char info = drive_info[driveNumber];
+	buffer[0] = 'R';
+	buffer[1] = info&DI_RO ? 'O' : 'W';
+	buffer[2] = ' ';
+	unsigned char density;
+	switch (info&3)
+	{
+	case DI_XD:
+		density = 'X';
+		break;
+	case DI_SD:
+		density = 'S';
+		break;
+	case DI_MD:
+		density = 'M';
+		break;
+	case DI_DD:
+		density = 'D';
+		break;
+	}
+	buffer[3] = density;
+	buffer[4] = 'D';
+	buffer[5] = '\0';
+}
Index: firmware/atari_drive_emulator.h
===================================================================
--- firmware/atari_drive_emulator.h	(revision 61)
+++ firmware/atari_drive_emulator.h	(revision 62)
@@ -21,4 +21,5 @@
 // For a read-only disk, just have no write function!
 struct SimpleFile;
 void set_drive_status(int driveNumber, struct SimpleFile * file);
+void describe_disk(int driveNumber, char * buffer);
 
Index: firmware/fat/pff_file.c
===================================================================
--- firmware/fat/pff_file.c	(revision 61)
+++ firmware/fat/pff_file.c	(revision 62)
@@ -66,6 +66,7 @@
 void file_init(struct SimpleFile * file)
 {
 	file->path[0] = '\0';
+	file->is_readonly = 1;
 	file->size = 0;
 }
 
@@ -100,6 +101,7 @@
 	FRESULT res;
 
 	//printf("went\n");
+	if (file->is_readonly) return SimpleFile_FAIL;
 
 	file_check_open(file);
 
@@ -182,6 +184,11 @@
 	return file->size;
 }
 
+int file_readonly(struct SimpleFile * file)
+{
+	return file->is_readonly;
+}
+
 int file_struct_size()
 {
 	return sizeof(struct SimpleFile);
@@ -216,6 +223,7 @@
 	FRESULT res;
 
 	strcpy(&file->path[0],dir->path);
+	file->is_readonly = dir->is_readonly;
 	file->size = dir->size;
 
 	file_write_flush();
@@ -328,6 +336,7 @@
 	prev->filename_ptr = prev->path;
 	prev->size = 0;
 	prev->is_subdir = 1;
+	prev->is_readonly = 1;
 	--room;
 
 	//int count=0;
@@ -359,6 +368,7 @@
 		//printf("next %x %d ",entry,room);
 
 		entry->is_subdir = (filinfo.fattrib & AM_DIR) ? 1 : 0;
+		entry->is_readonly = (filinfo.fattrib & AM_RDO) ? 1 : 0;
 
 		//printf("%s ",filinfo.fname);
 
Index: firmware/fat/pff_file.h
===================================================================
--- firmware/fat/pff_file.h	(revision 61)
+++ firmware/fat/pff_file.h	(revision 62)
@@ -11,6 +11,7 @@
 struct SimpleFile
 {
 	char path[MAX_PATH_LENGTH];
+	int is_readonly;
 	int size;
 };
 
@@ -21,6 +22,7 @@
 	char lfn[256];
 	int size;
 	int is_subdir;
+	int is_readonly;
 	struct SimpleDirEntry * next; // as linked list - want to allow sorting...
 };
 
Index: firmware/fileselector.c
===================================================================
--- firmware/fileselector.c	(revision 61)
+++ firmware/fileselector.c	(revision 62)
@@ -27,13 +27,14 @@
 	return (compare_ext(f,"ROM"));
 }
 
+void dir_of(char * dir, char const * path); // TODO - into simpledir
 
 void file_selector(struct SimpleFile * file)
 {
-	char dir[MAX_PATH_LENGTH] = "";
+	char dir[MAX_PATH_LENGTH];
+	dir_of(&dir[0],file_name(file));
 	for (;;)
 	{
-		// TODO last selected dir...
 		struct SimpleDirEntry * entry = dir_entries_filtered(dir,filter);
 
 		// Count how many we have
@@ -48,6 +49,7 @@
 
 		// Selected item
 		int pos = 0;
+		int prevstartpos = -1;
 
 		struct joystick_status joy;
 		joy.x_ = joy.y_ = joy.fire_ = 0;
@@ -76,7 +78,11 @@
 				}
 
 				// clear the screen
-				clearscreen();
+				if (startpos!=prevstartpos)
+				{
+					clearscreen();
+					prevstartpos = startpos;
+				}
 
 				// find selected entry
 				struct SimpleDirEntry * sel_entry = entry;
@@ -131,6 +137,8 @@
 					//printf("%s %s %d %d %d",dir_is_subdir(sel_entry) ? "DIR":"", dir_filename(sel_entry), joy.x_, joy.y_, pos);
 					printf("%s %s",dir_is_subdir(sel_entry) ? "DIR":"", dir_filename(sel_entry));
 				}
+				int i;
+				for (i=0;i!=40;++i) printf(" ");
 			}
 
 			// Slow it down a bit
Index: firmware/main.c
===================================================================
--- firmware/main.c	(revision 61)
+++ firmware/main.c	(revision 62)
@@ -300,7 +300,9 @@
 		{
 			int temp = debug_pos;
 			debug_adjust = row==i+2 ? 128 : 0;
-			printf("Drive %d:%s", i, file_name(files[i-1]));
+			char buffer[20];
+			describe_disk(i-1,&buffer[0]);
+			printf("Drive %d:%s %s", i, file_name(files[i-1]), &buffer[0]);
 			debug_pos = temp+40;
 		}
 
@@ -368,7 +370,7 @@
 				{
 					// Remove disk
 					file_init(files[row-3]);
-					set_drive_status(row-3,files[row-3]);
+					set_drive_status(row-3,0);
 				}
 				else if (joy.fire_)
 				{
Index: firmware/simplefile.h
===================================================================
--- firmware/simplefile.h	(revision 61)
+++ firmware/simplefile.h	(revision 62)
@@ -14,6 +14,7 @@
 enum SimpleFileStatus file_read(struct SimpleFile * file, void * buffer, int bytes, int * bytesread);
 enum SimpleFileStatus file_seek(struct SimpleFile * file, int offsetFromStart);
 int file_size(struct SimpleFile * file);
+int file_readonly(struct SimpleFile * file);
 
 enum SimpleFileStatus file_write(struct SimpleFile * file, void * buffer, int bytes, int * byteswritten);
 enum SimpleFileStatus file_write_flush();
Index: firmware/test_file.c
===================================================================
--- firmware/test_file.c	(revision 61)
+++ firmware/test_file.c	(revision 62)
@@ -157,7 +157,12 @@
 		loadrom("osaorig.rom",0x2800, (void *)0x719800);
 		loadrom("ataribas.rom",0x2000,(void *)0x700000);
 
-	//file_selector(file);
+	entry = dir_entries("/DCIM");
+	entry = dir_next(entry);
+	fprintf(stderr, " Name:%s", dir_filename(entry));
+	struct SimpleFile * file = alloca(file_struct_size());
+	file_open_dir(entry,file);
+	file_selector(file);
 
 	return 0;
 }
