setos

拙OS
Log | Files | Refs | LICENSE

commit e5108957cd8ba470e98710225cbc9bf3203e5d08
parent 52aba32baf37039cefb77a77723c163338902195
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Tue,  2 Apr 2024 13:43:07 +0900

add control charactors to cons_putchar

Diffstat:
MLICENSE | 3+--
Asys/include/console.h | 21+++++++++++++++++++++
Msys/src/boot/boot.c | 7++++---
Asys/src/kernel/console.c | 169+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msys/src/kernel/draw.c | 4+++-
Msys/src/kernel/main.c | 10+++-------
6 files changed, 201 insertions(+), 13 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -9,4 +9,4 @@ OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -\ No newline at end of file +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/sys/include/console.h b/sys/include/console.h @@ -0,0 +1,20 @@ +// #include <libc.h> +// #include <draw.h> + +typedef struct AsciiFont { + int w, h; + uint8 glyph[128][16]; +} AsciiFont; + +typedef struct Console { + Window *win; + AsciiFont *font; + int w, h; + Point pos; // cursor position in charactors. +} Console; + +extern AsciiFont asciifont; +extern Console console; + +void cons_putchar(Console *cons, char c); +int cons_print(Console *cons, char *s); +\ No newline at end of file diff --git a/sys/src/boot/boot.c b/sys/src/boot/boot.c @@ -45,9 +45,6 @@ EfiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *systab) return stat; } UINT32 *frame_buffer = (UINT32 *)gop->Mode->FrameBufferBase; - for (UINTN i = 0; i < gop->Mode->FrameBufferSize/4; i++) { - frame_buffer[i] = 0x427f94; - } efi_printf("frame buffer: base: %x, size: %x\n", frame_buffer, gop->Mode->FrameBufferSize); @@ -101,6 +98,10 @@ EfiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *systab) gop->Mode->FrameBufferBase, gop->Mode->FrameBufferSize); + for (UINTN i = 0; i < gop->Mode->FrameBufferSize/4; i++) { + frame_buffer[i] = 0xffffea; + } + mmsize = 8196; stat = SystemTable->BootServices->GetMemoryMap(&mmsize, mmap, &mkey, &dsize, &dver); if (stat != EFI_SUCCESS) { diff --git a/sys/src/kernel/console.c b/sys/src/kernel/console.c @@ -0,0 +1,168 @@ +#include <libc.h> +#include <draw.h> +#include <console.h> + +void +cons_putchar(Console *con, char c) +{ + if (c < 0 || 0x7f <= c) { + return; + } + if (c == '\t') { + int n = 8 - con->pos.x % 8; + for (int i = 0; i < n; i++) { + cons_putchar(con, ' '); + } + return; + } + if (c == '\n') { + con->pos.x = 0; + con->pos.y++; + if (con->pos.y > con->h) { + con->pos.y = 0; // TODO: scroll. + } + return; + } + if (c < 0x20) { // other controll charactors. + return; + } + int x, y; + x = con->pos.x * con->font->w; + y = con->pos.y * con->font->h; + for (int i = 0; i < con->font->h; i++) { + for (int j = 0; j < con->font->w; j++) { + if (((con->font->glyph[(int)c][i] >> (con->font->w - j - 1)) & 1) == 0) { + pixel(con->win, (Point) {x + j, y + i}, con->win->bg); + } else { + pixel(con->win, (Point) {x + j, y + i}, con->win->fg); + } + } + } + con->pos.x++; + if (con->pos.x > con->w) { + con->pos.x = 0; + con->pos.y++; + if (con->pos.y > con->h) { + con->pos.y = 0; // TODO: scroll. + } + } +} + +int +cons_print(Console *con, char *s) +{ + int n = 0; + for(; *s; s++) { + cons_putchar(con, *s); + n++; + } + return n; +} + +Console console = { + &root_window, + &asciifont, + 80, 24, + {0, 0} +}; + +AsciiFont asciifont = { + 8, 16, + { + [0x20] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + [0x21] = {0x00, 0x18, 0x18, 0x18, 0x18, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00}, + [0x22] = {0x6c, 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + [0x23] = {0x00, 0x12, 0x12, 0x12, 0x7f, 0x24, 0x24, 0x24, 0x24, 0x24, 0xfe, 0x48, 0x48, 0x48, 0x48, 0x00}, + [0x24] = {0x10, 0x38, 0x54, 0x92, 0x92, 0x90, 0x50, 0x38, 0x14, 0x12, 0x92, 0x92, 0x54, 0x38, 0x10, 0x10}, + [0x25] = {0x01, 0x61, 0x92, 0x92, 0x94, 0x94, 0x68, 0x08, 0x10, 0x16, 0x29, 0x29, 0x49, 0x49, 0x86, 0x80}, + [0x26] = {0x00, 0x38, 0x44, 0x44, 0x44, 0x28, 0x10, 0x30, 0x4a, 0x8a, 0x84, 0x84, 0x4a, 0x31, 0x00, 0x00}, + [0x27] = {0x60, 0x20, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + [0x28] = {0x00, 0x02, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x04, 0x02}, + [0x29] = {0x00, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40}, + [0x2a] = {0x00, 0x00, 0x00, 0x00, 0x10, 0x92, 0x54, 0x38, 0x54, 0x92, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00}, + [0x2b] = {0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00}, + [0x2c] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x20, 0x40}, + [0x2d] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + [0x2e] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00}, + [0x2f] = {0x00, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00}, + [0x30] = {0x00, 0x18, 0x24, 0x24, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x24, 0x18, 0x00, 0x00}, + [0x31] = {0x00, 0x10, 0x10, 0x30, 0x50, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00}, + [0x32] = {0x00, 0x18, 0x24, 0x42, 0x42, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x40, 0x40, 0x7e, 0x00, 0x00}, + [0x33] = {0x00, 0x38, 0x44, 0x82, 0x82, 0x02, 0x04, 0x38, 0x04, 0x02, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00}, + [0x34] = {0x00, 0x08, 0x18, 0x18, 0x28, 0x28, 0x48, 0x48, 0x88, 0xfe, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00}, + [0x35] = {0x00, 0x7c, 0x40, 0x40, 0x40, 0xb8, 0xc4, 0x82, 0x02, 0x02, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00}, + [0x36] = {0x00, 0x38, 0x44, 0x40, 0x80, 0x80, 0xb8, 0xc4, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00}, + [0x37] = {0x00, 0xfe, 0x02, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00}, + [0x38] = {0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x44, 0x38, 0x44, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00}, + [0x39] = {0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x46, 0x3a, 0x02, 0x02, 0x82, 0x44, 0x38, 0x00, 0x00}, + [0x3a] = {0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00}, + [0x3b] = {0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x10, 0x00, 0x00}, + [0x3c] = {0x00, 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00, 0x00}, + [0x3d] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + [0x3e] = {0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00}, + [0x3f] = {0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x04, 0x08, 0x08, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00}, + [0x40] = {0x00, 0x18, 0x24, 0x42, 0x5a, 0xb5, 0xa5, 0xa5, 0xa5, 0x9a, 0x40, 0x40, 0x22, 0x1c, 0x00, 0x00}, + [0x41] = {0x00, 0x10, 0x10, 0x28, 0x28, 0x28, 0x44, 0x44, 0x44, 0x7c, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00}, + [0x42] = {0x00, 0xf0, 0x88, 0x84, 0x84, 0x84, 0x88, 0xf8, 0x84, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00}, + [0x43] = {0x00, 0x38, 0x44, 0x42, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x42, 0x44, 0x38, 0x00, 0x00}, + [0x44] = {0x00, 0xf0, 0x88, 0x84, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0x84, 0x88, 0xf0, 0x00, 0x00}, + [0x45] = {0x00, 0xfe, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00}, + [0x46] = {0x00, 0xfe, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00}, + [0x47] = {0x00, 0x18, 0x24, 0x42, 0x40, 0x80, 0x80, 0x8e, 0x82, 0x82, 0x82, 0x42, 0x66, 0x1a, 0x00, 0x00}, + [0x48] = {0x00, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00}, + [0x49] = {0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00}, + [0x4a] = {0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x42, 0x24, 0x18, 0x00, 0x00}, + [0x4b] = {0x00, 0x42, 0x42, 0x44, 0x44, 0x48, 0x58, 0x68, 0x64, 0x44, 0x42, 0x42, 0x41, 0x41, 0x00, 0x00}, + [0x4c] = {0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7e, 0x00, 0x00}, + [0x4d] = {0x00, 0x82, 0x82, 0xc6, 0xc6, 0xc6, 0xaa, 0xaa, 0xaa, 0x92, 0x92, 0x92, 0x92, 0x82, 0x00, 0x00}, + [0x4e] = {0x00, 0x82, 0xc2, 0xc2, 0xa2, 0xa2, 0x92, 0x92, 0x92, 0x8a, 0x8a, 0x86, 0x86, 0x82, 0x00, 0x00}, + [0x4f] = {0x00, 0x38, 0x44, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x44, 0x38, 0x00, 0x00}, + [0x50] = {0x00, 0xf8, 0x84, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00}, + [0x51] = {0x00, 0x38, 0x44, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xba, 0x44, 0x44, 0x38, 0x08, 0x06}, + [0x52] = {0x00, 0xf8, 0x84, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x88, 0x84, 0x84, 0x84, 0x82, 0x82, 0x00, 0x00}, + [0x53] = {0x00, 0x38, 0x44, 0x82, 0x82, 0x80, 0x60, 0x18, 0x04, 0x02, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00}, + [0x54] = {0x00, 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00}, + [0x55] = {0x00, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00}, + [0x56] = {0x00, 0x82, 0x82, 0x82, 0x82, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x00, 0x00}, + [0x57] = {0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0xaa, 0xaa, 0x6c, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00}, + [0x58] = {0x00, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x28, 0x28, 0x28, 0x44, 0x44, 0x82, 0x82, 0x00, 0x00}, + [0x59] = {0x00, 0x82, 0x82, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00}, + [0x5a] = {0x00, 0xfe, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0xfe, 0x00, 0x00}, + [0x5b] = {0x1e, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1e}, + [0x5c] = {0x00, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x00}, + [0x5d] = {0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf0}, + [0x5e] = {0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + [0x5f] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00}, + [0x60] = {0x30, 0x20, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + [0x61] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x3e, 0x42, 0x82, 0x82, 0x86, 0x7a, 0x00, 0x00}, + [0x62] = {0x00, 0x80, 0x80, 0x80, 0x80, 0xb8, 0xc4, 0x82, 0x82, 0x82, 0x82, 0x82, 0xc4, 0xb8, 0x00, 0x00}, + [0x63] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x80, 0x80, 0x80, 0x82, 0x44, 0x38, 0x00, 0x00}, + [0x64] = {0x00, 0x02, 0x02, 0x02, 0x02, 0x3a, 0x46, 0x82, 0x82, 0x82, 0x82, 0x82, 0x46, 0x3a, 0x00, 0x00}, + [0x65] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0xfe, 0x80, 0x82, 0x44, 0x38, 0x00, 0x00}, + [0x66] = {0x00, 0x0c, 0x10, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00}, + [0x67] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x44, 0x44, 0x44, 0x38, 0x40, 0x78, 0x84, 0x82, 0x82, 0x7c}, + [0x68] = {0x00, 0x40, 0x40, 0x40, 0x40, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}, + [0x69] = {0x00, 0x10, 0x10, 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00}, + [0x6a] = {0x00, 0x08, 0x08, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x60}, + [0x6b] = {0x00, 0x40, 0x40, 0x40, 0x40, 0x42, 0x44, 0x48, 0x50, 0x68, 0x44, 0x44, 0x42, 0x42, 0x00, 0x00}, + [0x6c] = {0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00}, + [0x6d] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00}, + [0x6e] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}, + [0x6f] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00}, + [0x70] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xc4, 0x82, 0x82, 0x82, 0x82, 0xc4, 0xb8, 0x80, 0x80, 0x80}, + [0x71] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x46, 0x82, 0x82, 0x82, 0x82, 0x46, 0x3a, 0x02, 0x02, 0x02}, + [0x72] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00}, + [0x73] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x60, 0x18, 0x06, 0x02, 0x42, 0x3c, 0x00, 0x00}, + [0x74] = {0x00, 0x00, 0x10, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00}, + [0x75] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00}, + [0x76] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00}, + [0x77] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x92, 0x92, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x00, 0x00}, + [0x78] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x44, 0x28, 0x28, 0x10, 0x28, 0x28, 0x44, 0x82, 0x00, 0x00}, + [0x79] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x18, 0x10, 0x10, 0x20, 0xc0}, + [0x7a] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0xfe, 0x00, 0x00}, + [0x7b] = {0x04, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04}, + [0x7c] = {0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}, + [0x7d] = {0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x40}, + [0x7e] = {0x00, 0x00, 0x00, 0x60, 0x92, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + } +}; +\ No newline at end of file diff --git a/sys/src/kernel/draw.c b/sys/src/kernel/draw.c @@ -20,7 +20,9 @@ init_root_window(RGBA32 *fb_base, int hres, int vres, int ppsl) void pixel(Window *dst, Point p, RGBA32 col) { - dst->fb[p.y * dst->ppsl + p.x] = col; + if (0 < p.x && p.x < dst->hres && 0 < p.y && p.y < dst->vres) { + dst->fb[p.y * dst->ppsl + p.x] = col; + } } void diff --git a/sys/src/kernel/main.c b/sys/src/kernel/main.c @@ -12,12 +12,8 @@ kernel_main(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) gop->Mode->Info->VerticalResolution, gop->Mode->Info->PixelsPerScanLine ); - for (int i = 0; i < 5000; i++) { - put_glyph(&console, i % 128); - } - put_glyph(&console, 'a'); - put_glyph(&console, 'a'); - put_glyph(&console, 'a'); - put_glyph(&console, 'a'); + cons_print(&console, "Hello, World!\nNew Line.\tTab\tTab\n"); + cons_print(&console, "1234567812345678123456781234567812345678123456781234567812345678\n"); + cons_print(&console, "1\t22\t333\t4444\t55555\t666666\t7777777\t88888888\t9"); for(;;); } \ No newline at end of file