+ mov rcx, hello_string
+ mov rdx, hello_string.len
+ call print_string
+
+ mov rcx, char_buffer
+ call read_char
+
+ mov rcx, char_buffer
+ mov rdx, 1
+ call print_string
+
+ mov rcx, hello_string
+ mov rdx, hello_string.len
+ call print_string
+
+ ret
+
+;; Print a string of the given length.
+;;
+;; Inputs:
+;; - RCX = String buffer
+;; - RDX = String length
+print_string:
+ mov r8, rcx
+ mov r9, rdx
+
+ mov r10, r9
+ add r10, r10
+
+ ; We take an input string of bytes without any terminator. We need to turn
+ ; this string into a string of words, terminated by a null character.
+ mov rcx, 0
+ mov rsi, 0
+.copy_byte:
+ cmp rcx, r10
+ je .done
+
+ mov al, byte [r8 + rsi]
+ lea rdx, [.output_buffer + rcx]
+ mov byte [rdx], al
+ inc rcx
+ inc rsi
+
+ lea rdx, [.output_buffer + rcx]
+ mov byte [rdx], 0
+ inc rcx
+
+ jmp .copy_byte
+.done:
+ lea rdx, [.output_buffer + r10]
+ mov byte [rdx], 0
+
+ ; At this point we have our null-terminated word-string at .output_buffer. Now
+ ; we just need to print it.
+
+ mov rcx, [system_table] ; EFI_SYSTEM_TABLE* rcx
+ mov rcx, [rcx + EFI_SYSTEM_TABLE.ConOut] ; EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL* rcx
+ mov rdx, .output_buffer
+ mov rbx, [rcx + EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString] ; EFI_TEXT_STRING rbx
+ sub rsp, 32
+ call rbx
+ add rsp, 32
+ ret
+
+;; Read a character as an ASCII byte into the given buffer.
+;;
+;; Inputs:
+;; - RCX = Character buffer (1 byte)
+read_char:
+ mov r15, rcx
+.read_key: