Obviously, this doesn't work with the Linux backend. Maybe we'll have to remove
that again, since it would basically require a UEFI emulator.
dq BRANCH, -8 * 2
dq TERMINATE
+;; EFI:
+
+forth EFI_SYSTEM_TABLE_CONSTANT, 'SystemTable'
+ dq LIT, system_table, GET
+ dq EXIT
+
+forth_asm EFICALL2, 'EFICALL2'
+ pop rax ; function pointer
+ pop rdx ; 2nd argument
+ pop rcx ; 1st argument
+
+ push rsi
+
+ sub rsp, 32
+ call rax
+ add rsp, 32
+
+ pop rsi
+
+ next
+
;; Built-in variables:
forth STATE, 'STATE'
;; include the file directly in the binary, and then interpret it at startup.
sysf:
file 'sys.f'
-file 'example.f'
+file 'uefi.f'
sysf.len = $ - sysf
--- /dev/null
+: ConOut SystemTable 64 + @ ;
+: 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()