I made a dumb disk controller. I can only detect what type of disk we
are dealing with:
--
Jonathan Dickinson
Index: ADC/FloppyDiskController.cs
===================================================================
--- ADC/FloppyDiskController.cs (revision 0)
+++ ADC/FloppyDiskController.cs (revision 0)
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using SharpOS.AOT;
+using AOTAttr = SharpOS.AOT.Attributes;
+
+namespace SharpOS.ADC
+{
+ public class FloppyDiskController
+ {
+ [AOTAttr.ADCStub]
+ public static byte Detect( )
+ {
+ return 0;
+ }
+ }
+}
Index: ADC/X86/FloppyDiskController.cs
===================================================================
--- ADC/X86/FloppyDiskController.cs (revision 0)
+++ ADC/X86/FloppyDiskController.cs (revision 0)
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using SharpOS.AOT;
+using SharpOS.AOT.X86;
+
+namespace SharpOS.ADC.X86
+{
+ public class FloppyDiskController
+ {
+ public static byte Detect( )
+ {
+ IO.Out8( IO.Port.RTC_CommandPort, 0x10 );
+ byte drives = IO.In8( IO.Port.RTC_DataPort );
+ return drives;
+ }
+ }
+}
Index: FloppyDiskController.cs
===================================================================
--- FloppyDiskController.cs (revision 0)
+++ FloppyDiskController.cs (revision 0)
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace SharpOS
+{
+ public class FloppyDiskController
+ {
+ public static string NameOf( int number )
+ {
+ int rot = 4; // TODO: Work out actual indicies.
+
+ if( number == 1 )
+ rot = 0xf;
+
+ int drives = ADC.FloppyDiskController.Detect( ) >> rot;
+
+ switch( drives )
+ {
+ case 0:
+ return "none";
+ case 1:
+ return "360kB 5.25\"";
+ case 2:
+ return "1.2MB 5.25\"";
+ case 3:
+ return "720kB 3.5\"";
+ case 4:
+ return "1.44MB 3.5\"";
+ case 5:
+ return "2.88MB 3.5\"";
+ case 6:
+ return "unknown type";
+ case 7:
+ return "unknown type";
+ default:
+ return "invalid response";
+ }
+ }
+ }
+}
Index: Kernel.cs
===================================================================
--- Kernel.cs (revision 570)
+++ Kernel.cs (working copy)
@@ -132,6 +132,13 @@
ByteString.__RunTests ();
StringBuilder.__RunTests();
#endif
+
+ StageMessage( "Floppy Test..." );
+ TextMode.Write( "Floppy 0: " );
+ TextMode.WriteLine( FloppyDiskController.NameOf( 0 ) );
+ TextMode.Write( "Floppy 1: " );
+ TextMode.WriteLine( FloppyDiskController.NameOf( 1 ) );
+
StageMessage("Shell setup...");
SharpOS.Shell.Prompter.Setup();
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
SharpOS-Developers mailing list
SharpOS-Developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sharpos-developers