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/>.
20 ;https://forth-standard.org/standard/core/DotR
23 ;https://forth-standard.org/standard/core/Zerone
26 ;https://forth-standard.org/standard/core/Zeromore
29 ;https://forth-standard.org/standard/core/TwotoR
32 ;https://forth-standard.org/standard/core/TwoRfrom
35 ;https://forth-standard.org/standard/core/TwoRFetch
38 ;https://forth-standard.org/standard/core/ColonNONAME
41 ;https://forth-standard.org/standard/core/ne
44 ;https://forth-standard.org/standard/core/qDO
47 ;https://forth-standard.org/standard/core/ACTION-OF
50 ; POSTPONE ['] POSTPONE DEFER@
55 FORTHWORDIMM "ACTION-OF"
57 .word STATE,FETCH,QBRAN,AOF1
58 .word BRACKETTICK,COMMA,DEFER@,COMMA,EXIT
59 AOF1 .word TICK,DEFER@,EXIT
61 ;https://forth-standard.org/standard/core/BUFFERColon
63 FORTHWORD "BUFFER" ; ( u "<name>" -- ; -- addr )
65 .word CREATE,ALLOT,EXIT
67 ;Z (C") -- c-addr run-time code for C"
68 ; get address and length of string.
69 XCQUOTE: SUB #2,PSP ; 1 -- x TOS ; push old TOS on stack
70 MOV TOS,0(PSP) ; 3 -- TOS x ; and reserve one cell on stack
71 MOV IP,TOS ; 2 -- c-addr ;
73 ADD W,IP ; 1 -- addr u IP=addr+u=addr(end_of_string)
74 BIT #1,IP ; 1 -- addr u IP=addr+u Carry set/clear if odd/even
75 ADDC #0,IP ; 1 -- addr u IP=addr+u aligned
78 ;https://forth-standard.org/standard/core/Cq
80 FORTHWORDIMM "C\34" ; immediate
82 .word lit,XCQUOTE,COMMA
85 ;https://forth-standard.org/standard/core/CASE
88 ;https://forth-standard.org/standard/core/COMPILEComma
93 ;https://forth-standard.org/standard/core/DEFERStore
94 ;C DEFER! xt CFA_DEFER -- ; store xt to the address after DODEFER
96 DEFERSTORE: MOV @PSP+,2(TOS) ; -- CFA_DEFER xt --> [CFA_DEFER+2]
100 ;https://forth-standard.org/standard/core/DEFERFetch
106 ;https://forth-standard.org/standard/core/ENDCASE
109 ;https://forth-standard.org/standard/core/ENDOF
112 ;https://forth-standard.org/standard/core/HOLDS
115 ;https://forth-standard.org/standard/core/MARKER
118 ;https://forth-standard.org/standard/core/OF
121 ;https://forth-standard.org/standard/core/PARSE
124 ;https://forth-standard.org/standard/core/PARSE-NAME
127 ;https://forth-standard.org/standard/core/PICK
130 ;https://forth-standard.org/standard/core/REFILL
133 ;https://forth-standard.org/standard/core/RESTORE-INPUT
136 ;https://forth-standard.org/standard/core/ROLL
139 ;https://forth-standard.org/standard/core/SAVE-INPUT
142 ;https://forth-standard.org/standard/core/SOURCE-ID
145 ;https://forth-standard.org/standard/core/Seq
148 ;https://forth-standard.org/standard/core/TO
153 ;https://forth-standard.org/standard/core/TRUE
156 ;https://forth-standard.org/standard/core/TUCK
159 ;https://forth-standard.org/standard/core/UDotR
162 ;https://forth-standard.org/standard/core/Umore
165 ;https://forth-standard.org/standard/core/UNUSED
168 ;https://forth-standard.org/standard/core/VALUE
173 ;https://forth-standard.org/standard/core/WITHIN
176 ;https://forth-standard.org/standard/core/BracketCOMPILE