diff --git a/kernel/boot/bootx64.asm b/kernel/boot/bootx64.asm index 1b157df..cd00d6c 100644 --- a/kernel/boot/bootx64.asm +++ b/kernel/boot/bootx64.asm @@ -19,6 +19,15 @@ include '../const.inc' purge DQ ; because of some struct DQ in const.inc include 'uefi64.inc' +; rbx - efi table +; rcx - color = fore | back +proc set_text_color; uses rax + mov rax, rcx + mov rcx, [rbx+EFI_SYSTEM_TABLE.ConOut] + fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute], rcx, rax + ret +endp + proc main _efi_handle, _efi_table mov [efi_handle], rcx mov [efi_table], rdx @@ -28,8 +37,16 @@ proc main _efi_handle, _efi_table fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset], rcx, 1 test eax, eax jnz $ ; what can I do here? + + fstcall set_text_color, EFI_BLUE or EFI_BACKGROUND_GREEN + mov rcx, [rbx+EFI_SYSTEM_TABLE.ConOut] - fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], rcx, msg_hello_k64_loader + fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], rcx, msg_hello_k64_loader ; todo functions for write text like set_text_color + + fstcall set_text_color, EFI_LIGHTRED + + mov rcx, [rbx+EFI_SYSTEM_TABLE.ConOut] + fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], rcx, msg_2 jmp $ endp @@ -42,6 +59,7 @@ efi_table dq 0 section '.rodata' data readable msg_hello_k64_loader du "Hello from Kolibri64 efi loader",13,10,0 +msg_2 du "Lorem ipsum !",13,10,0 section '.reloc' fixups data discardable diff --git a/kernel/boot/uefi.inc b/kernel/boot/uefi.inc index a000d4d..c3946db 100644 --- a/kernel/boot/uefi.inc +++ b/kernel/boot/uefi.inc @@ -107,6 +107,35 @@ EFI_FILE_MODE_READ = 1 EFI_FILE_MODE_WRITE = 2 EFI_FILE_MODE_CREATE = 0x8000000000000000 +; foreground colors +EFI_BLACK = 0x00 +EFI_BLUE = 0x01 +EFI_GREEN = 0x02 +EFI_CYAN = 0x03 +EFI_RED = 0x04 +EFI_MAGENTA = 0x05 +EFI_BROWN = 0x06 +EFI_LIGHTGRAY = 0x07 +EFI_BRIGHT = 0x08 +EFI_DARKGRAY = 0x08 +EFI_LIGHTBLUE = 0x09 +EFI_LIGHTGREEN = 0x0A +EFI_LIGHTCYAN = 0x0B +EFI_LIGHTRED = 0x0C +EFI_LIGHTMAGENTA = 0x0D +EFI_YELLOW = 0x0E +EFI_WHITE = 0x0F + +; background colors +EFI_BACKGROUND_BLACK = 0x00 +EFI_BACKGROUND_BLUE = 0x10 +EFI_BACKGROUND_GREEN = 0x20 +EFI_BACKGROUND_CYAN = 0x30 +EFI_BACKGROUND_RED = 0x40 +EFI_BACKGROUND_MAGENTA = 0x50 +EFI_BACKGROUND_BROWN = 0x60 +EFI_BACKGROUND_LIGHTGRAY = 0x70 + struct EFI_MEMORY_DESCRIPTOR Type dd ? dd ? ; align