completely redesign how user mode memory is allocated, fix a few smp and scheduler bugs, terminating a process now terminates the process, telemetry, optimize text editor, new font, new color scheme
This commit is contained in:
1 parent
27b31f62b6
commit
325149006c
45 files changed
+2091
-760
No files matched your search
@@ -19,6 +19,9 @@ static int gCursorX = 0, gCursorY = 0;
|
||||
#define FONT_W 8
|
||||
#define FONT_H 16
|
||||
|
||||
#define SCREEN_DEFAULT_FG 0xCCCCCCu
|
||||
#define SCREEN_DEFAULT_BG 0x012456u
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 8x16 VGA font - printable ASCII only (glyph 0 = space = 0x20)
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -113,28 +116,36 @@ static void ScreenBlit(int x, int y, int w, int h, const uint32_t* pixels) {
|
||||
static void ScreenGetSize(int* w, int* h) { *w = gWidth; *h = gHeight; }
|
||||
|
||||
static void ScreenScroll(int lines) {
|
||||
if (lines <= 0 || lines >= gHeight) { ScreenClear(0); return; }
|
||||
if (lines <= 0)
|
||||
return;
|
||||
if (lines >= gHeight) {
|
||||
ScreenClear(SCREEN_DEFAULT_BG);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t rowBytes = (size_t)gStride * sizeof(uint32_t);
|
||||
uint32_t* shadow = gBackbuffer ? gBackbuffer : gFb;
|
||||
|
||||
memmove(shadow, shadow + lines * gStride,
|
||||
(size_t)(gHeight - lines) * rowBytes);
|
||||
// Clear the revealed rows at the bottom.
|
||||
memset(shadow + (gHeight - lines) * gStride, 0,
|
||||
(size_t)lines * rowBytes);
|
||||
|
||||
// Fill the revealed rows with the console background. Do not memset here:
|
||||
// the background color is not zero.
|
||||
uint32_t* fill = shadow + (gHeight - lines) * gStride;
|
||||
for (int y = 0; y < lines; y++) {
|
||||
for (int x = 0; x < gWidth; x++)
|
||||
fill[y * gStride + x] = SCREEN_DEFAULT_BG;
|
||||
}
|
||||
|
||||
ScreenFlushRows(0, gHeight);
|
||||
}
|
||||
|
||||
static void ScreenPutChar(char c, int x, int y, uint32_t fg, uint32_t bg) {
|
||||
if ((unsigned char)c < 0x20 || (unsigned char)c > 0x7E) c = '?';
|
||||
const uint8_t* glyph = Font8x16 + ((unsigned char)c - 0x20) * 16;
|
||||
const uint8_t* glyph = Font8x16 + ((uint8_t)c * 16);
|
||||
for (int row = 0; row < 16; row++) {
|
||||
uint8_t bits = glyph[row];
|
||||
for (int col = 0; col < 8; col++) {
|
||||
uint32_t color = (bits & (1 << col)) ? fg : bg; // i don't know why, i don't want to know why
|
||||
// i shouldn't have to wonder why but the font is backwards unless we do this terriblness
|
||||
uint32_t color = (bits & (0x80u >> col)) ? fg : bg;
|
||||
PutPixelRaw(x + col, y + row, color);
|
||||
}
|
||||
}
|
||||
@@ -321,5 +332,5 @@ void HalScreenInitialize(void* (*AllocatePool)(size_t size), uintptr_t fb, int w
|
||||
out->PrintChar = ScreenPrintChar;
|
||||
out->DrawCursor = HalScreenDrawCursor;
|
||||
out->EraseCursor = HalScreenEraseCursor;
|
||||
ScreenClear(0x000000);
|
||||
ScreenClear(SCREEN_DEFAULT_BG);
|
||||
}
|
||||
Reference in new issue
Block a user