Implement UTF16" to store UEFI-compatible string
authorJonas Hvid <mail@johv.dk>
Mon, 5 Oct 2020 01:38:54 +0000 (03:38 +0200)
committerJonas Hvid <mail@johv.dk>
Mon, 5 Oct 2020 01:38:54 +0000 (03:38 +0200)
uefi.f

diff --git a/uefi.f b/uefi.f
index bc030d1f245fbe62a6131a41ded5d5dc623bea51..03587a8f27d771bc3f3a646f2a0b12473b5b73b1 100644 (file)
--- a/uefi.f
+++ b/uefi.f
@@ -2,6 +2,16 @@
 : ConOut.OutputString ConOut 8 + @ ;
 : ConOut.OutputString() ConOut SWAP ConOut.OutputString EFICALL2 ;
 
-HERE @
-  97 C, 0 C, 98 C, 0 C, 99 C, 0 C, \ "ABC\0"
-ConOut.OutputString()
+\ Store a null-terminated UTF-16 string HERE, and return a pointer to its buffer
+\ at runtime.
+: UTF16"
+  HERE @
+  BEGIN
+    KEY DUP C,
+    0 C,
+  34 = UNTIL
+  HERE @ 2 - HERE ! \ Remove final "
+  0 C, 0 C, \ Null terminator
+  ;
+
+UTF16" Hello UEFI!" ConOut.OutputString()