commit 39b8b98d3ef6b0b63a52f80c792fdb945cd53b82
parent 3b7ccfa7feacf8ec38c73b41acc00df5502c15fd
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Thu, 25 May 2023 08:20:24 -0400
rpi: add wnf prompt
Diffstat:
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/fs/xcomp/arm/rpi/kernel.fs b/fs/xcomp/arm/rpi/kernel.fs
@@ -22,13 +22,17 @@ $11000 const DICTIONARY
mov) r0 rd) swap ( ncycles ) i) ,)
pc sub) r0 rd) r0 rn) 1 i) f) ,) ( pc ) abs>rel b) ne) ,) ;
+: pc>reg, ( pc r -- )
+ dip pc -^ 8 + | ( off r )
+ mov) over rd) rPC rm) ,)
+ sub) swap rd) swap i) ,) ;
+
: values ( n -- ) for 0 value next ;
-6 values lblemit lblkey lblrtype lblword lblstype lblmsg
+7 values lblemit lblkey lblrtype lblword lblstype lblprompt lblwnf
$8000 to binstart
0 align4 here to org
forward b) ,)
-pc to lblmsg 12 c, ," Hello World!" 0 align4
pc to lblemit ( c -- )
ldr) r3 rd) r7 rn) UART0_FR +i) ,)
tst) r3 rn) $20 i) ,)
@@ -77,6 +81,20 @@ pc to lblword \ str in CURWORD
str) r2 rd) r1 rn) 8b) ,)
lret,
+pc 12 c, ," Hello World!" 0 align4
+pc to lblprompt
+ ( pc ) r0 pc>reg,
+ r0 ppush,
+ lblstype abs>rel b) ,)
+
+pc 15 c, ," word not found" 0 align4
+pc to lblwnf
+ mov) r0 rd) CURWORD i) ,)
+ r0 ppush,
+ lblstype abscall,
+ ( pc ) r0 pc>reg,
+ r0 ppush,
+ lblstype abs>rel b) ,)
forward!
mov) rSP rd) binstart i) ,) \ RSP
sub) r10 rd) rSP rn) $1000 i) ,) \ PSP
@@ -115,14 +133,8 @@ str) r1 rd) r7 rn) UART0_IMSC +i) ,)
mov) r1 rd) $300 i) ,) add) r1 rd) r1 rn) $01 i) ,)
str) r1 rd) r7 rn) UART0_CR +i) ,)
-mov) r1 rd) binstart i) ,)
-add) r1 rd) r1 rn) lblmsg binstart - i) ,)
-r1 ppush,
-lblstype abs>rel bl) ,)
-
+lblprompt abs>rel bl) ,)
pc
lblword abs>rel bl) ,)
- mov) r1 rd) CURWORD i) ,)
- r1 ppush,
- lblstype abs>rel bl) ,)
+ lblwnf abs>rel bl) ,)
abs>rel b) ,)