Index: trunk/Serial_Server/library/Image.cpp
===================================================================
--- trunk/Serial_Server/library/Image.cpp	(revision 233)
+++ trunk/Serial_Server/library/Image.cpp	(revision 258)
@@ -12,4 +12,23 @@
 #include <stdio.h>
 
+struct floppyInfo {
+	unsigned long size;
+	unsigned char type;
+	unsigned char cylinders;
+	unsigned char heads;
+	unsigned char sectors;
+} floppyInfos[] = 
+{
+{ 2949120 / 512, 6, 80, 2, 36 },   // 2.88MB 3.5"
+{ 1474560 / 512, 4, 80, 2, 18 },        // 1.44MB 3.5"
+{ 1228800 / 512, 2, 80, 2, 15 },     // 1.2MB 5.25"
+{ 737280 / 512, 3, 80, 1, 18 },    // 720KB 3.5"
+{ 368640 / 512, 1, 40, 2, 9 }, // 360KB 5.25"
+{ 327680 / 512, 0, 40, 2, 8 }, // 320KB 5.25"
+{ 184320 / 512, 0, 40, 1, 9 }, // 180KB 5.25" single sided
+{ 163840 / 512, 0, 40, 1, 8 }, // 160KB 5.25" single sided
+{ 0, 0, 0, 0, 0 }
+};
+
 Image::Image( char *name, int p_readOnly, int p_drive )
 {
@@ -27,4 +46,6 @@
 {
 	double sizef;
+	char sizeChar;
+	struct floppyInfo *f;
 
 	for( char *c = shortFileName = name; *c; c++ )
@@ -46,4 +67,16 @@
 	if( totallba == 0 )
 		log( -1, "'%s', Image size zero?" );
+
+	floppy = 0;
+	for( f = floppyInfos; f->size && f->size != totallba; f++ ) ;
+	if( f->size )
+	{
+		floppy = 1;
+		floppyType = f->type;
+		p_useCHS = 1;
+		p_cyl = f->cylinders;
+		p_head = f->heads;
+		p_sect = f->sectors;
+	}
 
 	if( p_useCHS )
@@ -82,8 +115,16 @@
 
 	sizef = totallba/2048.0;
+	sizeChar = 'M';
+	if( sizef < 1 ) 
+	{
+		sizef *= 1024;
+		sizeChar = 'K';
+	}
 	if( useCHS )
-		log( 0, "Opening '%s', CHS geometry %u:%u:%u, total LBA %lu, total size %.1lf MB", name, cyl, sect, head, totallba, sizef );
-	else
-		log( 0, "Opening '%s', total LBA %lu, total size %.1lf MB", name, totallba, sizef );
+		log( 0, "%s: %s with CHS geometry %u:%u:%u, size %.2lf %cB",
+			 name, (floppy ? "Floppy Disk" : "Hard Disk"), cyl, head, sect, sizef, sizeChar );
+	else
+		log( 0, "%s: %s with total sectors %lu, size %.2lf %cB", 
+			 name, (floppy ? "Floppy Disk" : "Hard Disk"), totallba, sizef, sizeChar );
 }
 
@@ -137,9 +178,17 @@
 #define ATA_dwLBACnt 60
 
-#define ATA_wVendor 159
-
+// Words carved out of the vendor specific area for our use
+//
+#define ATA_wSerialFloppyFlagAndType 158
+#define ATA_wSerialPortAndBaud 159
+
+// Defines used in the words above
+//
 #define ATA_wCaps_LBA 0x200
 
 #define ATA_wGenCfg_FIXED 0x40
+
+#define ATA_wSerialFloppyFlagAndType_Flag 0x10
+#define ATA_wSerialFloppyFlagAndType_TypePosition 5
 
 struct comPorts {
@@ -207,5 +256,9 @@
 	}
 
+	if( floppy )
+		buff[ ATA_wSerialFloppyFlagAndType ] = ATA_wSerialFloppyFlagAndType_Flag | (floppyType << ATA_wSerialFloppyFlagAndType_TypePosition);
+
+	// we always set this, so that the bulk of the BIOS will consider this disk as a hard disk
+	//
 	buff[ ATA_wGenCfg ] = ATA_wGenCfg_FIXED;
-	//					buff[ ATA_VendorSpecific_ReturnPortBaud ] = retWord;
-}
+}
Index: trunk/Serial_Server/library/Library.h
===================================================================
--- trunk/Serial_Server/library/Library.h	(revision 233)
+++ trunk/Serial_Server/library/Library.h	(revision 258)
@@ -32,4 +32,5 @@
 
 	unsigned long cyl, sect, head;
