From 93a60aa18896bde0aa4107a161dca65e9290d23f Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Sun, 7 Feb 2021 11:15:55 -0800 Subject: [PATCH] Changed round prompt .s and numbers. --- ueforth/arduino/arduino_server.fs | 2 +- ueforth/common/ansi.fs | 1 - ueforth/common/boot.fs | 6 ++++-- ueforth/common/utils.fs | 6 ++---- ueforth/common/vocabulary.fs | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ueforth/arduino/arduino_server.fs b/ueforth/arduino/arduino_server.fs index f2f0385..00ce52f 100644 --- a/ueforth/arduino/arduino_server.fs +++ b/ueforth/arduino/arduino_server.fs @@ -3,7 +3,7 @@ also streams also WebServer also WiFi vocabulary web-interface also web-interface definitions -: n. ( n -- ) <# #s #> type ; : ip# dup 255 and n. [char] . emit 256 / ; +: ip# dup 255 and n. [char] . emit 256 / ; : ip. ( n -- ) ip# ip# ip# 255 and . ; r| diff --git a/ueforth/common/ansi.fs b/ueforth/common/ansi.fs index 10b1353..0d99cfc 100644 --- a/ueforth/common/ansi.fs +++ b/ueforth/common/ansi.fs @@ -1,6 +1,5 @@ ( ANSI Codes ) vocabulary ansi ansi definitions -: n. ( n -- ) base @ swap decimal <# #s #> type base ! ; : esc 27 emit ; : bel 7 emit ; : clear-to-eol esc ." [0K" ; : scroll-down esc ." D" ; diff --git a/ueforth/common/boot.fs b/ueforth/common/boot.fs index bfbe7ef..6a8fad1 100644 --- a/ueforth/common/boot.fs +++ b/ueforth/common/boot.fs @@ -161,6 +161,7 @@ variable hld : u. ( u -- ) <# #s #> type space ; : . ( w -- ) base @ 10 xor if u. exit then str type space ; : ? ( a -- ) @ . ; +: n. ( n -- ) base @ swap decimal <# #s #> type base ! ; ( Strings ) : parse-quote ( -- a n ) [char] " parse ; @@ -200,11 +201,12 @@ variable hld ( Examine Memory ) : dump ( a n -- ) cr 0 do i 16 mod 0= if cr then dup i + c@ . loop drop cr ; +: raw.s depth 0 max for aft sp@ r@ cells - @ . then next ; ( Input ) -variable echo +variable echo -1 echo ! : ?echo ( n -- ) echo @ if emit else drop then ; -: ?echo-prompt echo @ if ." --> " then ; +: ?echo-prompt echo @ if >r >r raw.s r> r> ." --> " then ; : accept ( a n -- n ) ?echo-prompt 0 swap begin 2dup < while key dup nl = if ?echo drop nip exit then diff --git a/ueforth/common/utils.fs b/ueforth/common/utils.fs index 7736849..c0b2290 100644 --- a/ueforth/common/utils.fs +++ b/ueforth/common/utils.fs @@ -1,7 +1,4 @@ -( Variable useful but non-critical words ) - -: .s ." <" depth <# #s #> type ." > " - depth 0 max for aft sp@ r@ cells - @ . then next cr ; +( Words built after boot ) : assert ( f -- ) 0= throw ; internals definitions @@ -10,5 +7,6 @@ internals definitions forth definitions also internals : str= ( a n a n -- f) >r swap r@ <> if rdrop 2drop 0 exit then r> mem= ; : startswith? ( a n a n -- f ) >r swap r@ < if rdrop 2drop 0 exit then r> mem= ; +: .s ." <" depth n. ." > " raw.s cr ; only forth definitions diff --git a/ueforth/common/vocabulary.fs b/ueforth/common/vocabulary.fs index 2b7e187..bde8db9 100644 --- a/ueforth/common/vocabulary.fs +++ b/ueforth/common/vocabulary.fs @@ -38,7 +38,7 @@ transfer{ (do) (?do) (+loop) parse-quote digit $@ see. see-loop >name-length exit= - see-one + see-one raw.s tib-setup input-limit }transfer forth definitions