diff options
| author | amlal <amlal@el-mahrouss-logic.com> | 2024-03-23 10:22:31 +0100 |
|---|---|---|
| committer | amlal <amlal@el-mahrouss-logic.com> | 2024-03-23 10:22:31 +0100 |
| commit | 57834666259af373d19b560108ed7bb322b68adb (patch) | |
| tree | fdf1d4fdced47b0ebf8c90d8f8d9f54e852ad75f /Private/KernelKit | |
| parent | 77bf7cab39fef40797e8832aaef91abbdf0098f5 (diff) | |
Kernel: PS2 mouse builtin works now.
- But doesnt draw at the exact position, we need to fix that.
Signed-off-by: amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/KernelKit')
| -rw-r--r-- | Private/KernelKit/DebugOutput.hpp | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/Private/KernelKit/DebugOutput.hpp b/Private/KernelKit/DebugOutput.hpp index 0eb59da2..457bc9d1 100644 --- a/Private/KernelKit/DebugOutput.hpp +++ b/Private/KernelKit/DebugOutput.hpp @@ -45,7 +45,7 @@ class TerminalDevice final : public DeviceInterface<const Char *> { inline TerminalDevice end_line() { TerminalDevice selfTerm = TerminalDevice::Shared(); - selfTerm << "\n"; + selfTerm << "\r\n"; return selfTerm; } @@ -56,6 +56,30 @@ inline TerminalDevice carriage_return() { } namespace Detail { +inline TerminalDevice _write_number(const Long &x, TerminalDevice& term) { + int y = x / 10; + int h = x % 10; + + if (y) _write_number(y, term); + + /* fail if the number is not base-10 */ + if (h > 9) { + _write_number('?', term); + return term; + } + + if (y < 0) y = -y; + + const char NUMBERS[11] = "0123456789"; + + Char buf[2]; + buf[0] = NUMBERS[h]; + buf[1] = 0; + + term << buf; + return term; +} + inline TerminalDevice _write_number_hex(const Long &x, TerminalDevice& term) { int y = x / 16; int h = x % 16; @@ -70,7 +94,7 @@ inline TerminalDevice _write_number_hex(const Long &x, TerminalDevice& term) { if (y < 0) y = -y; - const char NUMBERS[17] = "0123456789ABCDEF"; + const char NUMBERS[17] = "0123456789"; Char buf[2]; buf[0] = NUMBERS[h]; @@ -90,6 +114,14 @@ inline TerminalDevice hex_number(const Long &x) { return selfTerm; } +inline TerminalDevice number(const Long &x) { + TerminalDevice selfTerm = TerminalDevice::Shared(); + + Detail::_write_number(x, selfTerm); + + return selfTerm; +} + inline TerminalDevice get_console_in(Char* buf) { TerminalDevice selfTerm = TerminalDevice::Shared(); selfTerm >> buf; |
