--- qemu/roms/SLOF/slof/fs/base.fs 2018/04/24 19:25:57 1.1.1.2 +++ qemu/roms/SLOF/slof/fs/base.fs 2018/04/24 19:45:42 1.1.1.3 @@ -69,15 +69,6 @@ VARIABLE huge-tftp-load 1 huge-tftp-load 1- 2log 1+ ; -\ Standard compliant $find -: $find ( str len -- xt true | str len false ) - 2dup $find - IF - drop nip nip TRUE - ELSE - FALSE - THEN -; CREATE $catpad 100 allot : $cat ( str1 len1 str2 len2 -- str3 len3 ) @@ -121,6 +112,16 @@ CONSTANT <2constant> : str= ( str1 len1 str2 len2 -- equal? ) rot over <> IF 3drop false ELSE comp 0= THEN ; +: test-string ( param len -- true | false ) + 0 ?DO + dup i + c@ \ Get character / byte at current index + dup 20 < swap 7e > OR IF \ Is it out of range 32 to 126 (=ASCII) + drop FALSE UNLOOP EXIT \ FALSE means: No ASCII string + THEN + LOOP + drop TRUE \ Only ASCII found --> it is a string +; + : #aligned ( adr alignment -- adr' ) negate swap negate and negate ; : #join ( lo hi #bits -- x ) lshift or ; : #split ( x #bits -- lo hi ) 2dup rshift dup >r swap lshift xor r> ; @@ -155,6 +156,10 @@ CONSTANT <2constant> \ Duplicate string and replace \ with / : \-to-/ ( str len -- str' len ) strdup 2dup [char] \ [char] / replace-char ; +: isdigit ( char -- true | false ) + 30 39 between +; + : // dup >r 1- + r> / ; \ division, round up : c@+ ( adr -- c adr' ) dup c@ swap char+ ; @@ -256,6 +261,11 @@ CREATE "pad 100 allot THEN \ in temp buffer ; immediate + +\ Output the carriage-return character +: (cr carret emit ; + + \ Remove command old-name and all subsequent definitions : $forget ( str len -- )