+ DUP
+ NEWLINE DUP GUID.Tellname NEWLINE
+ IF 2DUP GUID= IF SWAP EXIT THEN GUID.next ELSE SWAP EXIT THEN
+ AGAIN
+;
+
+( *guid -- ; Print a GUID in parsable hex form )
+: GUID.Tell
+ DUP GUID.find GUID.Tellname
+ S" = {0x" TELL
+ DUP @ 4294967296 /MOD .U S" ,0x" TELL
+ 65536 /MOD .U S" ,0x" TELL .U
+ 8 + @ 8
+ BEGIN DUP 8 = IF S" ,{0x" ELSE S" ,0x" THEN TELL
+ SWAP 256 /MOD .U SWAP
+ 1 - DUP 0 =
+ UNTIL DROP DROP
+ S" }}" TELL
+;
+
+\ ##############################
+\ System table entry labelling
+
+SystemTable
+\ EFI_TABLE_HEADER
+8 FIELD* SystemTable.Signature
+4 FIELD* SystemTable.Revision
+4 FIELD* SystemTable.HeaderSize
+4 FIELD* SystemTable.CRC32
+4 FIELD* SystemTable.Reserved
+( CHAR16 ) FIELD@ FirmwareVendor
+4 FIELD* FirmwareRevision
+4 FIELD* FirmwareRevisionPad
+\ -- stdio
+( EFI_HANDLE ) FIELD@ ConsoleInHandle
+( EFI_SIMPLE_TEXT_INPUT_PROTOCOL ) FIELD@ ConIn
+( EFI_HANDLE ) FIELD@ ConsoleOutHandle
+( EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL ) FIELD@ ConOut
+( EFI_HANDLE ) FIELD@ StandardErrorHandle
+( EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL ) FIELD@ StdErr
+\ -- services
+( EFI_RUNTIME_SERVICES ) FIELD@ RuntimeServices
+( EFI_BOOT_SERVICES ) FIELD@ BootServices
+\ -- ConfigurationTable
+8 FIELD* SystemTable.NumberOfTableEntries \ UINTN = native size uint
+( EFI_CONFIGURATION_TABLE ) FIELD@ ConfigurationTable
+DROP
+
+\ ##############################
+\ : ConOut entry labelling
+
+ConOut
+( EFI_TEXT_RESET ) FIELD@ ConOut.Reset
+( EFI_TEXT_STRING ) FIELD@ ConOut.OutputString
+( EFI_TEXT_TEST_STRING ) FIELD@ ConOut.TestString
+( EFI_TEXT_QUERY_MODE ) FIELD@ ConOut.QueryMode
+( EFI_TEXT_SET_MODE ) FIELD@ ConOut.SetMode
+( EFI_TEXT_SET_ATTRIBUTE ) FIELD@ ConOut.SetAttribute
+( EFI_TEXT_CLEAR_SCREEN ) FIELD@ ConOut.ClearScreen
+( EFI_TEXT_SET_CURSOR_POSITION ) FIELD@ ConOut.SetCursorPosition
+( EFI_TEXT_ENABLE_CURSOR ) FIELD@ ConOut.EnableCursor
+( SIMPLE_TEXT_OUTPUT_MODE ) FIELD@ ConOut.Mode
+DROP
+
+: ConOut.OutputString() ConOut SWAP ConOut.OutputString EFICALL2 ;
+: ConOut.ClearScreen() ConOut ConOut.ClearScreen EFICALL1 ;
+
+\ ##############################
+\ BootServices entry labelling
+
+0 CONSTANT SearchKey.NONE
+
+\ ENUM EFI_LOCATE_SEARCH_TYPE
+0 CONSTANT SearchType.AllHandles
+1 CONSTANT SearchType.ByRegisterNotify
+2 CONSTANT SearchType.ByProtocol
+
+BootServices
+\ EFI_TABLE_HEADER
+8 FIELD* BootServices.Signature
+4 FIELD* BootServices.Revision
+4 FIELD* BootServices.HeaderSize
+4 FIELD* BootServices.CRC32
+4 FIELD* BootServices.Reserved
+\ Task Priority Services
+ FIELD@ RaiseTPL
+ FIELD@ RestoreTPL
+\ Memory Services
+ FIELD@ AllocatePages
+ FIELD@ FreePages
+ FIELD@ GetMemoryMap
+ FIELD@ AllocatePool
+ FIELD@ FreePool
+\ Event & Timer Services
+ FIELD@ CreateEvent
+ FIELD@ SetTimer
+ FIELD@ WaitForEvent
+ FIELD@ SignalEvent
+ FIELD@ CloseEvent
+ FIELD@ CheckEvent
+\ Protocol Handler Services
+ FIELD@ InstallProtocolInterface
+ FIELD@ ReinstallProtocolInterface
+ FIELD@ UninstallProtocolInterface
+ FIELD@ HandleProtocol
+ FIELD@ Reserved2
+ FIELD@ RegisterProtocolNotify
+ FIELD@ LocateHandle
+ FIELD@ LocateDevicePath
+ FIELD@ InstallConfigurationTable
+\ Image Services
+ FIELD@ LoadImage
+ FIELD@ StartImage
+ FIELD@ Exit
+ FIELD@ UnloadImage
+ FIELD@ ExitBootServices
+\ Miscellaneous Services
+ FIELD@ GetNextMonotonicCount
+ FIELD@ Stall
+ FIELD@ SetWatchdogTimer
+\ DriverSupport Services
+ FIELD@ ConnectController
+ FIELD@ DisconnectController
+\ Open and Close Protocol Services
+ FIELD@ OpenProtocol
+ FIELD@ CloseProtocol
+ FIELD@ OpenProtocolInformation
+\ Library Services
+ FIELD@ ProtocolsPerHandle
+ FIELD@ LocateHandleBuffer
+ FIELD@ LocateProtocol
+ FIELD@ InstallMultipleProtocolInterfaces
+ FIELD@ UninstallMultipleProtocolInterfaces
+\ 32-bit CRC Services
+ FIELD@ CalculateCrc32
+\ Miscellaneous Services
+ FIELD@ CopyMem
+ FIELD@ SetMem
+ FIELD@ CreateEventEx
+DROP
+
+( buffer -- )
+: BootServices.FreePool()
+ FreePool EFICALL1 \ No return value?
+;
+
+( handle, *guid -- *interface ; Queries a handle to determine if it supports
+ a specified protocol, and returns interface pointer or null )
+: BootServices.HandleProtocol()
+ HERE @ 0 OVER ! HandleProtocol EFICALL3
+ DUP IF S" **HandleProtocol: " TELL .U NEWLINE ELSE DROP THEN
+ HERE @ @
+;
+
+( Handle -- *buffer count ; Retrieves The List Of Protocol Interface
+ GUIDs that are installed on a handle in a buffer allocated from pool. )
+: BootServices.ProtocolsPerHandle()
+ HERE @ 0 , HERE @ 0 , ProtocolsPerHandle EFICALL3
+ HERE @ 16 - @ HERE @ 8 - @ HERE @ 16 - HERE !
+ ROT DUP IF S" **ProtocolsPerHandle: " TELL .U NEWLINE ELSE DROP THEN
+;
+
+( *guid *Registration -- *Interface ;
+ Returns the first protocol interface that matches the given protocol. )
+: BootServices.LocateProtocol()
+ HERE @ 0 OVER !
+ LocateProtocol EFICALL3
+ DUP IF S" **LocateProtocol: " TELL .U NEWLINE ELSE DROP THEN
+ HERE @ @
+;
+
+( *protocol type -- *array count ; locate handles )
+( returns array in allocated space )
+: BootServices.LocateHandleBuffer()
+ ( searchtype, protocol, searchkey, *count, *arrayp )
+ SWAP SearchKey.NONE HERE @ HERE @ 8 +
+ ( type *protocol searchkey *count **array )
+ LocateHandleBuffer EFICALL5
+ DUP IF S" **LocateHandleBuffer: " TELL .U NEWLINE ELSE DROP THEN
+ ( HERE@ = nohandles , *buffer )
+ HERE @ 8 + @ HERE @ @
+;
+
+( -- buffer* n ; locate handles )
+( returns array in allocated space )
+: BootServices.LocateHandleBuffer(AllHandles)
+ 0 SearchType.AllHandles BootServices.LocateHandleBuffer()
+;
+
+( protocol -- buffer* n ; locate handles )
+( returns array in allocated space )
+: BootServices.LocateHandleBuffer(ByProtocol)
+ SearchType.ByProtocol BootServices.LocateHandleBuffer()
+;
+
+\ ##############################
+\ GOP = GraphicsOutputProtocol
+
+GUID: GOP.GUID
+{0x9042a9de,0x23dc,0x4a38, {0x96,0xfb,0x7a,0xde,0xd0,0x80,0x51,0x6a}}
+
+GOP.GUID 0 BootServices.LocateProtocol()
+FIELD@ GOP.QueryMode
+FIELD@ GOP.SetMode
+FIELD@ GOP.Blt
+
+( guid buffer mode sx sy dx dy dw dh pitch -- )
+: GOP.Blt()
+ GOP.Blt EFICALL10 0 =
+ IF ELSE S" Warning: Invalid Blt()" TELL THEN
+;
+
+\ ##############################
+\ DPP = EFI_DEVICE_PATH_PROTOCOL
+GUID: DPP.GUID
+{0x09576e91,0x6d3f,0x11d2, {0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b}}
+
+( *protocol -- ; Tell about DPP protocol )
+: DPP.Tell
+ DUP @ 4294967295 &
+ 256 /MOD S" DPP{" TELL .
+ 256 /MOD S" ," TELL .
+ DUP S" ," TELL .
+ S" }" TELL
+ SWAP 4 + SWAP
+ .BYTES
+;
+
+\ ##############################
+\ EFI_BLOCK_IO_MEDIA struct
+
+
+\ ##############################
+\ BIP = EFI_BLOCK_IO_PROTOCOL
+GUID: BIP.GUID
+0x964e5b21,0x6459,0x11d2, {0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b}}
+
+\ ##############################
+\ LIP = LoadedImageProtocol
+GUID: LIP.GUID
+{0x5b1b31a1,0x9562,0x11d2, {0x8e,0x3f,0x00,0xa0,0xc9,0x69,0x72,0x3b}}
+
+\ ##############################
+\ SFSP = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
+GUID: SFSP.GUID
+0x0964e5b22,0x6459,0x11d2, {0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b}}