1 \ -*- coding: utf-8 -*-
9 \ MSP_EXP430FR5739 MSP_EXP430FR5969 MSP_EXP430FR5994 MSP_EXP430FR6989
10 \ MSP_EXP430FR4133 MSP_EXP430FR2433 CHIPSTICK_FR2433 MSP_EXP430FR2355
12 \ from scite editor : copy your target selection in (shift+F8) parameter 1:
16 \ drag and drop this file onto SendSourceFileToTarget.bat
17 \ then select your TARGET when asked.
19 \ FastForth kernel compilation minimal options:
20 \ TERMINAL3WIRES, TERMINAL4WIRES
21 \ MSP430ASSEMBLER, CONDCOMP
23 \ to see kernel options, download FastForthSpecs.f
26 \ R4 to R7 must be saved before use and restored after
27 \ scratch registers Y to S are free for use
28 \ under interrupt, IP is free for use
30 \ PUSHM order : PSP,TOS, IP, S, T, W, X, Y, rEXIT,rDOVAR,rDOCON, rDODOES, R3, SR,RSP, PC
31 \ PUSHM order : R15,R14,R13,R12,R11,R10, R9, R8, R7 , R6 , R5 , R4 , R3, R2, R1, R0
33 \ example : PUSHM #6,IP pushes IP,S,T,W,X,Y registers to return stack
35 \ POPM order : PC,RSP, SR, R3, rDODOES,rDOCON,rDOVAR,rEXIT, Y, X, W, T, S, IP,TOS,PSP
36 \ POPM order : R0, R1, R2, R3, R4 , R5 , R6 , R7 , R8, R9,R10,R11,R12,R13,R14,R15
38 \ example : POPM #6,IP pop Y,X,W,T,S,IP registers from return stack
41 \ FORTH conditionnals: unary{ 0= 0< 0> }, binary{ = < > U< }
43 \ ASSEMBLER conditionnal usage with IF UNTIL WHILE S< S>= U< U>= 0= 0<> 0>=
44 \ ASSEMBLER conditionnal usage with ?JMP ?GOTO S< S>= U< U>= 0= 0<> 0<
50 \ https://forth-standard.org/standard/core/Fetch
51 \ @ c-addr -- char fetch char from memory
58 [UNDEFINED] IF [IF] \ define IF and THEN
59 \ https://forth-standard.org/standard/core/IF
60 \ IF -- IFadr initialize conditional forward branch
65 ADD #4,&DP \ compile one word, reserve one word
66 MOV #QFBRAN,0(TOS) \ -- HERE compile QFBRAN
67 ADD #2,TOS \ -- HERE+2=IFadr
71 \ https://forth-standard.org/standard/core/THEN
72 \ THEN IFadr -- resolve forward branch
74 MOV &DP,0(TOS) \ -- IFadr
81 \ https://forth-standard.org/standard/core/ELSE
82 \ ELSE IFadr -- ELSEadr resolve forward IF branch, leave ELSEadr on stack
84 ADD #4,&DP \ make room to compile two words
87 MOV W,0(TOS) \ HERE+4 ==> [IFadr]
89 MOV W,TOS \ -- ELSEadr
94 [UNDEFINED] DEFER [IF]
95 \ https://forth-standard.org/standard/core/DEFER
96 \ DEFER "<spaces>name" --
97 \ Skip leading space delimiters. Parse name delimited by a space.
98 \ Create a definition for name with the execution semantics defined below.
101 \ Execute the xt that name is set to execute, i.e. NEXT (nothing),
102 \ until the phrase ' word IS name is executed, causing a new value of xt to be assigned to name.
106 MOV #$4030,-4(W) \ CFA = MOV @PC+,PC = BR MOV @IP+,PC
107 MOV #BR@IP+_ADR,-2(W) \ PFA = address of MOV @IP+,PC to do nothing.
113 [UNDEFINED] DEFER! [IF]
114 \ https://forth-standard.org/standard/core/DEFERStore
115 \ Set the word xt1 to execute xt2. An ambiguous condition exists if xt1 is not for a word defined by DEFER.
116 CODE DEFER! \ xt2 xt1 --
117 MOV @PSP+,2(TOS) \ -- xt1=CFA_DEFER xt2 --> [CFA_DEFER+2]
124 \ https://forth-standard.org/standard/core/IS
127 \ DEFER DISPLAY create a "do nothing" definition (2 CELLS)
128 \ inline command : ' U. IS DISPLAY U. becomes the runtime of the word DISPLAY
129 \ or in a definition : ... ['] U. IS DISPLAY ...
130 \ KEY, EMIT, CR, ACCEPT and WARM are examples of DEFERred words
132 \ as IS replaces the PFA value of any word, it's a TO alias for VARIABLE and CONSTANT words...
135 IF POSTPONE ['] POSTPONE DEFER!