git: a5c44db625cb - stable/12 - loader: provide u> and xemit words if needed

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 08 Oct 2021 16:08:58 UTC
The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=a5c44db625cb1bf34b86573411d6ce1f1b8f3fed

commit a5c44db625cb1bf34b86573411d6ce1f1b8f3fed
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2019-09-17 18:05:33 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 08:05:18 +0000

    loader: provide u> and xemit words if needed
    
    We have external interpreter (userboot.so) which may be lagging behind
    with updates and may be missing u> xemit words.
    
    (cherry picked from commit 68861a62f5363e6984ba96efe6463e882a9c4896)
---
 stand/forth/loader.4th | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/stand/forth/loader.4th b/stand/forth/loader.4th
index df532440e26a..89ea9efc4171 100644
--- a/stand/forth/loader.4th
+++ b/stand/forth/loader.4th
@@ -27,6 +27,29 @@
 
 only forth definitions
 
+\ provide u> if needed
+s" u>" sfind [if] drop [else]
+	drop
+: u>
+	2dup u< if 2drop 0 exit then
+	swap u< if -1 exit then
+	0
+;
+[then]
+
+\ provide xemit if needed
+s" xemit" sfind [if] drop [else]
+	drop
+: xemit
+	dup 0x80 u< if emit exit then
+	0 swap 0x3F
+	begin 2dup u> while
+		2/ >r dup 0x3F and 0x80 or swap 6 rshift r>
+	repeat 0x7F xor 2* or
+	begin dup 0x80 u< 0= while emit repeat drop
+;
+[then]
+
 s" arch-i386" environment? [if] [if]
 	s" loader_version" environment?  [if]
 		11 < [if]