OSDN Git Service

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