-; http://patorjk.com/software/taag/#p=display&f=Banner&t=Fast Forth
-
-; Fast Forth For Texas Instrument MSP430FRxxxx FRAM devices
-; Copyright (C) <2015> <J.M. THOORENS>
-;
-; This program is free software: you can redistribute it and/or modify
-; it under the terms of the GNU General Public License as published by
-; the Free Software Foundation, either version 3 of the License, or
-; (at your option) any later version.
-;
-; This program is distributed in the hope that it will be useful,
-; but WITHOUT ANY WARRANTY; without even the implied warranty of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-; GNU General Public License for more details.
-;
-; You should have received a copy of the GNU General Public License
-; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-
- FORTHWORD "{UTILITY}"
- mNEXT
+
+ FORTHWORD "{TOOLS}"
+ MOV @IP+,PC
+
+ .IFNDEF TOR
+; https://forth-standard.org/standard/core/toR
+; >R x -- R: -- x push to return stack
+ FORTHWORD ">R"
+TOR PUSH TOS
+ MOV @PSP+,TOS
+ MOV @IP+,PC
+ .ENDIF
+
+ .IFNDEF ANDD
+;https://forth-standard.org/standard/core/AND
+;C AND x1 x2 -- x3 logical AND
+ FORTHWORD "AND"
+ANDD AND @PSP+,TOS
+ MOV @IP+,PC
+ .ENDIF
+
+ .IFNDEF CFETCH
+;https://forth-standard.org/standard/core/CFetch
+;C C@ c-addr -- char fetch char from memory
+ FORTHWORD "C@"
+CFETCH MOV.B @TOS,TOS ;2
+ MOV @IP+,PC ;4
+ .ENDIF
+
+ .IFNDEF SPACE
+;https://forth-standard.org/standard/core/SPACE
+;C SPACE -- output a space
+ FORTHWORD "SPACE"
+SPACE SUB #2,PSP ;1
+ MOV TOS,0(PSP) ;3
+ MOV #20h,TOS ;2
+ MOV #EMIT,PC ;17~ 23~
+
+;https://forth-standard.org/standard/core/SPACES
+;C SPACES n -- output n spaces
+ FORTHWORD "SPACES"
+SPACES CMP #0,TOS
+ JZ SPACESNEXT2
+ PUSH IP
+ MOV #SPACESNEXT,IP
+ JMP SPACE ;25~
+SPACESNEXT .word $+2
+ SUB #2,IP ;1
+ SUB #1,TOS ;1
+ JNZ SPACE ;25~ ==> 27~ by space ==> 2.963 MBds @ 8 MHz
+ MOV @RSP+,IP ;
+SPACESNEXT2 MOV @PSP+,TOS ; -- drop n
+ MOV @IP+,PC ;
+
+ .ENDIF
+
+ .IFNDEF II
+; https://forth-standard.org/standard/core/I
+; I -- n R: sys1 sys2 -- sys1 sys2
+; get the innermost loop index
+ FORTHWORD "I"
+II SUB #2,PSP ;1 make room in TOS
+ MOV TOS,0(PSP) ;3
+ MOV @RSP,TOS ;2 index = loopctr - fudge
+ SUB 2(RSP),TOS ;3
+ MOV @IP+,PC ;4 13~
+ .ENDIF