projects
/
rrq
/
jonasforth.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fe5967a
)
Refactor UEFI graphics code and move example to example.f
author
Jonas Hvid
<mail@johv.dk>
Fri, 9 Oct 2020 21:02:11 +0000
(23:02 +0200)
committer
Jonas Hvid
<mail@johv.dk>
Fri, 9 Oct 2020 21:02:11 +0000
(23:02 +0200)
example.f
patch
|
blob
|
history
uefi.f
patch
|
blob
|
history
diff --git
a/example.f
b/example.f
index 38cd6e4e69921d16fb6e9171b3129796161e085f..499f468773c06f4163b393900b4a70b1f6143662 100644
(file)
--- a/
example.f
+++ b/
example.f
@@
-17,5
+17,17
@@
10 FIB .U
SPACE S" (Expected: 59)" TELL NEWLINE ;
10 FIB .U
SPACE S" (Expected: 59)" TELL NEWLINE ;
+\ This example calls the Blt() function on UEFI's Graphics Output Protocol. See
+\ the UEFI specification and uefi.f for more information.
+: BLUE-SQUARE
+ GraphicsOutputProtocol
+ HERE @ 255 C, 0 C, 0 C, 0 C, \ Buffer with single blue pixel
+ EfiBltVideoFill
+ 0 0 \ Source
+ 100 100 20 20 \ Destination
+ 0
+ GOP.Blt() ;
+
HELLO
TEST-FIB
HELLO
TEST-FIB
+BLUE-SQUARE
diff --git
a/uefi.f
b/uefi.f
index 91ea453b8f2fab82b970125f28902ee7ed4840c5..3e17fc3a831fda3e0b0aeeb4cbd2755a4d7431c3 100644
(file)
--- a/
uefi.f
+++ b/
uefi.f
@@
-4,15
+4,21
@@
: BootServices SystemTable 96 + @ ;
: BootServices.LocateProtocol BootServices 320 + @ ;
: BootServices SystemTable 96 + @ ;
: BootServices.LocateProtocol BootServices 320 + @ ;
-: BootServices.LocateProtocol(GOP)
+: GraphicsOutputProtocol
+ \ [TODO] It would be nice to cache this value, so we don't have to get it
+ \ every time.
HERE @ 5348063987722529246 , 7661046075708078998 , \ *Protocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID
0 \ *Registration
HERE @ 0 , \ **Interface
BootServices.LocateProtocol EFICALL3 DROP
HERE @ 8 - @ \ *Interface
;
HERE @ 5348063987722529246 , 7661046075708078998 , \ *Protocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID
0 \ *Registration
HERE @ 0 , \ **Interface
BootServices.LocateProtocol EFICALL3 DROP
HERE @ 8 - @ \ *Interface
;
-: GOP.Blt BootServices.LocateProtocol(GOP) 16 + @ ;
-: GOP.SetMode BootServices.LocateProtocol(GOP) 8 + @ ;
+: GOP.Blt GraphicsOutputProtocol 16 + @ ;
+: GOP.Blt() ( GOP buffer mode sx sy dx dy dw dh pitch -- )
+ GOP.Blt EFICALL10 0 = IF ELSE S" Warning: Invalid Blt()" TELL THEN ;
+: GOP.SetMode GraphicsOutputProtocol 8 + @ ;
+
+: EfiBltVideoFill 0 ;
\ Store a null-terminated UTF-16 string HERE, and return a pointer to its buffer
\ at runtime.
\ Store a null-terminated UTF-16 string HERE, and return a pointer to its buffer
\ at runtime.
@@
-25,16
+31,3
@@
HERE @ 2 - HERE ! \ Remove final "
0 C, 0 C, \ Null terminator
;
HERE @ 2 - HERE ! \ Remove final "
0 C, 0 C, \ Null terminator
;
-
- BootServices.LocateProtocol(GOP) \ *This
- HERE @ 255 C, 0 C, 0 C, 0 C, \ *BltBuffer = single blue pixel
- 0 \ BltOperation = EfiBltVideoFill
- 0 \ SourceX
- 0 \ SourceY
- 100 \ DestinationX
- 200 \ DestinationY
- 400 \ Width
- 20 \ Height
- 0 \ Delta (unused)
-GOP.Blt EFICALL10
-.U NEWLINE