+	unsigned char floppy, floppyType;
 	int useCHS;
 
Index: trunk/Serial_Server/library/Process.cpp
===================================================================
--- trunk/Serial_Server/library/Process.cpp	(revision 233)
+++ trunk/Serial_Server/library/Process.cpp	(revision 258)
@@ -99,4 +99,14 @@
 	lastScan = 0;
 
+	//
+	// Floppy disks must come after any hard disks
+	//
+	if( (image0 && image0->floppy) && (image1 && !image1->floppy) )
+	{
+		img = image0;
+		image0 = image1;
+		image1 = img;
+	}
+
 	lasttick = GetTime();
 
Index: trunk/Serial_Server/win32/Win32.cpp
===================================================================
--- trunk/Serial_Server/win32/Win32.cpp	(revision 233)
+++ trunk/Serial_Server/win32/Win32.cpp	(revision 258)
@@ -30,9 +30,12 @@
 		"  -n [megabytes]      Create new disk with given size or use -g geometry",
 		"                      Maximum size is " USAGE_MAXSECTORS, 
-		"                      (default is a 32 MB disk, with CHS geometry 65:63:16)",
-		"",
-		"  -p                  Named Pipe mode for emulators (pipe is \"" PIPENAME "\")",
-		"",
-		"  -c COMPortNumber    COM Port to use (default is first found)",
+		"                      (default is a 32 MB disk, with CHS geometry 65:16:63)",
+		"",
+		"  -p [pipename]       Named Pipe mode for emulators",
+		"                      (must begin with \"\\\\\", default is \"" PIPENAME "\")",
+		"",
+        "  -c COMPortNumber    COM Port to use (default is first found)",
+   	    "                      Available COM ports on this system are:",
+   	 "COM                          ",
 		"",
 		"  -b BaudRate         Baud rate to use on the COM port, with client machine",
@@ -53,10 +56,25 @@
 		"with xtidecfg.com.  Or one can hold down the ALT key at the end of the normal",
 		"IDE hard disk scan and the XTIDE Universal BIOS will scan COM1-7, at each of",
-		"the four speeds given above for BaudRate.  Note that hardware rate multipliers",
+		"the six speeds given above for BaudRate.  Note that hardware rate multipliers",
 		"must be taken into account on the server end, but are invisible on the client.",
+		"",
+		"Floppy images may also be used.  Image size must be exactly the same size",
+		"as a 2.88MB, 1.44MB, 1.2MB, 720KB, 360KB, 320KB, 180KB, or 160KB disk.",
+		"Floppy images must be the last disks discovered by the BIOS, and only",
+		"two floppy drives are supported by the BIOS at a time.",
 		NULL };
 
 	for( int t = 0; usageStrings[t]; t++ )
-		fprintf( stderr, "%s\n", usageStrings[t] );
+	{
+		if( !strncmp( usageStrings[t], "COM", 3 ) )
+		{
+			char logbuff[ 1024 ];
+
+			SerialAccess::EnumerateCOMPorts( logbuff, 1024 );
+			fprintf( stderr, "%s%s\n", usageStrings[t]+3, logbuff );
+		}
+		else
+			fprintf( stderr, "%s\n", usageStrings[t] );
+	}
 
 	exit( 1 );
