1 ; -*- coding: utf-8 -*-
2 ; http://patorjk.com/software/taag/#p=display&f=Banner&t=Fast Forth
4 ; Fast Forth For Texas Instrument MSP430FRxxxx FRAM devices
5 ; Copyright (C) <2015> <J.M. THOORENS>
7 ; This program is free software: you can redistribute it and/or modify
8 ; it under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation, either version 3 of the License, or
10 ; (at your option) any later version.
12 ; This program is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ; GNU General Public License for more details.
17 ; You should have received a copy of the GNU General Public License
18 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ;X .S -- print <number> of cells and stack contents if not empty
26 .word lit,08h,EMIT ; backspace
27 .word lit,'>',EMIT,SPACE
28 .word SPFETCH,lit,PSTACK,ULESS
30 .word SPFETCH,lit,PSTACK-2,xdo
31 DOTS1: .word II,FETCH,UDOT
36 ;Z ? adr -- display the content of adr
41 ;X WORDS -- list all words in all dicts. 53 words
48 ; vvvvvvvv may be skipped vvvvvvvv
49 .word CR ; type # of threads in vocabularies
52 .byte 23,"monothread vocabularies"
54 ; ^^^^^^^^ may be skipped ^^^^^^^^
57 WORDS1 .word DUP,CELLPLUS,SWAP
62 WORDS3 .word FETCH,QDUP
65 .word lit,07Fh,ANDD,TYPE
66 .word CFETCH,lit,0Fh,ANDD
67 .word lit,10h,SWAP,MINUS
68 .word SPACES,lit,2,MINUS
81 ; vvvvvvvv may be skipped vvvvvvvv
83 .word LIT,0Ah,FBASE,STORE
84 .word CR ; type # of threads in vocabularies
88 .byte 20,"threads vocabularies"
91 ; ^^^^^^^^ may be skipped ^^^^^^^^
95 WORDS1 .word DUP,CELLPLUS,SWAP
102 .word LIT,THREADS,DUP,PLUS
105 WORDS2 .word LIT,0,DUP
106 .word LIT,THREADS,DUP,PLUS ; I = ptr = thread*2
110 .word II,LIT,PAD,PLUS,FETCH ; old MAX NFA U< NFA ?
111 .word ULESS,QBRAN,WORDS4 ; no
112 .word DROP,DROP,II ; yes, replace old MAX of NFA by new MAX of NFA
113 .word DUP,LIT,PAD,PLUS,FETCH ;
114 WORDS4 .word LIT,2,xploop,WORDS3 ; 2 +LOOP
115 .word QDUP ; MAX of NFA = 0 ?
116 .word QBRAN,WORDS5 ; WHILE
117 .word DUP,LIT,2,MINUS,FETCH ; replace NFA MAX by its [LFA]
118 .word ROT,LIT,PAD,PLUS,STORE
119 .word DUP,COUNT ; display NFA MAX in 10 chars format
120 .word lit,07Fh,ANDD,TYPE
121 .word CFETCH,lit,0Fh,ANDD
122 .word lit,10h,SWAP,MINUS
124 .word BRAN,WORDS2 ; REPEAT
125 WORDS5 .word DROP,DROP
127 .word BRAN,WORDS1 ; REPEAT
134 .IFNDEF ANS_CORE_COMPLIANT
136 ;C MAX n1 n2 -- n3 signed maximum
138 MAX: CMP @PSP,TOS ; n2-n1
143 ;C MIN n1 n2 -- n3 signed minimum
145 MIN: CMP @PSP,TOS ; n2-n1
152 ;X U.R u n -- display u unsigned in n width
155 .word TOR,LESSNUM,lit,0,NUM,NUMS,NUMGREATER
156 .word RFROM,OVER,MINUS,lit,0,MAX,SPACES,TYPE
163 ADD @PSP,TOS ; compute end address
164 AND #0FFF0h,0(PSP) ; compute start address
166 .word SWAP,xdo ; generate line
168 .word II,lit,7,UDOTR,SPACE ; generate address
169 .word II,lit,10h,PLUS,II,xdo ; display 16 bytes
170 DUMP2 .word II,CFETCH,lit,3,UDOTR
173 .word II,lit,10h,PLUS,II,xdo ; display 16 chars
174 DUMP3 .word II,CFETCH
175 .word lit,7Eh,MIN,FBLANK,MAX,EMIT
177 .word lit,10h,xploop,DUMP1
178 .word RFROM,FBASE,STORE