+
+: 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}}