@@ -120,5 +138,8 @@
 				break;
 			case 'p': case 'P':
-				ComPort = "PIPE";
+				if( argv[t+1][0] == '\\' && argv[t+1][1] == '\\' )
+					ComPort = argv[++t];
+				else
+					ComPort = PIPENAME;
 				if( !baudRate )
 					baudRate = baudRateMatchString( "115200" );
Index: trunk/Serial_Server/win32/Win32Serial.h
===================================================================
--- trunk/Serial_Server/win32/Win32Serial.h	(revision 233)
+++ trunk/Serial_Server/win32/Win32Serial.h	(revision 258)
@@ -35,9 +35,9 @@
 		}
 
-		if( !strcmp( name, "PIPE" ) )
+		if( name[0] == '\\' && name[1] == '\\' )
 		{
-			log( 0, "Opening named pipe %s (simulating %s baud)", PIPENAME, baudRate->display );
+			log( 0, "Opening named pipe %s (simulating %s baud)", name, baudRate->display );
 		
-			pipe = CreateNamedPipeA( PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE|PIPE_REJECT_REMOTE_CLIENTS, 2, 1024, 1024, 0, NULL );
+			pipe = CreateNamedPipeA( name, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE|PIPE_REJECT_REMOTE_CLIENTS, 2, 1024, 1024, 0, NULL );
 			if( pipe == INVALID_HANDLE_VALUE )
 				log( -1, "Could not CreateNamedPipe " PIPENAME );
@@ -59,5 +59,5 @@
 				DCB dcb;
 
-				log( 0, "Opening %s (%lu baud)", name, baudRate->rate );
+				log( 0, "Opening %s (%s baud)", name, baudRate->display );
 			
 				pipe = CreateFileA( name, GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
@@ -74,5 +74,15 @@
 				dcb.Parity = NOPARITY;
 				if( !SetCommState( pipe, &dcb ) )
-					log( -1, "Could not SetCommState" );
+				{
+					char *msg = "";
+					COMMPROP comProp;
+
+					if( GetCommProperties( pipe, &comProp ) )
+					{
+						if( comProp.dwMaxBaud != BAUD_USER )
+							msg = "\n    On this COM port, baud rate is limited to 115.2K";
+					}
+					log( -1, "Could not SetCommState: baud rate selected may not be availabele%s", msg );
+				}
 
 				if( !SetCommTimeouts( pipe, &timeouts ) )
@@ -82,24 +92,33 @@
 			{
 				char logbuff[ 1024 ];
-				int found = 0;
 
-				sprintf( logbuff, "serial port '%s' not found, detected COM ports:", name );
-
-				for( int t = 1; t <= 40; t++ )
-				{
-					sprintf( buff1, "COM%d", t );
-					if( QueryDosDeviceA( buff1, buff2, sizeof(buff2) ) )
-					{
-						strcat( logbuff, "\n    " );
-						strcat( logbuff, buff1 );
-						found = 1;
-					}
-				}
-				if( !found )
-					strcat( logbuff, "\n    (none)" );
+				EnumerateCOMPorts( logbuff, 1024 );
 				
-				log( -1, logbuff );
+				log( -1, "Serial port '%s' not found, detected COM ports: %s", name, logbuff );
 			}
 		}
+	}
+
+	static void EnumerateCOMPorts( char *logbuff, int logbuffLen )
+	{
+		int found = 0;
+		char buff1[20], buff2[1024];
+
+		logbuff[0] = 0;
+
+		for( int t = 1; t <= 40 && strlen(logbuff) < (logbuffLen - 40); t++ )
+		{
+			sprintf( buff1, "COM%d", t );
+			if( QueryDosDeviceA( buff1, buff2, sizeof(buff2) ) )
+			{
+				if( found )
+					strcat( logbuff, ", " );
+				strcat( logbuff, buff1 );
+				found = 1;
+			}
+		}
+
+		if( !found )
+			strcat( logbuff, "(none)" );
 	}
 
