Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Arawn Davies committed Feb 25, 2018
1 parent becfc92 commit a7c2d5f
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 62 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ source/_ReSharper.Caches/
Docs/~$RingsGen2.xlsx
source/Kernel-X86/90-Application/GuessKernelGen3.csproj
Docs/~$RingsGen3.xlsx
*.map
3 changes: 2 additions & 1 deletion Demos/CosmosGraphicSubsystem/CosmosGraphicSubsystem.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Bochs_Name>CosmosGraphicSubsystemBoot</Bochs_Name>
<VMware_Name>CosmosGraphicSubsystemBoot</VMware_Name>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -41,7 +42,7 @@
<Bochs_Description>Use Bochs emulator to deploy and debug.</Bochs_Description>
<Bochs_Deployment>ISO</Bochs_Deployment>
<Bochs_Launch>Bochs</Bochs_Launch>
<Bochs_DebugEnabled>True</Bochs_DebugEnabled>
<Bochs_DebugEnabled>False</Bochs_DebugEnabled>
<Bochs_DebugMode>Source</Bochs_DebugMode>
<Bochs_IgnoreDebugStubAttribute>False</Bochs_IgnoreDebugStubAttribute>
<Bochs_CosmosDebugPort>Serial: COM1</Bochs_CosmosDebugPort>
Expand Down
10 changes: 5 additions & 5 deletions Demos/CosmosGraphicSubsystem/Kernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public class Kernel : Sys.Kernel
protected override void BeforeRun()
{
Console.WriteLine("Cosmos booted successfully. Let's go in Graphic Mode");
Console.WriteLine("Specifying custom graphics mode as 800x600@32");
// Specify custom graphics mode (800x600 @ 16)
Mode start = new Mode(800, 600, ColorDepth.ColorDepth32);
Console.WriteLine("Using default graphics mode");
//Mode start = new Mode(800, 600, ColorDepth.ColorDepth32);

Console.WriteLine("Here we go!");
// Create new instance of FullScreenCanvas, specifying graphics mode
canvas = FullScreenCanvas.GetFullScreenCanvas(start);
Console.ReadKey(true);
// Create new instance of FullScreenCanvas, using default graphics mode
canvas = FullScreenCanvas.GetFullScreenCanvas(); // canvas = GetFullScreenCanvas(start);


/* Clear the Screen with the color 'Blue' */
Expand Down
14 changes: 0 additions & 14 deletions Kernel.sln
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spruce", "..\XSharp\source\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XSharp.x86", "..\XSharp\source\XSharp.x86\XSharp.x86.csproj", "{7370A62F-12DA-4181-BE3B-009D0926CA7E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PCITest", "PCITest", "{58AEE3B6-80BF-4ED3-AD1E-17359139E3FC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PCITest", "Demos\PCITest\PCITest.csproj", "{D3639BE5-49A0-4163-9174-1D0CC6823E06}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -339,14 +335,6 @@ Global
{7370A62F-12DA-4181-BE3B-009D0926CA7E}.Release|Any CPU.Build.0 = Release|Any CPU
{7370A62F-12DA-4181-BE3B-009D0926CA7E}.Release|x86.ActiveCfg = Release|Any CPU
{7370A62F-12DA-4181-BE3B-009D0926CA7E}.Release|x86.Build.0 = Release|Any CPU
{D3639BE5-49A0-4163-9174-1D0CC6823E06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D3639BE5-49A0-4163-9174-1D0CC6823E06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D3639BE5-49A0-4163-9174-1D0CC6823E06}.Debug|x86.ActiveCfg = Debug|Any CPU
{D3639BE5-49A0-4163-9174-1D0CC6823E06}.Debug|x86.Build.0 = Debug|Any CPU
{D3639BE5-49A0-4163-9174-1D0CC6823E06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D3639BE5-49A0-4163-9174-1D0CC6823E06}.Release|Any CPU.Build.0 = Release|Any CPU
{D3639BE5-49A0-4163-9174-1D0CC6823E06}.Release|x86.ActiveCfg = Release|Any CPU
{D3639BE5-49A0-4163-9174-1D0CC6823E06}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -392,8 +380,6 @@ Global
{E35E0DBF-555F-4D38-8F28-ACDFA9DC97BD} = {5FF9BF2A-5162-4F12-82B6-1693AD776636}
{0812DD0A-4CEE-4376-B78A-02EBCBAA14C2} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
{7370A62F-12DA-4181-BE3B-009D0926CA7E} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
{58AEE3B6-80BF-4ED3-AD1E-17359139E3FC} = {B56A6119-1B8F-44E4-9446-291E52F47D4C}
{D3639BE5-49A0-4163-9174-1D0CC6823E06} = {58AEE3B6-80BF-4ED3-AD1E-17359139E3FC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1A1E8F1D-82B3-471F-9B59-0350DEA9203D}
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.System2/Graphics/Canvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ public virtual void DrawCircle(Pen pen, int x_center, int y_center, int radius)
}
}

//
public virtual void DrawCircle(Pen pen, Point point, int radius)
{

DrawCircle(pen, point.X, point.Y, radius);

}

//http://members.chello.at/~easyfilter/bresenham.html
public virtual void DrawEllipse(Pen pen, int x_center, int y_center, int x_radius, int y_radius)
{
Expand Down
127 changes: 88 additions & 39 deletions source/Cosmos.System2/Graphics/FullScreenCanvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ private enum VideoDriver

private static PCIDevice SVGAIIDevice = PCI.GetDevice(VendorID.VMWare, DeviceID.SVGAIIAdapter);

public static bool DoesSVGAIIExist()
public static bool SVGAIIExist()
{
if (SVGAIIDevice != null)
{
Expand All @@ -31,38 +31,44 @@ public static bool DoesSVGAIIExist()
}

}
//public static bool SVGAIIExists = SVGAIIDevice != null;

private static VideoDriver videoDevice;

// Created null - NullReferenceException when calling GetFullScreenCanvas() with 0 overloads
private static Canvas MyVideoDriver = null;

private static Canvas GetVideoDriver()
{
if (SVGAIIExist())
{
return new SVGAIIScreen();
}
else
{
return new VBEScreen();
}
}
private static Canvas GetVideoDriver(Mode mode)
{
if (SVGAIIExist())
{
return new SVGAIIScreen(mode);
}
else
{
return new VBEScreen(mode);
}
}

public static Canvas GetFullScreenCanvas()
{
// If MyVideoDriver is null (hasn't checked if VMWare SVGA exists),
// Do necessary check and set to default gfx mode
if (MyVideoDriver == null)
{
return GetFullScreenCanvas(MyVideoDriver.DefaultGraphicMode);
return MyVideoDriver = GetVideoDriver();
}
// If it's not null, simply change graphics mode */
else
{
MyVideoDriver.Mode = MyVideoDriver.DefaultGraphicMode;
return MyVideoDriver;
}
// Old check left for reference
/*
if (videoDevice == VideoDriver.VMWareSVGAIIDriver)
{
}
else
{
}
*/
}
public static Canvas GetFullScreenCanvas(Mode mode)
{
Expand All @@ -71,32 +77,75 @@ public static Canvas GetFullScreenCanvas(Mode mode)
// Do necessary check and set gfx mode as specified (mode)
if (MyVideoDriver == null)
{
if (DoesSVGAIIExist())
{
// Set videoDevice to SVGA, initialize MyVideoDriver as an SVGA display using specified mode
// MyVideoDriver.Mode = mode; isn't exactly needed, just done in case it doesn't set.
// returns MyVideoDriver as the Canvas
videoDevice = VideoDriver.VMWareSVGAIIDriver;
MyVideoDriver = new SVGAIIScreen(mode);
MyVideoDriver.Mode = mode;
return MyVideoDriver;
}
else
{
// Does the same as above, this time using VESA BIOS Extensions (supported by loads of graphics cards)
videoDevice = VideoDriver.VBEDriver;
MyVideoDriver = new VBEScreen(mode);
MyVideoDriver.Mode = mode;
return MyVideoDriver;
}
return MyVideoDriver = GetVideoDriver(mode);
}
else
{
// If MyVideoDriver has been initialized before (Graphics mode has previously been set)
// Change the graphics mode to the mode specified
MyVideoDriver.Mode = mode;
return MyVideoDriver;
}
}
}
}
/*
if (DoesSVGAIIExist())
{
// Set videoDevice to SVGA, initialize MyVideoDriver as an SVGA display using specified mode
// MyVideoDriver.Mode = mode; isn't exactly needed, just done in case it doesn't set.
// returns MyVideoDriver as the Canvas
videoDevice = VideoDriver.VMWareSVGAIIDriver;
MyVideoDriver = new SVGAIIScreen(mode);
MyVideoDriver.Mode = mode;
return MyVideoDriver;
}
else
{
// Does the same as above, this time using VESA BIOS Extensions (supported by loads of graphics cards)
videoDevice = VideoDriver.VBEDriver;
MyVideoDriver = new VBEScreen(mode);
MyVideoDriver.Mode = mode;
return MyVideoDriver;
}
}
else
{
// If MyVideoDriver has been initialized before (Graphics mode has previously been set)
// Change the graphics mode to the mode specified
MyVideoDriver.Mode = mode;
return MyVideoDriver;
}
}
/*
// If MyVideoDriver is null (hasn't checked if VMWare SVGA exists),
// Do necessary check and set to default gfx mode
if (MyVideoDriver == null)
{
if (DoesSVGAIIExist())
{
// Set videoDevice to SVGA, initialize MyVideoDriver as an SVGA display using specified mode
// MyVideoDriver.Mode = mode; isn't exactly needed, just done in case it doesn't set.
// returns MyVideoDriver as the Canvas
videoDevice = VideoDriver.VMWareSVGAIIDriver;
MyVideoDriver = new SVGAIIScreen(SVGAIIScreen.defaultGraphicsMode);
MyVideoDriver.Mode = SVGAIIScreen.defaultGraphicsMode;
return MyVideoDriver;
}
else
{
// Does the same as above, this time using VESA BIOS Extensions (supported by loads of graphics cards)
videoDevice = VideoDriver.VBEDriver;
MyVideoDriver = new VBEScreen(VBEScreen.defaultGraphicsMode);
MyVideoDriver.Mode = VBEScreen.defaultGraphicsMode;
return MyVideoDriver;
}
}
// If it's not null, simply change graphics mode
else
{
MyVideoDriver.Mode = MyVideoDriver.DefaultGraphicMode;
return MyVideoDriver;
}
*/


2 changes: 1 addition & 1 deletion source/Cosmos.System2/Graphics/SVGAIIScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public override List<Mode> getAvailableModes()
new Mode(3840, 2400, ColorDepth.ColorDepth32), // WQUXGA
};
}

public static readonly Mode defaultGraphicsMode = new Mode(1024, 768, ColorDepth.ColorDepth16);
protected override Mode getDefaultGraphicMode() => new Mode(1024, 768, ColorDepth.ColorDepth16);

private void SetGraphicsMode(Mode aMode)
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.System2/Graphics/VBEScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public override List<Mode> getAvailableModes()
}

protected override Mode getDefaultGraphicMode() => new Mode(1024, 768, ColorDepth.ColorDepth32);

public static readonly Mode defaultGraphicsMode = new Mode(1024, 768, ColorDepth.ColorDepth32);
/// <summary>
/// Use this to setup the screen, this will disable the console.
/// </summary>
Expand Down

0 comments on commit a7c2d5f

Please sign in to comment.