reformat to 80 columns
[rrq/jonasforth.git] / init / uefi.f
1 : ConOut SystemTable 64 + @ ;
2 : ConOut.OutputString ConOut 8 + @ ;
3 : ConOut.OutputString() ConOut SWAP ConOut.OutputString EFICALL2 ;
4 : ConOut.ClearScreen() ConOut DUP 48 + @ EFICALL1 ;
5
6 : BootServices SystemTable 96 + @ ;
7 : BootServices.LocateProtocol BootServices 320 + @ ;
8 : GraphicsOutputProtocol
9   \ [TODO] It would be nice to cache this value, so we don't have to get it
10   \ every time.
11   \ (next line) *Protocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID
12   HERE @ 5348063987722529246 , 7661046075708078998 ,
13   0 \ *Registration
14   HERE @ 0 , \ **Interface
15   BootServices.LocateProtocol EFICALL3 DROP
16   HERE @ 8 - @ \ *Interface
17   ;
18 : GOP.Blt GraphicsOutputProtocol 16 + @ ;
19 : GOP.Blt() ( GOP buffer mode sx sy dx dy dw dh pitch -- )
20   GOP.Blt EFICALL10 0 = IF ELSE S" Warning: Invalid Blt()" TELL THEN ;
21 : GOP.SetMode GraphicsOutputProtocol 8 + @ ;
22
23 : EfiBltVideoFill 0 ;
24
25 \ Store a null-terminated UTF-16 string HERE, and return a pointer to
26 \ its buffer at runtime.
27 : UTF16"
28   HERE @
29   BEGIN
30     KEY DUP C,
31     0 C,
32   34 = UNTIL
33   HERE @ 2 - HERE ! \ Remove final "
34   0 C, 0 C, \ Null terminator
35   ;
36
37 \ Push length for null-terminated string ( s -- s n )
38 : @32
39   DUP BEGIN DUP C@ IF 1 + 0 ELSE 1 THEN UNTIL OVER -
40 ;
41
42 ConOut.ClearScreen()
43
44 \ Report Firmware Vendor
45 UTF16" Firmware vendor: " ConOut.OutputString()
46 SystemTable 24 + @ ConOut.OutputString()
47 UTF16"  version:" ConOut.OutputString()
48 SystemTable 32 +
49   SPACE DUP C@ .U 1 +
50   SPACE DUP C@ .U 1 +
51   SPACE DUP C@ .U 1 +
52   SPACE DUP C@ .U 1 +
53 DROP
54 NEWLINE