From b1f9b2f801dc9c557e1c98958b95cb87a57f5d6b Mon Sep 17 00:00:00 2001 From: Kudzu Date: Tue, 8 Aug 2017 14:24:14 -0400 Subject: [PATCH 1/2] g3 --- .../Kernel-X86/10-CPU/Cosmos.CPU.x86/TempDebug.cs | 12 ++++-------- .../Cosmos.Platform.PC/Devices/Processor.cs | 2 +- .../source/Kernel-X86/30-HAL/Cosmos.HAL/DeviceMgr.cs | 2 +- Cosmos/source/Kernel-X86/50-Application/Boot.cs | 3 ++- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Cosmos/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/TempDebug.cs b/Cosmos/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/TempDebug.cs index 1967d7a63..df6bb4c0f 100644 --- a/Cosmos/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/TempDebug.cs +++ b/Cosmos/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/TempDebug.cs @@ -2,16 +2,12 @@ namespace Cosmos.CPU.x86 { static public class TempDebug { - static public void ShowText() { + static public void ShowText(byte aChar, int aOffset) { unsafe { - byte* xTest = (byte*)0xB8000; - *xTest = 65; - xTest = (byte*)0xB8001; - *xTest = 0x0A; + byte* xTest = (byte*)0xB8000 + aOffset * 2; + *xTest = aChar; - xTest = (byte*)0xB8002; - *xTest = 90; - xTest = (byte*)0xB8003; + xTest++; *xTest = 0x0A; } } diff --git a/Cosmos/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Devices/Processor.cs b/Cosmos/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Devices/Processor.cs index 60afc5cdf..e32143222 100644 --- a/Cosmos/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Devices/Processor.cs +++ b/Cosmos/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Devices/Processor.cs @@ -6,7 +6,7 @@ namespace Cosmos.Platform.PC.Devices { public class Processor : HAL.Devices.Processor { public override ulong SetOption(uint aID, ulong aValue = 0) { if (aID == 0) { - CPU.x86.TempDebug.ShowText(); + CPU.x86.TempDebug.ShowText(66, 1); } return 0; } diff --git a/Cosmos/source/Kernel-X86/30-HAL/Cosmos.HAL/DeviceMgr.cs b/Cosmos/source/Kernel-X86/30-HAL/Cosmos.HAL/DeviceMgr.cs index 2e85562f1..c6fa430ab 100644 --- a/Cosmos/source/Kernel-X86/30-HAL/Cosmos.HAL/DeviceMgr.cs +++ b/Cosmos/source/Kernel-X86/30-HAL/Cosmos.HAL/DeviceMgr.cs @@ -24,7 +24,7 @@ namespace Cosmos.HAL { mAll.Add(aDevice); if (aDevice is Processor) { - + mProcessor = (Processor)aDevice; } } } diff --git a/Cosmos/source/Kernel-X86/50-Application/Boot.cs b/Cosmos/source/Kernel-X86/50-Application/Boot.cs index 6cf9b6587..45c94c8bc 100644 --- a/Cosmos/source/Kernel-X86/50-Application/Boot.cs +++ b/Cosmos/source/Kernel-X86/50-Application/Boot.cs @@ -6,7 +6,8 @@ namespace KernelGen3 { static public class Boot { [BootEntry] static private void Init() { - Cosmos.CPU.x86.TempDebug.ShowText(); + Cosmos.CPU.x86.TempDebug.ShowText(65, 0); + Cosmos.CPU.x86.TempDebug.ShowText(66, 1); //Cosmos.System.Boot.TempDebugTest(); while (true) { From 2860386c4e8c9a3caa4e7649b669596e0fa5ef7d Mon Sep 17 00:00:00 2001 From: Kudzu Date: Tue, 8 Aug 2017 14:30:52 -0400 Subject: [PATCH 2/2] g3 --- .../Kernel-X86/10-CPU/Cosmos.CPU.x86/TempDebug.cs | 11 ++++++----- .../Cosmos.Platform.PC/Devices/Processor.cs | 2 +- Cosmos/source/Kernel-X86/50-Application/Boot.cs | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Cosmos/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/TempDebug.cs b/Cosmos/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/TempDebug.cs index df6bb4c0f..38a4404a3 100644 --- a/Cosmos/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/TempDebug.cs +++ b/Cosmos/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/TempDebug.cs @@ -2,13 +2,14 @@ namespace Cosmos.CPU.x86 { static public class TempDebug { - static public void ShowText(byte aChar, int aOffset) { + unsafe static byte* mPtr = (byte*)(0xB8000 - 1); + static public void ShowText(char aChar) { unsafe { - byte* xTest = (byte*)0xB8000 + aOffset * 2; - *xTest = aChar; + mPtr++; + *mPtr = (byte)aChar; - xTest++; - *xTest = 0x0A; + mPtr++; + *mPtr = 0x0A; } } } diff --git a/Cosmos/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Devices/Processor.cs b/Cosmos/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Devices/Processor.cs index e32143222..a48109478 100644 --- a/Cosmos/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Devices/Processor.cs +++ b/Cosmos/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Devices/Processor.cs @@ -6,7 +6,7 @@ namespace Cosmos.Platform.PC.Devices { public class Processor : HAL.Devices.Processor { public override ulong SetOption(uint aID, ulong aValue = 0) { if (aID == 0) { - CPU.x86.TempDebug.ShowText(66, 1); + CPU.x86.TempDebug.ShowText('C'); } return 0; } diff --git a/Cosmos/source/Kernel-X86/50-Application/Boot.cs b/Cosmos/source/Kernel-X86/50-Application/Boot.cs index 45c94c8bc..0c8847562 100644 --- a/Cosmos/source/Kernel-X86/50-Application/Boot.cs +++ b/Cosmos/source/Kernel-X86/50-Application/Boot.cs @@ -6,8 +6,8 @@ namespace KernelGen3 { static public class Boot { [BootEntry] static private void Init() { - Cosmos.CPU.x86.TempDebug.ShowText(65, 0); - Cosmos.CPU.x86.TempDebug.ShowText(66, 1); + Cosmos.CPU.x86.TempDebug.ShowText('A'); + Cosmos.CPU.x86.TempDebug.ShowText('c'); //Cosmos.System.Boot.TempDebugTest(); while (true) {