mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 04:18:43 +00:00
Changes
This commit is contained in:
parent
becfc92417
commit
a7c2d5fefb
8 changed files with 99 additions and 62 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -53,3 +53,4 @@ source/_ReSharper.Caches/
|
|||
Docs/~$RingsGen2.xlsx
|
||||
source/Kernel-X86/90-Application/GuessKernelGen3.csproj
|
||||
Docs/~$RingsGen3.xlsx
|
||||
*.map
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Bochs_Name>CosmosGraphicSubsystemBoot</Bochs_Name>
|
||||
<VMware_Name>CosmosGraphicSubsystemBoot</VMware_Name>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@ namespace Cosmos_Graphic_Subsytem
|
|||
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' */
|
||||
|
|
|
|||
14
Kernel.sln
14
Kernel.sln
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -249,13 +249,13 @@ namespace Cosmos.System.Graphics
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Cosmos.System.Graphics
|
|||
|
||||
private static PCIDevice SVGAIIDevice = PCI.GetDevice(VendorID.VMWare, DeviceID.SVGAIIAdapter);
|
||||
|
||||
public static bool DoesSVGAIIExist()
|
||||
public static bool SVGAIIExist()
|
||||
{
|
||||
if (SVGAIIDevice != null)
|
||||
{
|
||||
|
|
@ -31,38 +31,44 @@ namespace Cosmos.System.Graphics
|
|||
}
|
||||
|
||||
}
|
||||
//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)
|
||||
{
|
||||
|
|
@ -71,32 +77,75 @@ namespace Cosmos.System.Graphics
|
|||
// 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;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ namespace Cosmos.System.Graphics
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ namespace Cosmos.System.Graphics
|
|||
}
|
||||
|
||||
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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue