1 \ -*- coding: utf-8 -*-
7 ; display all FastForth compilation options
10 \ MSP_EXP430FR5739 MSP_EXP430FR5969 MSP_EXP430FR5994 MSP_EXP430FR6989
11 \ MSP_EXP430FR4133 CHIPSTICK_FR2433 MSP_EXP430FR2433 MSP_EXP430FR2355
13 \ drag and drop this file onto SendSourceFileToTarget.bat
14 \ then select your TARGET when asked.
20 \ https://forth-standard.org/standard/core/OVER
21 \ OVER x1 x2 -- x1 x2 x1
23 MOV TOS,-2(PSP) \ 3 -- x1 (x2) x2
24 MOV @PSP,TOS \ 2 -- x1 (x2) x1
25 SUB #2,PSP \ 1 -- x1 x2 x1
30 : CASE 0 ; IMMEDIATE \ -- #of-1
32 : OF \ #of-1 -- orgOF #of
34 >R \ move off the stack in case the control-flow stack is the data stack.
35 POSTPONE OVER POSTPONE = \ copy and test case value
36 POSTPONE IF \ add orig to control flow stack
37 POSTPONE DROP \ discards case value if =
38 R> \ we can bring count back now
41 : ENDOF \ orgOF #of -- orgENDOF #of
42 >R \ move off the stack in case the control-flow stack is the data stack.
44 R> \ we can bring count back now
47 : ENDCASE \ orgENDOF1..orgENDOFn #of --
57 \ https://forth-standard.org/standard/core/Plus
58 \ + n1/u1 n2/u2 -- n3/u3 add n1+n2
66 \ https://forth-standard.org/standard/core/AND
67 \ C AND x1 x2 -- x3 logical AND
76 \ https://forth-standard.org/standard/core/ROT
77 \ ROT x1 x2 x3 -- x2 x3 x1
79 MOV @PSP,W \ 2 fetch x2
80 MOV TOS,0(PSP) \ 3 store x3
81 MOV 2(PSP),TOS \ 3 fetch x1
82 MOV W,2(PSP) \ 3 store x2
88 \ https://forth-standard.org/standard/core/CFetch
89 \ C@ c-addr -- char fetch char from memory
96 [UNDEFINED] SPACES [IF]
97 \ https://forth-standard.org/standard/core/SPACES
98 \ SPACES n -- output n spaces
112 MOV @PSP+,TOS \ -- drop n
117 [UNDEFINED] UM/MOD [IF]
118 \ https://forth-standard.org/standard/core/UMDivMOD
119 \ UM/MOD udlo|udhi u1 -- r q unsigned 32/16->r16 q16
122 MOV #<#,X \ X = addr of <#
123 ADD #8,X \ X = addr of MUSMOD
124 MOV X,PC \ execute MUSMOD then RET to DROP
128 [UNDEFINED] WORDS [IF]
129 \ https://forth-standard.org/standard/tools/WORDS
130 \ list all words of vocabulary first in CONTEXT.
133 CONTEXT @ PAD_ORG \ -- VOC_BODY PAD MOVE all threads of VOC_BODY in PAD_ORG
134 INI_THREAD @ DUP + \ -- VOC_BODY PAD THREAD*2
135 MOVE \ -- vocabumary entries are copied in PAD_ORG
137 0 DUP \ -- ptr=0 MAX=0
138 INI_THREAD @ DUP + 0 \ -- ptr=0 MAX=0 THREADS*2 0
139 DO \ -- ptr MAX I = PAD_ptr = thread*2
140 DUP I PAD_ORG + @ \ -- ptr MAX MAX NFAx
141 U< IF \ -- ptr MAX if MAX U< NFAx
142 DROP DROP \ -- drop ptr and MAX
143 I DUP PAD_ORG + @ \ -- new_ptr new_MAX
146 ?DUP \ -- ptr MAX MAX | -- ptr 0 (all threads in PAD = 0)
147 WHILE \ -- ptr MAX replace it by its LFA
149 2 - @ \ -- ptr MAX [LFA]
150 ROT \ -- MAX [LFA] ptr
151 PAD_ORG + \ -- MAX [LFA] thread
152 ! \ -- MAX [LFA]=new_NFA updates PAD+ptr
154 COUNT $7F AND \ -- MAX addr count (with suppr. of immediate bit)
156 C@ $0F AND \ -- count_of_chars
157 $10 SWAP - SPACES \ -- complete with spaces modulo 16 chars
160 ; \ all threads in PAD are filled with 0
163 : ADDONS \ see "compute value of FORTHADDON" in file \inc\ThingsInFirst.inc
164 ESC ." [7m" \ escape sequence to set reverse video
165 ." KERNEL OPTIONS:" \ in reverse video
166 ESC ." [0m" \ escape sequence to clear reverse video
167 KERNEL_ADDON @ \ see ThingsInFirst.inc
169 DUP 0< IF CR ." 32.768kHz XTAL" THEN
170 DUP + DUP 0< IF DUP + CR ." HARDWARE (RTS/CTS) TERMINAL" \ 'DUP +' = one shift left
171 ELSE DUP + DUP 0< IF CR ." HARDWARE (RTS) TERMINAL" THEN
173 DUP + DUP 0< IF CR ." XON/XOFF TERMINAL" THEN
174 DUP + DUP 0< IF CR ." HALF-DUPLEX TERMINAL" THEN
175 DUP + DUP 0< IF CR ." ASM DATA ACCESS BEYOND $FFFF" THEN
176 DUP + DUP 0< IF CR ." BOOTLOADER" THEN
177 DUP + DUP 0< IF CR ." SD_CARD READ/WRITE" THEN
178 DUP + DUP 0< IF CR ." SD_CARD LOADER" THEN
179 DUP + DUP 0< IF CR ." FIXPOINT INPUT" THEN
180 DUP + DUP 0< IF CR ." DOUBLE INPUT" THEN
181 DUP + DUP 0< IF CR ." VOCABULARY SET" THEN
182 DUP + DUP 0< IF CR ." NONAME" THEN
183 DUP + DUP 0< IF CR ." EXTENDED ASSEMBLER" THEN
184 DUP + DUP 0< IF CR ." ASSEMBLER" THEN
185 DUP + DUP 0< IF CR ." CONDITIONNAL COMPILATION" THEN
187 0< IF \ true if CONDCOMP add-on
188 CR ESC ." [7m" \ escape sequence to set reverse video
189 ." OTHER OPTIONS:" \ in reverse video
190 ESC ." [0m" \ escape sequence to clear reverse video
192 ESC ." [G" \ cursor row 0
193 [DEFINED] {ANS_COMP} [IF] ." ANS_COMPLEMENT" CR [THEN]
194 [DEFINED] {TOOLS} [IF] ." UTILITY" CR [THEN]
195 [DEFINED] {FIXPOINT} [IF] ." FIXPOINT" CR [THEN]
196 [DEFINED] {SD_TOOLS} [IF] ." SD_TOOLS" CR [THEN]
198 [DEFINED] VOCABULARY [IF]
199 ESC ." [7m" \ escape sequence to set reverse video
200 ." ASSEMBLER word set"
201 ESC ." [0m" \ escape sequence to clear reverse video
202 ALSO ASSEMBLER WORDS CR PREVIOUS
204 ESC ." [7m" ." FORTH word set" ESC ." [0m"
205 WORDS \ Forth words set
209 : specs \ to see Fast Forth specifications
210 PWR_STATE \ before free bytes computing, remove all created words
211 HERE \ to compute bytes
214 41 \ number of terminal lines -1
215 0 DO CR LOOP \ don't erase any line of source
217 ESC ." [1J" \ erase up (41 empty lines)
218 ESC ." [H" \ cursor home
219 ESC ." [7m" \ escape sequence to set reverse video
221 DEVICEID @ \ value kept in TLV area
223 CR ." FastForth V" VERSION @ \ FastForth version,
224 0 <# # 8 HOLD # 46 HOLD #S #> TYPE $20 EMIT
225 ." for MSP430FR" \ target,
227 \ device ID of MSP430FRxxxx MAIN org
228 $830C OF ." 2355," $8000 ENDOF
229 $8328 OF ." 2476," $8000 ENDOF
230 $8240 OF ." 2433," $C400 ENDOF
231 $81F0 OF ." 4133," $C400 ENDOF
232 $8103 OF ." 5739," $C200 ENDOF
233 $8102 OF ." 5738," $C200 ENDOF
234 $8169 OF ." 5969," $4400 ENDOF
235 $8160 OF ." 5948," $4400 ENDOF
236 $82A1 OF ." 5994," $4000 ENDOF
237 $81A8 OF ." 6989," $4400 ENDOF
238 \ DevID OF ." xxxx," $MAIN ENDOF \ <-- add here your device
240 ABORT" xxxx <-- unrecognized device!"
243 ['] ['] DUP @ $1287 = IF ." DTC=1," DROP \ DTC model number,
250 INI_THREAD @ U. #8 EMIT ." -Entry word sets, " \ number of Entry word sets,
252 FREQ_KHZ @ 0 1000 UM/MOD U. \ frequency,
253 ?DUP IF #8 EMIT ." ," U. \ if remainder
254 THEN ." MHz, " \ MCLK
256 - U. ." bytes" \ HERE - MAIN_ORG \ number of bytes code,
260 CR CR ADDONS \ addons
265 ECHO specs \ here FastForth types a (volatile) message with some informations