Use Graphics Output Protocol to draw a rectangle
[rrq/jonasforth.git] / uefi.f
1 : ConOut SystemTable 64 + @ ;
2 : ConOut.OutputString ConOut 8 + @ ;
3 : ConOut.OutputString() ConOut SWAP ConOut.OutputString EFICALL2 ;
4
5 : BootServices SystemTable 96 + @ ;
6 : BootServices.LocateProtocol BootServices 320 + @ ;
7 : BootServices.LocateProtocol(GOP)
8   HERE @ 5348063987722529246 , 7661046075708078998 , \ *Protocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID
9   0 \ *Registration
10   HERE @ 0 , \ **Interface
11   BootServices.LocateProtocol EFICALL3 DROP
12   HERE @ 8 - @ \ *Interface
13   ;
14 : GOP.Blt BootServices.LocateProtocol(GOP) 16 + @ ;
15 : GOP.SetMode BootServices.LocateProtocol(GOP) 8 + @ ;
16
17 \ Store a null-terminated UTF-16 string HERE, and return a pointer to its buffer
18 \ at runtime.
19 : UTF16"
20   HERE @
21   BEGIN
22     KEY DUP C,
23     0 C,
24   34 = UNTIL
25   HERE @ 2 - HERE ! \ Remove final "
26   0 C, 0 C, \ Null terminator
27   ;
28
29   BootServices.LocateProtocol(GOP) \ *This
30   HERE @ 255 C, 0 C, 0 C, 0 C, \ *BltBuffer = single blue pixel
31   0 \ BltOperation = EfiBltVideoFill
32   0 \ SourceX
33   0 \ SourceY
34   100 \ DestinationX
35   200 \ DestinationY
36   400 \ Width
37   20 \ Height
38   0 \ Delta (unused)
39 GOP.Blt EFICALL10
40 .U NEWLINE