]> xenbits.xensource.com Git - freebsd.git/commitdiff
loader: provide u> and xemit words if needed
authortsoome <tsoome@FreeBSD.org>
Tue, 17 Sep 2019 18:05:33 +0000 (18:05 +0000)
committertsoome <tsoome@FreeBSD.org>
Tue, 17 Sep 2019 18:05:33 +0000 (18:05 +0000)
We have external interpreter (userboot.so) which may be lagging behind
with updates and may be missing u> xemit words.

stand/forth/loader.4th

index 6c2f7b378f6b2367a4921d013616a85cae949eb7..89d532fda317c78b9a3a9d78e6d7dec8f1b301ed 100644 (file)
 
 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]