X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=os%2Fuefi.asm;h=10c7627ffbe9042937d76ce73c55b483a06903bd;hb=61b721d365efaaae4d5ebb8d13972faa697be54b;hp=4f8ce56ef437f18b34fce4314a9d389a4500ecb2;hpb=bcba0c88f4eaddac8e0d8c0fa68264b2e81ee272;p=rrq%2Fjonasforth.git diff --git a/os/uefi.asm b/os/uefi.asm index 4f8ce56..10c7627 100644 --- a/os/uefi.asm +++ b/os/uefi.asm @@ -58,6 +58,14 @@ struct EFI_INPUT_KEY ;; }}} +macro os_code_section { + section '.text' code readable executable +} + +macro os_data_section { + section '.data' readable writable +} + section '.text' code executable readable os_initialize: @@ -129,7 +137,6 @@ os_print_string: ret os_read_char: - mov r15, rcx .read_key: mov rcx, [system_table] ; EFI_SYSTEM_TABLE* rcx mov rcx, [rcx + EFI_SYSTEM_TABLE.ConIn] ; EFI_SIMPLE_TEXT_INPUT_PROTOCOL* rcx @@ -143,19 +150,21 @@ os_read_char: cmp rax, r8 je .read_key - mov ax, [input_key.UnicodeChar] - mov [r15], al + movzx rax, word [input_key.UnicodeChar] ;; Special handling of enter (UEFI gives us '\r', but we want '\n'.) cmp ax, $D jne .no_enter - mov byte [r15], $A + mov al, $A .no_enter: + push rax ;; Print the character - mov rcx, r15 + mov [char_buffer], al + mov rcx, char_buffer mov rdx, 1 call os_print_string + pop rax ret