From e61444f10333631acaebd241b7c7bc35fa7cb2f2 Mon Sep 17 00:00:00 2001 From: Amlal EL Mahrouss Date: Sat, 3 Aug 2024 14:31:58 +0200 Subject: [unstable] [CG] [WIP] text printing. Signed-off-by: Amlal EL Mahrouss --- Boot/BootKit/Vendor/Qr.hxx | 2 +- Boot/Sources/HEL/AMD64/BootMain.cxx | 9 +- Kernel/FirmwareKit/EFI/API.hxx | 2 +- .../HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx | 2 +- Kernel/HALKit/AMD64/HalKernelMain.cxx | 2 +- Kernel/HALKit/AMD64/HalKernelMouse.cxx | 2 +- Kernel/HALKit/ARM64/HalKernelMain.cxx | 2 +- Kernel/Modules/CoreCG/Accessibility.hxx | 2 +- Kernel/Modules/CoreCG/CoreCG.hxx | 79 ------------ Kernel/Modules/CoreCG/CoreIMG.hxx | 13 -- Kernel/Modules/CoreCG/FbRenderer.hxx | 79 ++++++++++++ Kernel/Modules/CoreCG/TextRenderer.hxx | 141 +++++++++++++++++++++ Kernel/Sources/Main.cxx | 2 +- 13 files changed, 234 insertions(+), 103 deletions(-) delete mode 100644 Kernel/Modules/CoreCG/CoreCG.hxx delete mode 100644 Kernel/Modules/CoreCG/CoreIMG.hxx create mode 100644 Kernel/Modules/CoreCG/FbRenderer.hxx create mode 100644 Kernel/Modules/CoreCG/TextRenderer.hxx diff --git a/Boot/BootKit/Vendor/Qr.hxx b/Boot/BootKit/Vendor/Qr.hxx index 8799d824..365cd7d1 100644 --- a/Boot/BootKit/Vendor/Qr.hxx +++ b/Boot/BootKit/Vendor/Qr.hxx @@ -11,7 +11,7 @@ extern "C" { #include #include -#include +#include #include #include diff --git a/Boot/Sources/HEL/AMD64/BootMain.cxx b/Boot/Sources/HEL/AMD64/BootMain.cxx index 35565256..efd18ef5 100644 --- a/Boot/Sources/HEL/AMD64/BootMain.cxx +++ b/Boot/Sources/HEL/AMD64/BootMain.cxx @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include @@ -16,6 +16,7 @@ #include #include #include +#include #include // make the compiler shut up. @@ -202,7 +203,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, // ------------------------------------------ // CGInit(); - CGDrawInRegion(CGColor(0xaa, 0x00, 0x00), handoverHdrPtr->f_GOP.f_Height, handoverHdrPtr->f_GOP.f_Width, 0, 0); + CGDrawInRegion(CGColor(0xFF, 0xFF, 0xFF), handoverHdrPtr->f_GOP.f_Height, handoverHdrPtr->f_GOP.f_Width, 0, 0); CGFini(); // ---------------------------------------------------- // @@ -240,7 +241,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, if (readerKernel.Blob()) { loader = new Boot::ProgramLoader(readerKernel.Blob()); - loader->SetName("\"newoskrnl.exe\" (64-bit MP)"); + loader->SetName("\"newoskrnl.exe\" (64-bit SMP)"); } writer.Write("newosldr: Running: ").Write(loader->GetName()).Write("\r"); @@ -253,6 +254,8 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, // Call kernel. // ---------------------------------------------------- // + cg_write_text((UInt8*)"NEWOSKRNL", 0, 0, RGB(0x10, 0x10, 0x10)); + loader->Start(handoverHdrPtr); EFI::Stop(); diff --git a/Kernel/FirmwareKit/EFI/API.hxx b/Kernel/FirmwareKit/EFI/API.hxx index 3bb1fb76..1862e64f 100644 --- a/Kernel/FirmwareKit/EFI/API.hxx +++ b/Kernel/FirmwareKit/EFI/API.hxx @@ -23,7 +23,7 @@ class BTextWriter; #include #include #include -#include +#include #endif // ifdef __NEWBOOT__ inline EfiSystemTable* ST = nullptr; diff --git a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx index c50f683c..c845ce8e 100644 --- a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx +++ b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx @@ -154,7 +154,7 @@ namespace Kernel::HAL STATIC HAL::StackFramePtr cFramePtr = nullptr; STATIC Int32 cSMPInterrupt = 34; - /// @brief Current context getter. + /// @brief Gets the current context, used for context switching. /// @retval StackFramePtr the current context. EXTERN_C StackFramePtr _hal_leak_current_context(Void) { diff --git a/Kernel/HALKit/AMD64/HalKernelMain.cxx b/Kernel/HALKit/AMD64/HalKernelMain.cxx index 3439bd93..2eae6053 100644 --- a/Kernel/HALKit/AMD64/HalKernelMain.cxx +++ b/Kernel/HALKit/AMD64/HalKernelMain.cxx @@ -5,7 +5,7 @@ ------------------------------------------- */ #include -#include +#include #include #include #include diff --git a/Kernel/HALKit/AMD64/HalKernelMouse.cxx b/Kernel/HALKit/AMD64/HalKernelMouse.cxx index 13ceac84..c31982c5 100644 --- a/Kernel/HALKit/AMD64/HalKernelMouse.cxx +++ b/Kernel/HALKit/AMD64/HalKernelMouse.cxx @@ -5,7 +5,7 @@ ------------------------------------------- */ #include -#include +#include #include #include #include diff --git a/Kernel/HALKit/ARM64/HalKernelMain.cxx b/Kernel/HALKit/ARM64/HalKernelMain.cxx index 18cf2f7d..0c58657a 100644 --- a/Kernel/HALKit/ARM64/HalKernelMain.cxx +++ b/Kernel/HALKit/ARM64/HalKernelMain.cxx @@ -5,7 +5,7 @@ ------------------------------------------- */ #include -#include +#include #include #include #include diff --git a/Kernel/Modules/CoreCG/Accessibility.hxx b/Kernel/Modules/CoreCG/Accessibility.hxx index 00e9529f..b098f626 100644 --- a/Kernel/Modules/CoreCG/Accessibility.hxx +++ b/Kernel/Modules/CoreCG/Accessibility.hxx @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/Kernel/Modules/CoreCG/CoreCG.hxx b/Kernel/Modules/CoreCG/CoreCG.hxx deleted file mode 100644 index fe257635..00000000 --- a/Kernel/Modules/CoreCG/CoreCG.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies - -------------------------------------------- */ - -#pragma once - -#include - -#define CGInit() Kernel::SizeT __GXCursor = 0 - -#define CGColor(R, G, B) RGB(R, G, B) - -#define cCGClearClr CGColor(0x0, 0x0, 0x0) - -#define CGFini() __GXCursor = 0 - -/// @brief Performs OR drawing on the framebuffer. -#define CGDrawBitMapInRegionA(ImgPtr, _Height, _Width, BaseX, BaseY) \ - __GXCursor = 0; \ - \ - for (Kernel::SizeT i = BaseX; i < (_Height + BaseX); ++i) \ - { \ - for (Kernel::SizeT u = BaseY; u < (_Width + BaseY); ++u) \ - { \ - *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ - 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ - i + \ - 4 * u))) |= (ImgPtr)[__GXCursor]; \ - \ - ++__GXCursor; \ - } \ - } - -/// @brief Draws a resource. -#define CGDrawBitMapInRegion(ImgPtr, _Height, _Width, BaseX, BaseY) \ - __GXCursor = 0; \ - \ - for (Kernel::SizeT i = BaseX; i < (_Height + BaseX); ++i) \ - { \ - for (Kernel::SizeT u = BaseY; u < (_Width + BaseY); ++u) \ - { \ - *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ - 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ - i + \ - 4 * u))) = (ImgPtr)[__GXCursor]; \ - \ - ++__GXCursor; \ - } \ - } - -/// @brief Cleans a resource. -#define CGClearRegion(_Height, _Width, BaseX, BaseY) \ - \ - for (Kernel::SizeT i = BaseX; i < _Height + BaseX; ++i) \ - { \ - for (Kernel::SizeT u = BaseY; u < _Width + BaseY; ++u) \ - { \ - *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ - 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ - i + \ - 4 * u))) = cCGClearClr; \ - } \ - } - -/// @brief Draws inside a zone. -#define CGDrawInRegion(_Clr, _Height, _Width, BaseX, BaseY) \ - \ - for (Kernel::SizeT i = BaseX; i < (_Width + BaseX); ++i) \ - { \ - for (Kernel::SizeT u = BaseY; u < (_Height + BaseY); ++u) \ - { \ - *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ - 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ - i + \ - 4 * u))) = _Clr; \ - } \ - } diff --git a/Kernel/Modules/CoreCG/CoreIMG.hxx b/Kernel/Modules/CoreCG/CoreIMG.hxx deleted file mode 100644 index bcaffc5c..00000000 --- a/Kernel/Modules/CoreCG/CoreIMG.hxx +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __CORECG_IMG_HXX__ -#define __CORECG_IMG_HXX__ - -#include - -namespace Kernel -{ - struct IMGContainerHeader; - struct IMGMetadataHeader; - -} // namespace Kernel - -#endif // ifndef __CORECG_IMG_HXX__ diff --git a/Kernel/Modules/CoreCG/FbRenderer.hxx b/Kernel/Modules/CoreCG/FbRenderer.hxx new file mode 100644 index 00000000..230e8822 --- /dev/null +++ b/Kernel/Modules/CoreCG/FbRenderer.hxx @@ -0,0 +1,79 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies + +------------------------------------------- */ + +#pragma once + +#include + +#define CGInit() Kernel::SizeT __GXCursor = 0 + +#define CGColor(R, G, B) RGB(R, G, B) + +#define cCGClearClr CGColor(0x0, 0x0, 0x0) + +#define CGFini() __GXCursor = 0 + +/// @brief Performs OR drawing on the framebuffer. +#define CGDrawBitMapInRegionA(ImgPtr, _Height, _Width, BaseX, BaseY) \ + __GXCursor = 0; \ + \ + for (Kernel::SizeT i = BaseX; i < (_Height + BaseX); ++i) \ + { \ + for (Kernel::SizeT u = BaseY; u < (_Width + BaseY); ++u) \ + { \ + *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + i + \ + 4 * u))) |= (ImgPtr)[__GXCursor]; \ + \ + ++__GXCursor; \ + } \ + } + +/// @brief Draws a resource. +#define CGDrawBitMapInRegion(ImgPtr, _Height, _Width, BaseX, BaseY) \ + __GXCursor = 0; \ + \ + for (Kernel::SizeT i = BaseX; i < (_Height + BaseX); ++i) \ + { \ + for (Kernel::SizeT u = BaseY; u < (_Width + BaseY); ++u) \ + { \ + *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + i + \ + 4 * u))) = (ImgPtr)[__GXCursor]; \ + \ + ++__GXCursor; \ + } \ + } + +/// @brief Cleans a resource. +#define CGClearRegion(_Height, _Width, BaseX, BaseY) \ + \ + for (Kernel::SizeT i = BaseX; i < _Height + BaseX; ++i) \ + { \ + for (Kernel::SizeT u = BaseY; u < _Width + BaseY; ++u) \ + { \ + *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + i + \ + 4 * u))) = cCGClearClr; \ + } \ + } + +/// @brief Draws inside a zone. +#define CGDrawInRegion(_Clr, _Height, _Width, BaseX, BaseY) \ + \ + for (Kernel::SizeT x_base = BaseX; x_base < (_Width + BaseX); ++x_base) \ + { \ + for (Kernel::SizeT y_base = BaseY; y_base < (_Height + BaseY); ++y_base) \ + { \ + *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + x_base + \ + 4 * y_base))) = _Clr; \ + } \ + } diff --git a/Kernel/Modules/CoreCG/TextRenderer.hxx b/Kernel/Modules/CoreCG/TextRenderer.hxx new file mode 100644 index 00000000..017cc612 --- /dev/null +++ b/Kernel/Modules/CoreCG/TextRenderer.hxx @@ -0,0 +1,141 @@ +#pragma once + +#include +#include + +#define FONT_SIZE_X 13 +#define FONT_SIZE_Y 8 +#define FONT_NOF_CHARS 95 + +inline const Kernel::UInt8 cFontBitmap[FONT_NOF_CHARS][FONT_SIZE_X] = { + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36}, + {0x00, 0x00, 0x00, 0x66, 0x66, 0xff, 0x66, 0x66, 0xff, 0x66, 0x66, 0x00, 0x00}, + {0x00, 0x00, 0x18, 0x7e, 0xff, 0x1b, 0x1f, 0x7e, 0xf8, 0xd8, 0xff, 0x7e, 0x18}, + {0x00, 0x00, 0x0e, 0x1b, 0xdb, 0x6e, 0x30, 0x18, 0x0c, 0x76, 0xdb, 0xd8, 0x70}, + {0x00, 0x00, 0x7f, 0xc6, 0xcf, 0xd8, 0x70, 0x70, 0xd8, 0xcc, 0xcc, 0x6c, 0x38}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1c, 0x0c, 0x0e}, + {0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c}, + {0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30}, + {0x00, 0x00, 0x00, 0x00, 0x99, 0x5a, 0x3c, 0xff, 0x3c, 0x5a, 0x99, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18, 0x00, 0x00}, + {0x00, 0x00, 0x30, 0x18, 0x1c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x03, 0x03}, + {0x00, 0x00, 0x3c, 0x66, 0xc3, 0xe3, 0xf3, 0xdb, 0xcf, 0xc7, 0xc3, 0x66, 0x3c}, + {0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x38, 0x18}, + {0x00, 0x00, 0xff, 0xc0, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0xe7, 0x7e}, + {0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x07, 0x7e, 0x07, 0x03, 0x03, 0xe7, 0x7e}, + {0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xff, 0xcc, 0x6c, 0x3c, 0x1c, 0x0c}, + {0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x07, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xff}, + {0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xc7, 0xfe, 0xc0, 0xc0, 0xc0, 0xe7, 0x7e}, + {0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x03, 0x03, 0xff}, + {0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e}, + {0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x03, 0x7f, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e}, + {0x00, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x30, 0x18, 0x1c, 0x1c, 0x00, 0x00, 0x1c, 0x1c, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06}, + {0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06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 0x66, 0x66, 0xc3}, + {0x00, 0x00, 0xff, 0xc0, 0xc0, 0x60, 0x30, 0x7e, 0x0c, 0x06, 0x03, 0x03, 0xff}, + {0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c}, + {0x00, 0x03, 0x03, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60}, + {0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18}, + {0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x30, 0x70}, + {0x00, 0x00, 0x7f, 0xc3, 0xc3, 0x7f, 0x03, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0}, + {0x00, 0x00, 0x7e, 0xc3, 0xc0, 0xc0, 0xc0, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x7f, 0xc3, 0xc3, 0xc3, 0xc3, 0x7f, 0x03, 0x03, 0x03, 0x03, 0x03}, + {0x00, 0x00, 0x7f, 0xc0, 0xc0, 0xfe, 0xc3, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x33, 0x1e}, + {0x7e, 0xc3, 0x03, 0x03, 0x7f, 0xc3, 0xc3, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0}, + {0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00}, + {0x38, 0x6c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x00}, + {0x00, 0x00, 0xc6, 0xcc, 0xf8, 0xf0, 0xd8, 0xcc, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0}, + {0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78}, + {0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xfe, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00}, + {0xc0, 0xc0, 0xc0, 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0x00, 0x00, 0x00, 0x00}, + {0x03, 0x03, 0x03, 0x7f, 0xc3, 0xc3, 0xc3, 0xc3, 0x7f, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xe0, 0xfe, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0xfe, 0x03, 0x03, 0x7e, 0xc0, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x00}, + {0x00, 0x00, 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0xc3, 0xe7, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00}, + {0xc0, 0x60, 0x60, 0x30, 0x18, 0x3c, 0x66, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0xff, 0x60, 0x30, 0x18, 0x0c, 0x06, 0xff, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x0f, 0x18, 0x18, 0x18, 0x38, 0xf0, 0x38, 0x18, 0x18, 0x18, 0x0f}, + {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, + {0x00, 0x00, 0xf0, 0x18, 0x18, 0x18, 0x1c, 0x0f, 0x1c, 0x18, 0x18, 0x18, 0xf0}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x8f, 0xf1, 0x60, 0x00, 0x00, 0x00}}; + +inline Kernel::Void cg_render_text_font(const Kernel::UInt8* bitmap, Kernel::Int32& x_dst, Kernel::Int32& y_dst, Kernel::Int32& color) +{ + Kernel::Int32 x, y; + Kernel::Int32 set; + + x = 0; + y = 0; + + for (; x < FONT_SIZE_X; x++) + { + for (y = 0; y < FONT_SIZE_Y; y++) + { + set = bitmap[x] & 1 << y; + + if (set) + CGDrawInRegion(color, 1, 1, (y_dst + y), (x_dst + x)); + } + } +} + +inline Kernel::Void cg_write_text(const Kernel::UInt8* text, Kernel::Int32 x_dst, Kernel::Int32 y_dst, Kernel::Int32 color) +{ + for (Kernel::SizeT i = 0; text[i] != 0; ++i) + { + if (text[i] == '\r' || + text[i] == '\n') + { + y_dst += FONT_SIZE_Y; + continue; + } + + cg_render_text_font(&cFontBitmap[text[i]][0], x_dst, y_dst, color); + x_dst += FONT_SIZE_X; + } +} \ No newline at end of file diff --git a/Kernel/Sources/Main.cxx b/Kernel/Sources/Main.cxx index a3877009..0e232402 100644 --- a/Kernel/Sources/Main.cxx +++ b/Kernel/Sources/Main.cxx @@ -8,7 +8,7 @@ ------------------------------------------- */ #include -#include +#include #include #include #include -- cgit v1.2.3