1 \ -*- coding: utf-8 -*-
7 \ to see kernel options, download FastForthSpecs.f
8 \ FastForth kernel options: nothing
11 \ MSP_EXP430FR5739 MSP_EXP430FR5969 MSP_EXP430FR5994 MSP_EXP430FR6989
12 \ MSP_EXP430FR4133 MSP_EXP430FR2433 MSP_EXP430FR2355 CHIPSTICK_FR2433
17 [UNDEFINED] CONSTANT [IF]
18 \ https://forth-standard.org/standard/core/CONSTANT
19 \ CONSTANT <name> n -- define a Forth CONSTANT
24 MOV #DOCON,-4(W) \ CFA = DOCON
25 MOV TOS,-2(W) \ PFA = n
32 \ https://forth-standard.org/standard/core/BL
33 \ BL -- char an ASCII space
37 [UNDEFINED] SPACE [IF]
38 \ https://forth-standard.org/standard/core/SPACE
39 \ SPACE -- output a space
45 \ https://forth-standard.org/standard/core/RFetch
46 \ R@ -- x R: x -- x fetch from return stack
56 \ https://forth-standard.org/standard/core/less
57 \ < n1 n2 -- flag test n1<n2, signed
59 SUB @PSP+,TOS \ 1 TOS=n2-n1
60 S< ?GOTO FW1 \ 2 signed
62 BW1 MOV #-1,TOS \ 1 flag Z = 0
67 \ https://forth-standard.org/standard/core/more
68 \ > n1 n2 -- flag test n1>n2, signed
70 SUB @PSP+,TOS \ 2 TOS=n2-n1
71 S< ?GOTO BW1 \ 2 --> +5
72 FW1 AND #0,TOS \ 1 flag Z = 1
77 [UNDEFINED] UM/MOD [IF]
78 \ https://forth-standard.org/standard/core/UMDivMOD
79 \ UM/MOD udlo|udhi u1 -- r q unsigned 32/16->r16 q16
82 MOV #<#,X \ X = addr of <#
83 ADD #8,X \ X = addr of MUSMOD
84 MOV X,PC \ execute MUSMOD then RET to DROP
95 1 ABORT" only for 1,4,8,16,24 MHz MCLK!"
99 SPACE ESC ." [7m" \ set reverse video
100 ." with MCLK = " MCLK. 1 ABORT" MHz? don't dream!"
105 : CHNGBAUD \ only for 8, 16, 24 MHz
106 PWR_STATE \ to remove this created word (garbage collector)
108 42 \ number of terminal lines
109 0 DO CR LOOP \ don't erase any line of source
111 ESC ." [1J" \ erase up (42 empty lines)
112 ESC ." [H" \ cursor home
114 FREQ_KHZ @ >R \ r-- target MCLCK frequency in MHz
115 ." target MCLK = " R@ MCLK. ." MHz" CR
116 ." choose your baudrate:" CR
119 ." 2 --> 4 MBds" CR \ linux driver max speed
120 ." 3 --> 2457600 Bds" CR
121 ." 4 --> 921600 Bds" CR
122 ." 5 --> 460800 Bds" CR
123 ." 6 --> 230400 Bds" CR
124 ." 7 --> 115200 Bds" CR
125 ." other --> abort" CR
129 #48 - ?DUP 0= \ select 6MBds ?
130 IF ." 6 MBds" \ add this to the current line
131 R@ #24000 < \ < 24MHz ?
134 R@ #24000 <> \ 24 MHz ?
135 IF BAD_MHz \ no: --> abort
139 ELSE 1 - ?DUP 0= \ select 5MBds ?
141 R@ #16000 < \ < 16MHz ?
142 IF R@ BAD_SPEED \ abort
153 ELSE 1 - ?DUP 0= \ select 4MBds ?
156 IF R@ BAD_SPEED \ abort
167 ELSE 1 - ?DUP 0= \ select 2457600 ?
169 R@ #8000 < \ < 8MHz ?
170 IF R@ BAD_SPEED \ abort
185 ELSE 1 - ?DUP 0= \ select 921600 ?
188 IF R@ BAD_SPEED \ abort
208 ELSE 1 - ?DUP 0= \ select 230400 ?
211 IF R@ BAD_SPEED \ abort
231 ELSE 1 - ?DUP 0= \ select 230400 ?
234 IF R@ BAD_SPEED \ abort
259 ELSE 1 - ?DUP 0= \ select 115200 ?
284 ELSE \ other selected
294 TERMMCTLW_RST ! \ set UCAxMCTLW value in FRAM
295 TERMBRW_RST ! \ set UCAxBRW value in FRAM
296 R> DROP \ clear stacks
297 CR ESC ." [7m" \ escape sequence to set reverse video
298 ." Change baudrate in Teraterm, save its setup then reset target."