Skip to content

Commit

Permalink
floppy change console command
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertvanheusden committed Feb 26, 2025
1 parent f08498b commit ecee798
Showing 1 changed file with 36 additions and 9 deletions.
45 changes: 36 additions & 9 deletions main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
string key_cga = "cga";

List<string> ide = new();

Dictionary<string, List<Tuple<string, int> > > consoles = new();
FloppyDisk floppy_controller = null;

bool throttle = false;

Expand Down Expand Up @@ -186,7 +186,10 @@
devices.Add(new i8253());

if (floppies.Count() > 0)
devices.Add(new FloppyDisk(floppies));
{
floppy_controller = new FloppyDisk(floppies);
devices.Add(floppy_controller);
}

if (ide.Count() > 0)
devices.Add(new XTIDE(ide));
Expand Down Expand Up @@ -423,18 +426,42 @@
if (line == "")
continue;

if (line == "quit")
string [] parts = line.Split(" ");

if (parts[0] == "quit")
break;

if (line == "help")
if (parts[0] == "help")
{
Console.WriteLine("quit terminate application");
// Console.WriteLine("lsfloppy list configured floppies");
// Console.WriteLine("setfloppy x y set floppy unit x (0 based) to file y");
Console.WriteLine("lsfloppy list configured floppies");
Console.WriteLine("setfloppy x y set floppy unit x (0 based) to file y");
}
else if (parts[0] == "lsfloppy")
{
if (floppy_controller == null)
Console.WriteLine("No floppy drive configured");
else
{
for(int i=0; i<floppy_controller.GetUnitCount(); i++)
Console.WriteLine($"{i}] {floppy_controller.GetUnitFilename(i)}");
}
}
else if (parts[0] == "setfloppy")
{
if (floppy_controller == null)
Console.WriteLine("No floppy drive configured");
else if (parts.Length != 3)
Console.WriteLine("Number of parameters is incorrect");
else
{
int unit = int.Parse(parts[1]);
if (floppy_controller.SetUnitFilename(unit, parts[2]))
Console.WriteLine("OK");
else
Console.WriteLine("Failed: invalid unit number?");
}
}
// else if (line == "lsfloppy")
// {
// }
else
{
Console.WriteLine($"\"{line}\" is not understood");
Expand Down

0 comments on commit ecee798

Please sign in to comment.