diff --git a/src/userland/shell/main.c b/src/userland/shell/main.c index baa99e7..e5333d1 100644 --- a/src/userland/shell/main.c +++ b/src/userland/shell/main.c @@ -12,7 +12,7 @@ loadFromInitrd(inputBuffer); inputBufferPosition = 0; inputBuffer[inputBufferPosition] = '\0'; - printf("\n> "); + printf("> "); } void onKeyInput(uint32_t keycode, uint32_t stringId) { diff --git a/src/userland/shell/main.c b/src/userland/shell/main.c index baa99e7..e5333d1 100644 --- a/src/userland/shell/main.c +++ b/src/userland/shell/main.c @@ -12,7 +12,7 @@ loadFromInitrd(inputBuffer); inputBufferPosition = 0; inputBuffer[inputBufferPosition] = '\0'; - printf("\n> "); + printf("> "); } void onKeyInput(uint32_t keycode, uint32_t stringId) { diff --git a/src/userland/vga/cursor.c b/src/userland/vga/cursor.c index e69de29..8b67dbb 100644 --- a/src/userland/vga/cursor.c +++ b/src/userland/vga/cursor.c @@ -0,0 +1,9 @@ +#include +#include + +void setCursorOffset(uint16_t offset) { + ioOut(0x3D4, 0x0F, 1); + ioOut(0x3D5, (uint8_t)(offset & 0xFF), 1); + ioOut(0x3D4, 0x0E, 1); + ioOut(0x3D5, (uint8_t)((offset >> 8) & 0xFF), 1); +} diff --git a/src/userland/shell/main.c b/src/userland/shell/main.c index baa99e7..e5333d1 100644 --- a/src/userland/shell/main.c +++ b/src/userland/shell/main.c @@ -12,7 +12,7 @@ loadFromInitrd(inputBuffer); inputBufferPosition = 0; inputBuffer[inputBufferPosition] = '\0'; - printf("\n> "); + printf("> "); } void onKeyInput(uint32_t keycode, uint32_t stringId) { diff --git a/src/userland/vga/cursor.c b/src/userland/vga/cursor.c index e69de29..8b67dbb 100644 --- a/src/userland/vga/cursor.c +++ b/src/userland/vga/cursor.c @@ -0,0 +1,9 @@ +#include +#include + +void setCursorOffset(uint16_t offset) { + ioOut(0x3D4, 0x0F, 1); + ioOut(0x3D5, (uint8_t)(offset & 0xFF), 1); + ioOut(0x3D4, 0x0E, 1); + ioOut(0x3D5, (uint8_t)((offset >> 8) & 0xFF), 1); +} diff --git a/src/userland/vga/include/cursor.h b/src/userland/vga/include/cursor.h index 9f43270..264dc7a 100644 --- a/src/userland/vga/include/cursor.h +++ b/src/userland/vga/include/cursor.h @@ -1,4 +1,8 @@ #ifndef CURSOR_H #define CURSOR_H +#include + +extern void setCursorOffset(uint16_t offset); + #endif diff --git a/src/userland/shell/main.c b/src/userland/shell/main.c index baa99e7..e5333d1 100644 --- a/src/userland/shell/main.c +++ b/src/userland/shell/main.c @@ -12,7 +12,7 @@ loadFromInitrd(inputBuffer); inputBufferPosition = 0; inputBuffer[inputBufferPosition] = '\0'; - printf("\n> "); + printf("> "); } void onKeyInput(uint32_t keycode, uint32_t stringId) { diff --git a/src/userland/vga/cursor.c b/src/userland/vga/cursor.c index e69de29..8b67dbb 100644 --- a/src/userland/vga/cursor.c +++ b/src/userland/vga/cursor.c @@ -0,0 +1,9 @@ +#include +#include + +void setCursorOffset(uint16_t offset) { + ioOut(0x3D4, 0x0F, 1); + ioOut(0x3D5, (uint8_t)(offset & 0xFF), 1); + ioOut(0x3D4, 0x0E, 1); + ioOut(0x3D5, (uint8_t)((offset >> 8) & 0xFF), 1); +} diff --git a/src/userland/vga/include/cursor.h b/src/userland/vga/include/cursor.h index 9f43270..264dc7a 100644 --- a/src/userland/vga/include/cursor.h +++ b/src/userland/vga/include/cursor.h @@ -1,4 +1,8 @@ #ifndef CURSOR_H #define CURSOR_H +#include + +extern void setCursorOffset(uint16_t offset); + #endif diff --git a/src/userland/vga/main.c b/src/userland/vga/main.c index 067ef5a..f132276 100644 --- a/src/userland/vga/main.c +++ b/src/userland/vga/main.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -12,6 +13,7 @@ void writeChar(char character, char colorCode) { videoSource[offset] = ((uint16_t)colorCode << 8) | character; offset++; + setCursorOffset(offset); } void write(char c) { @@ -24,8 +26,8 @@ return; case '\b': offset--; - writeChar(' ', COLOR(white, black)); - offset--; + videoSource[offset] = ((uint16_t)COLOR(white, black) << 8) | ' '; + setCursorOffset(offset); return; } writeChar(c, COLOR(white, black));