OSDN Git Service

V205
[fast-forth/master.git] / FastForthWords.txt
1
2 FORTH vocabulary
3 ----------------
4 COLD            WARM            (WARM)          WIPE            RST_HERE        PWR_HERE        RST_STATE       
5 PWR_STATE       MOVE            LEAVE           +LOOP           LOOP            DO              REPEAT          
6 WHILE           AGAIN           UNTIL           BEGIN           THEN            ELSE            IF              
7 DEFER           DOES>           CREATE          CONSTANT        VARIABLE        :               ;               
8 POSTPONE        RECURSE         IMMEDIATE       IS              [']             ]               [               
9 \               '               ABORT"          ABORT           QUIT            EVALUATE        COUNT           
10 LITERAL         ,               EXECUTE         >NUMBER         FIND            WORD            ."              
11 S"              CR              (CR)            TYPE            SPACES          SPACE           NOECHO          
12 ECHO            EMIT            (EMIT)          ACCEPT          KEY             (KEY)           C,              
13 ALLOT           HERE            .               D.              U.              SIGN            HOLD            
14 #>              #S              #               UM/MOD          <#              STATE           BASE            
15 BL              J               I               UNLOOP          U<              0>              >               
16 <               =               0<              0=              DABS            1-              1+              
17 1-              1+              -               +               C!              C@              !               
18 @               DEPTH           R@              R>              >R              ROT             OVER            
19 SWAP            NIP             DROP            ?DUP            DUP             LIT             EXIT
20
21
22 ASSEMBLER vocabulary
23 --------------------
24
25 ?GOTO           GOTO            FW3             FW2             FW1             BW3             BW2             
26 BW1             ?JMP            JMP             REPEAT          WHILE           AGAIN           UNTIL           
27 ELSE            THEN            IF              0=              0<>             U>=             U<              
28 0<              0>=             S<              S>=             RRUM            RLAM            RRAM            
29 RRCM            POPM            PUSHM           CALL            PUSH.B          PUSH            SXT             
30 RRA.B           RRA             SWPB            RRC.B           RRC             AND.B           AND             
31 XOR.B           XOR             BIS.B           BIS             BIC.B           BIC             BIT.B           
32 BIT             DADD.B          DADD            CMP.B           CMP             SUB.B           SUB             
33 SUBC.B          SUBC            ADDC.B          ADDC            ADD.B           ADD             MOV.B           
34 MOV             RETI            LO2HI           COLON           ENDASM          ENDCODE         (SLEEP)         
35 SLEEP
36
37 ASM             CODE            HI2LO           (added in forth vocabulary)
38
39
40 CONDCOMP ADD-ON
41 ---------------
42 MARKER          [DEFINED]       [UNDEFINED]     [IF]            [ELSE]          [THEN]          COMPARE         
43
44
45 VOCABULARY ADD-ON
46 -----------------
47 DEFINITIONS     ONLY            PREVIOUS        ALSO            ASSEMBLER       FORTH           VOCABULARY
48
49
50 ANS_COMPLEMENT ADD-ON
51 ---------------------
52 PAD             >BODY           SOURCE          .(              (               DECIMAL         HEX             
53 FILL            [CHAR]          CHAR            +!              MIN             MAX             2/              
54 2*              RSHIFT          LSHIFT          XOR             OR              AND             INVERT          
55 2OVER           2SWAP           2DROP           2DUP            2!              2@              S>D             
56 CELL+           CELLS           CHAR+           CHARS           ALIGN           ALIGNED         */              
57 */MOD           MOD             /               /MOD            *               FM/MOD          SM/REM          
58 M*              UM*             {ANS_COMP}
59
60
61 SD_CARD_LOADER ADD-ON
62 ---------------------
63 LOAD"           CIB             (ACCEPT)        {SD_LOAD}
64
65
66 SD_CARD_READ_WRITE ADD-ON
67 -------------------------
68 TERM2SD"        SD_EMIT         WRITE           READ            CLOSE           DEL"            WRITE"          
69 READ"
70
71
72 UTILITY ADD-ON
73 --------------
74 DUMP            U.R             WORDS           ?               .RS             .S              {TOOLS}       
75
76
77 SD_TOOLS ADD-ON
78 ---------------
79 DIR             FAT             CLUSTER         SECTOR          {SD_TOOLS}
80
81
82 ; a word within brackets [] is an immediate word. (other words may also be immediate)
83 ; a word doubled with another word between parentheses () is a DEFERred word, the first being initialised with the second.
84 ; when ADD-ONs are compiled into the kernel, their respective MARKER word identified with braces {} does nothing.
85 ; when ADD-ONs are downloaded, their respective MARKER word identified with braces {} removes all ADD-ONs words.
86
87 FORTH WORDS
88 -----------
89
90 COLD            Software reset
91
92 WARM            DEFERed word, initially executes (WARM)
93
94 (WARM)          performs a hot start
95
96 WIPE            resets the program memory to its original state (Deep_RST has same effect).
97
98 RST_HERE        defines the bound of the program memory protected against COLD or hardware reset.
99
100 PWR_HERE        defines the bound of the program memory protected against ON/OFF and also against any error occurring.
101
102 RST_STATE       removes all words defined after RST_HERE (COLD or <reset> have same effet)
103
104 PWR_STATE       removes all words defined after PWR_HERE (an occurring error has same effect)
105
106 MOVE            https://forth-standard.org/standard/core/MOVE
107 LEAVE           https://forth-standard.org/standard/core/LEAVE
108 +LOOP           https://forth-standard.org/standard/core/PlusLOOP
109 LOOP            https://forth-standard.org/standard/core/LOOP
110 DO              https://forth-standard.org/standard/core/DO        
111 REPEAT          https://forth-standard.org/standard/core/REPEAT
112 WHILE           https://forth-standard.org/standard/core/WHILE
113 AGAIN           https://forth-standard.org/standard/core/AGAIN
114 UNTIL           https://forth-standard.org/standard/core/UNTIL
115 BEGIN           https://forth-standard.org/standard/core/BEGIN
116 THEN            https://forth-standard.org/standard/core/THEN
117 ELSE            https://forth-standard.org/standard/core/ELSE
118 IF              https://forth-standard.org/standard/core/IF
119 ;               https://forth-standard.org/standard/core/Semi
120 :               https://forth-standard.org/standard/core/Colon
121 DEFER           https://forth-standard.org/standard/core/DEFER
122 DOES>           https://forth-standard.org/standard/core/DOES
123 CREATE          https://forth-standard.org/standard/core/CREATE
124 CONSTANT        https://forth-standard.org/standard/core/CONSTANT
125 VARIABLE        https://forth-standard.org/standard/core/VARIABLE
126 POSTPONE        https://forth-standard.org/standard/core/POSTPONE
127 RECURSE         https://forth-standard.org/standard/core/RECURSE
128 IMMEDIATE       https://forth-standard.org/standard/core/IMMEDIATE
129 IS              https://forth-standard.org/standard/core/IS
130 [']             https://forth-standard.org/standard/core/BracketTick
131 ]               https://forth-standard.org/standard/core/right-bracket
132 [               https://forth-standard.org/standard/core/Bracket
133 \               https://forth-standard.org/standard/block/bs
134 '               https://forth-standard.org/standard/core/Tick
135 ABORT"          https://forth-standard.org/standard/core/ABORTq
136 ABORT           https://forth-standard.org/standard/core/ABORT
137 QUIT            https://forth-standard.org/standard/core/QUIT
138 EVALUATE        https://forth-standard.org/standard/core/EVALUATE
139 COUNT           https://forth-standard.org/standard/core/COUNT
140 LITERAL         https://forth-standard.org/standard/core/LITERAL
141 ,               https://forth-standard.org/standard/core/Comma
142 EXECUTE         https://forth-standard.org/standard/core/EXECUTE
143 >NUMBER         https://forth-standard.org/standard/core/toNUMBER
144 FIND            https://forth-standard.org/standard/core/FIND
145 WORD            https://forth-standard.org/standard/core/WORD
146 ."              https://forth-standard.org/standard/core/Dotq
147 S"              https://forth-standard.org/standard/core/Sq
148 TYPE            https://forth-standard.org/standard/core/TYPE
149 SPACES          https://forth-standard.org/standard/core/SPACES
150 SPACE           https://forth-standard.org/standard/core/SPACE
151 CR              DEFERed word, initially executes (CR)
152 (CR)            https://forth-standard.org/standard/core/CR
153 NOECHO          stop display on output 
154 ECHO            start display on output
155 EMIT            DEFERed word, initially executes (EMIT)
156 (EMIT)          https://forth-standard.org/standard/core/EMIT
157 ACCEPT          DEFERed word, initially executes (ACCEPT)
158 (ACCEPT)        https://forth-standard.org/standard/core/ACCEPT
159 KEY             DEFERed word, initially executes (KEY)
160 (KEY)           https://forth-standard.org/standard/core/KEY
161 C,              https://forth-standard.org/standard/core/CComma
162 ALLOT           https://forth-standard.org/standard/core/ALLOT
163 HERE            https://forth-standard.org/standard/core/HERE
164 .               https://forth-standard.org/standard/core/d
165 D.              https://forth-standard.org/standard/double/Dd
166 U.              https://forth-standard.org/standard/core/Ud
167 SIGN            https://forth-standard.org/standard/core/SIGN
168 HOLD            https://forth-standard.org/standard/core/HOLD
169 #>              https://forth-standard.org/standard/core/num-end
170 #S              https://forth-standard.org/standard/core/numS
171 #               https://forth-standard.org/standard/core/num
172 UM/MOD          https://forth-standard.org/standard/core/UMDivMOD
173 <#              https://forth-standard.org/standard/core/num-start
174 BL              https://forth-standard.org/standard/core/BL
175 STATE           https://forth-standard.org/standard/core/STATE
176 BASE            https://forth-standard.org/standard/core/BASE
177 J               https://forth-standard.org/standard/core/J
178 I               https://forth-standard.org/standard/core/I
179 UNLOOP          https://forth-standard.org/standard/core/UNLOOP
180 U<              https://forth-standard.org/standard/core/Uless
181 >               https://forth-standard.org/standard/core/more
182 <               https://forth-standard.org/standard/core/less
183 =               https://forth-standard.org/standard/core/Equal
184 0>              https://forth-standard.org/standard/core/Zeromore
185 0<              https://forth-standard.org/standard/core/Zeroless
186 0=              https://forth-standard.org/standard/core/ZeroEqual
187 DABS            https://forth-standard.org/standard/double/DABS
188 ABS             https://forth-standard.org/standard/core/ABS
189 NEGATE          https://forth-standard.org/standard/core/NEGATE
190 1-              https://forth-standard.org/standard/core/OneMinus
191 1+              https://forth-standard.org/standard/core/OnePlus
192 -               https://forth-standard.org/standard/core/Minus
193 +               https://forth-standard.org/standard/core/Plus
194 C!              https://forth-standard.org/standard/core/CStore
195 C@              https://forth-standard.org/standard/core/CFetch
196 !               https://forth-standard.org/standard/core/Store
197 @               https://forth-standard.org/standard/core/Fetch
198 DEPTH           https://forth-standard.org/standard/core/DEPTH
199 R@              https://forth-standard.org/standard/core/RFetch
200 R>              https://forth-standard.org/standard/core/Rfrom
201 >R              https://forth-standard.org/standard/core/toR
202 ROT             https://forth-standard.org/standard/core/ROT
203 OVER            https://forth-standard.org/standard/core/OVER
204 SWAP            https://forth-standard.org/standard/core/SWAP
205 NIP             https://forth-standard.org/standard/core/NIP
206 DROP            https://forth-standard.org/standard/core/DROP
207 ?DUP            https://forth-standard.org/standard/core/qDUP
208 DUP             https://forth-standard.org/standard/core/DUP
209 LIT             execution part of LITERAL            
210 EXIT            https://forth-standard.org/standard/core/EXIT
211
212
213
214 ASSEMBLER vocabulary
215 --------------------
216 set see: http://www.ece.utep.edu/courses/web3376/Notes_files/ee3376-isa.pdf
217          howto.md for symbolic alias of registers, symbolic jumps (IF ELSE THEN...),..
218
219 ?GOTO           used after a conditionnal (0=,0<>,U>=,U<,0<,S<,S>=) to branch to a label FWx or BWx
220 GOTO            used as unconditionnal branch to a label FWx or BWx
221
222 BW3             BACKWARD branch destination n°3
223 BW2                                         n°2
224 BW1                                         N°1
225
226 FW3             FORWARD branch destination  n°3
227 FW2                                         n°2
228 FW1                                         n°1
229
230 ?JMP            used after a conditionnal (0=,0<>,U>=,U<,0<,S<,S>=) to jump to a predefined word
231 JMP             unconditionnal jump to a predefined word
232
233 REPEAT          assembler version of the FORTH word REPEAT
234 WHILE           idem
235 AGAIN           idem
236 UNTIL           idem
237 ELSE            idem
238 THEN            idem
239 IF              idem
240
241 0=              conditionnal     
242 0<>             conditionnal
243 U>=             conditionnal
244 U<              conditionnal
245 0<              conditionnal, to use only with ?JMP ?GOTO
246 0>=             conditionnal, to use only with IF UNTIL WHILE
247 S<              conditionnal
248 S>=             conditionnal
249
250 LO2HI           switches compilation between low level and high level modes without saving IP register.
251 COLON           pushes IP then performs LO2HI, used as: CODE <word> ... assembler instr ... COLON ... FORTH words ... ;
252 ENDASM          to end an ASM definition.
253 ENDCODE         to end a CODE definition.
254 SLEEP           DEFERed word which enables to create a background task, initially executes (SLEEP).
255 (SLEEP)         the default SLEEP definition: MOV #GIE+LPM0,SR
256
257 next assembler words are in FORTH vocabulary:
258
259 CODE <word>     creates a FORTH word written in assembler.
260                 this defined <word> must be ended with ENDCODE.
261
262 ASM <word>      creates a word written in assembler but not interpretable by FORTH (because ended by RET instr.).
263                 this defined <word> must be ended with ENDASM. This word will be called only in assembler mode. 
264
265 HI2LO           used to switch compilation from high level (FORTH) to low level (assembler).
266
267
268 ASSEMBLER WORDS set:
269
270 RRUM            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=218
271 RLAM            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=208
272 RRAM            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=211
273 RRCM            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=214
274 POPM            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=204    syntax: POPM X,S    to pop X,W,T,S
275 PUSHM           http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=205    syntax: PUSHM S,X   to push S,T,W,X
276
277 CALL            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=142
278 PUSH.B  PUSH    http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=168
279 SXT             http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=182
280 RRA.B   RRA     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=173
281 SWPB            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=181
282 RRC.B   RRC     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=174
283 AND.B   AND     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=137
284 XOR.B   XOR     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=184
285 BIS.B   BIS     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=139
286 BIC.B   BIC     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=138
287 BIT.B   BIT     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=140
288 DADD.B  DADD    http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=149
289 CMP.B   CMP     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=147
290 SUB.B   SUB     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=179
291 SUBC.B  SUBC    http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=180
292 ADDC.B  ADDC    http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=136
293 ADD.B   ADD     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=135
294 MOV.B   MOV     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=165
295 RETI            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=170
296
297
298 CONDCOMP ADD-ON
299 ---------------
300 [DEFINED]       https://forth-standard.org/standard/tools/BracketDEFINED
301 [UNDEFINED]     https://forth-standard.org/standard/tools/BracketUNDEFINED
302 [IF]            https://forth-standard.org/standard/tools/BracketIF
303 [ELSE]          https://forth-standard.org/standard/tools/BracketELSE
304 [THEN]          https://forth-standard.org/standard/tools/BracketTHEN
305 COMPARE         https://forth-standard.org/standard/string/COMPARE
306 MARKER          https://forth-standard.org/standard/core/MARKER
307
308 VOCABULARY ADD-ON (not ANS)
309 -----------------
310 DEFINITIONS     https://forth-standard.org/standard/search/DEFINITIONS
311 ONLY            https://forth-standard.org/standard/search/ONLY
312 PREVIOUS        https://forth-standard.org/standard/search/PREVIOUS
313 ALSO            https://forth-standard.org/standard/search/ALSO
314 ASSEMBLER       assembler VOCABULARY
315 FORTH           FORTH VOCABULARY
316 VOCABULARY <word>     creates a new VOCABULARY named word
317
318 ANS_COMPLEMENT ADD-ON
319 ---------------------
320 PAD             https://forth-standard.org/standard/core/PAD            
321 >IN             https://forth-standard.org/standard/core/toIN
322 >BODY           https://forth-standard.org/standard/core/toBODY
323 SOURCE          https://forth-standard.org/standard/core/SOURCE
324 .(              https://forth-standard.org/standard/core/Dotp
325 (               https://forth-standard.org/standard/core/p
326 DECIMAL         https://forth-standard.org/standard/core/DECIMAL
327 HEX             https://forth-standard.org/standard/core/HEX
328 FILL            https://forth-standard.org/standard/core/FILL
329 [CHAR]          https://forth-standard.org/standard/core/BracketCHAR
330 CHAR            https://forth-standard.org/standard/core/CHAR
331 +!              https://forth-standard.org/standard/core/PlusStore
332 2/              https://forth-standard.org/standard/core/TwoDiv
333 2*              https://forth-standard.org/standard/core/TwoTimes
334 MIN             https://forth-standard.org/standard/core/MIN
335 MAX             https://forth-standard.org/standard/core/MAX
336 RSHIFT          https://forth-standard.org/standard/core/RSHIFT
337 LSHIFT          https://forth-standard.org/standard/core/LSHIFT
338 INVERT          https://forth-standard.org/standard/core/INVERT
339 XOR             https://forth-standard.org/standard/core/XOR
340 OR              https://forth-standard.org/standard/core/OR
341 AND             https://forth-standard.org/standard/core/AND
342 2OVER           https://forth-standard.org/standard/core/TwoOVER
343 2SWAP           https://forth-standard.org/standard/core/TwoSWAP
344 2DROP           https://forth-standard.org/standard/core/TwoDROP
345 2DUP            https://forth-standard.org/standard/core/TwoDUP
346 2!              https://forth-standard.org/standard/core/TwoStore
347 2@              https://forth-standard.org/standard/core/TwoFetch
348 S>D             https://forth-standard.org/standard/core/StoD
349 CELL+           https://forth-standard.org/standard/core/CELLPlus
350 CELLS           https://forth-standard.org/standard/core/CELLS
351 CHAR+           https://forth-standard.org/standard/core/CHARPlus
352 CHARS           https://forth-standard.org/standard/core/CHARS
353 ALIGN           https://forth-standard.org/standard/core/ALIGN
354 ALIGNED         https://forth-standard.org/standard/core/ALIGNED
355 */              https://forth-standard.org/standard/core/TimesDiv
356 */MOD           https://forth-standard.org/standard/core/TimesDivMOD
357 MOD             https://forth-standard.org/standard/core/MOD
358 /               https://forth-standard.org/standard/core/Div
359 /MOD            https://forth-standard.org/standard/core/DivMOD
360 *               https://forth-standard.org/standard/core/Times
361 FM/MOD          https://forth-standard.org/standard/core/FMDivMOD
362 SM/REM          https://forth-standard.org/standard/core/SMDivREM
363 M*              https://forth-standard.org/standard/core/MTimes
364 UM*             https://forth-standard.org/standard/core/UMTimes
365 {ANS_COMP}
366
367
368 SD_CARD_LOADER ADD-ON
369 ---------------------
370 LOAD"           LOAD" SD_TEST.4TH" loads and compile source file SD_TEST.4TH.
371 CIB             Currrent Input Buffer
372 (ACCEPT)        init value for ACCEPT
373 {SD_LOAD}
374
375
376 SD_CARD_READ_WRITE ADD-ON
377 -------------------------
378 TERM2SD"        TERM2SD" SD_TEST.4TH" copy input file to SD_CARD (use CopySourceFileToTarget_SD_Card.bat to do)
379 SD_EMIT         sends output stream at the end of last opened as write file.
380 WRITE           write sequentially BUFFER content to a sector
381 READ            read sequentially a sector to BUFFER
382 CLOSE           close last opened file.
383 DEL"            DEL" SD_TEST.4TH" remove this file from SD_CARD.
384 WRITE"          WRITE" TRUC" open or create TRUC file ready to write to the end of this file
385 READ"           READ" TRUC" open TRUC and load its first sector in BUFFER
386
387
388 UTILITY ADD-ON
389 --------------
390 DUMP            https://forth-standard.org/standard/tools/DUMP  
391 U.R   u z --    display unsigned number u with size z
392 WORDS           https://forth-standard.org/standard/tools/WORDS 
393 ?               https://forth-standard.org/standard/tools/q
394 .RS             displays return stack content
395 .S              https://forth-standard.org/standard/tools/DotS
396 {TOOLS}         do nothing if compiled in core.
397
398 SD_TOOLS ADD-ON
399 ---------------
400 DIR             dump first sector of current directory
401 FAT             dump first sector of FAT1
402 CLUSTER         .123 CLUSTER displays first sector of cluster 123
403 SECTOR          .123456789 SECTOR displays sector 123456789
404 {SD_TOOLS}      if you type {SD_TOOLS}  all subsequent loaded words are removed
405