Hi all!
A UEFI application can use a Text Mode Console to show messages, but that is a Boot Service.
Boot Services are a system of programs that are using the processor. To take control you have to stop Boot Services, but then you can't see nothing because text console has gone

You need others mean to see messages, and could be interesting to have a console, I thinked a graphical one.
That can be maked easily but...
So far we used EfiBootServicesData memory type, but apparently this kind of memory is marked free when exit Boot Services, and can be overwrited after that.
Then MemAlloc requiere memory type:
; Procedure: MemAlloc_UEFI
; Purpose: Allocate a memory block.
; Arguments: Arg1: Memory block attributes [0, MEM_INIT_ZERO].
; Arg2: Memory block size in BYTEs.
; Arg3: Memory type
; Return: xax -> Memory block or NULL if failed.
align ALIGN_CODE
MemAlloc_UEFI proc uses xbx dAttr:DWORD, dMemSize:DWORD, dType:DWORD
local pMemBlock:POINTER
mov xbx, pBootServices
invoke [xbx].EFI_BOOT_SERVICES.AllocatePool, dType, dMemSize, addr pMemBlock
.ifBitSet xax, EFI_ERROR
xor eax, eax
.else
.ifBitSet dAttr, MEM_INIT_ZERO
invoke MemZero, pMemBlock, dMemSize
.endif
mov xax, pMemBlock
.endif
ret
MemAlloc_UEFI endp
and
MemAlloc macro MemSize:req, Flags:=<MEM_DEFAULT>
if TARGET_PLATFORM eq PLATFORM_WINDOWS
$$MemAttr = MEM_DEFAULT
if (Flags and MEM_INIT_ZERO)
$$MemAttr = $$MemAttr or HEAP_ZERO_MEMORY
endif
if (Flags and MEM_GENERATE_EXEPTION)
$$MemAttr = $$MemAttr or HEAP_GENERATE_EXCEPTIONS
endif
if (Flags and MEM_NO_SERIALIZE)
$$MemAttr = $$MemAttr or HEAP_NO_SERIALIZE
endif
invoke HeapAlloc, hProcessHeap, $$MemAttr, MemSize
elseif TARGET_PLATFORM eq PLATFORM_UEFI
ifndef PLATFORM_UEFI_MEMORY
PLATFORM_UEFI_MEMORY = EFI_MEMORY_TYPE_EfiBootServicesData
endif
invoke MemAlloc_UEFI, Flags, MemSize, PLATFORM_UEFI_MEMORY
endif
if DEBUGGING
.if xax == NULL
DbgWarning "MemAlloc failed"
.endif
endif
endm
then in the example:
PLATFORM_UEFI_MEMORY = EFI_MEMORY_TYPE_EfiLoaderData
New ConsoleUEFI
mov pGraphicConsole, xax
PLATFORM_UEFI_MEMORY = EFI_MEMORY_TYPE_EfiBootServicesData
This Graphic Console can be used in a dedicated system using all machine resources, or a UEFI loader can send it to an OS kernel.
In the example, after you press a key, application stop Boot Services, but Graphic Console continue showing messages.
Regards, HSE.