commit fd6a1667359d3c2fc4ec0343f6f8d231687b83fc
parent fe2f87b354527599d3620196c5458ec321810461
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Fri, 9 Jun 2023 15:22:59 -0400
rpi: strings!
Diffstat:
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/fs/xcomp/rpiboot.fs b/fs/xcomp/rpiboot.fs
@@ -299,11 +299,17 @@ create _repl 3 nc, LF CR 0
drop in< dup _escapes 3 [c]? dup 0>= if nip _repl + c@ else drop then
then then ;
: ," begin "< dup -1 <> while c, repeat drop ;
-
-create _ 4 c, ," foo!"
-: foo _ stype ;
-create _ 4 c, ," bar!"
-: bar _ stype ;
-create _ 12 c, ," Hello World!"
-: prompt _ stype ;
+: ,[ [compile] ahead here [compile] [ ; immediate
+: ], ( jmp a -- ) here over - rot 0 align4 [compile] then swap litn litn ] ;
+: S"
+ compiling if [compile] ahead then
+ here 1 allot here ," here -^ ( a len ) over c!
+ compiling if swap 0 align4 [compile] then litn then ; immediate
+: ."
+ compiling if [compile] S" compile stype else
+ begin "< dup 0>= while emit repeat drop then ; immediate
+
+: foo ." foo!" ;
+: bar ." bar!" ;
+: prompt ." Hello World!" ;
uartinit prompt ' key ' in< realias