OSDN Git Service

V208 Modified ACCEPT COLD WARM ?ABORT, S".
[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, by default executes ABORT" <WARM_message>"
24
25 WIPE            resets the program memory to its original state (Deep_RST adds same effect to COLD).
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      readme.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 ASM <word>      creates a word written in assembler but not interpretable by FORTH (because ended by RET instr.).
199                 this defined <word> must be ended with ENDASM. 
200                 This word will be recognized only in assembler mode. 
201
202 HI2LO           used to switch compilation from high level (FORTH) to low level (assembler).
203
204
205 ASSEMBLER WORDS set:
206
207 RRUM            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=218
208 RLAM            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=208
209 RRAM            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=211
210 RRCM            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=214
211 POPM            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=204
212 PUSHM           http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=205
213
214 CALL            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=142
215 PUSH.B  PUSH    http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=168
216 SXT             http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=182
217 RRA.B   RRA     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=173
218 SWPB            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=181
219 RRC.B   RRC     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=174
220 AND.B   AND     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=137
221 XOR.B   XOR     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=184
222 BIS.B   BIS     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=139
223 BIC.B   BIC     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=138
224 BIT.B   BIT     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=140
225 DADD.B  DADD    http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=149
226 CMP.B   CMP     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=147
227 SUB.B   SUB     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=179
228 SUBC.B  SUBC    http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=180
229 ADDC.B  ADDC    http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=136
230 ADD.B   ADD     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=135
231 MOV.B   MOV     http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=165
232 RETI            http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=170
233
234
235 CONDCOMP ADD-ON
236 ---------------
237 MARKER          [DEFINED]       [UNDEFINED]     [IF]            [ELSE]          [THEN]          COMPARE         
238
239 [DEFINED]       https://forth-standard.org/standard/tools/BracketDEFINED
240 [UNDEFINED]     https://forth-standard.org/standard/tools/BracketUNDEFINED
241 [IF]            https://forth-standard.org/standard/tools/BracketIF
242 [ELSE]          https://forth-standard.org/standard/tools/BracketELSE
243 [THEN]          https://forth-standard.org/standard/tools/BracketTHEN
244 COMPARE         https://forth-standard.org/standard/string/COMPARE
245 MARKER          https://forth-standard.org/standard/core/MARKER
246
247
248 VOCABULARY ADD-ON
249 -----------------
250 DEFINITIONS     ONLY            PREVIOUS        ALSO            ASSEMBLER       FORTH           VOCABULARY
251
252 DEFINITIONS     https://forth-standard.org/standard/search/DEFINITIONS
253 ONLY            https://forth-standard.org/standard/search/ONLY
254 PREVIOUS        https://forth-standard.org/standard/search/PREVIOUS
255 ALSO            https://forth-standard.org/standard/search/ALSO
256 ASSEMBLER       assembler VOCABULARY
257 FORTH           FORTH VOCABULARY
258 VOCABULARY <word>     creates a new VOCABULARY named word
259
260
261 NONAME ADD-ON
262 ---------------------
263 :NONAME         CODENNM
264
265 :NONAME         https://forth-standard.org/standard/core/ColonNONAME 
266 CODENNM         assembly counterpart of :NONAME
267
268
269 SD_CARD_LOADER ADD-ON
270 ---------------------
271 LOAD"           CIB
272
273 LOAD"           LOAD" SD_TEST.4TH" loads and compile source file SD_TEST.4TH.
274 CIB             Currrent Input Buffer, TIB by default.
275
276 ACCEPT becomes a DEFERed word
277
278
279 SD_CARD_READ_WRITE ADD-ON
280 -------------------------
281 TERM2SD"        SD_EMIT         WRITE           READ            CLOSE           DEL"            WRITE"          
282 READ"
283
284 TERM2SD"        TERM2SD" SD_TEST.4TH" copy input file to SD_CARD (use CopySourceFileToTarget_SD_Card.bat to do)
285 SD_EMIT         sends output stream at the end of last opened as write file.
286 WRITE           write sequentially BUFFER content to a sector
287 READ            read sequentially a sector to BUFFER
288 CLOSE           close last opened file.
289 DEL"            DEL" SD_TEST.4TH" remove this file from SD_CARD.
290 WRITE"          WRITE" TRUC" open or create TRUC file ready to write to the end of this file
291 READ"           READ" TRUC" open TRUC and load its first sector in BUFFER
292
293
294
295 BOOTLOADER
296 ----------
297 BOOT
298
299 QUIT becomes a DEFERed word
300
301
302 ; when ADD-ONs are compiled into the kernel, their respective MARKER word identified with braces {} does nothing.
303 ; when ADD-ONs are downloaded, their respective MARKER word identified with braces {} removes all ADD-ONs words.
304
305
306 ANS_COMPLEMENT ADD-ON
307 ---------------------
308 PAD             SOURCE          .(              (               DECIMAL         HEX             
309 FILL            [CHAR]          CHAR            +!              MIN             MAX             2/              
310 2*              RSHIFT          LSHIFT          XOR             OR              AND             INVERT          
311 2OVER           2SWAP           2DROP           2DUP            2!              2@              S>D             
312 CELL+           CELLS           CHAR+           CHARS           ALIGN           ALIGNED         */              
313 */MOD           MOD             /               /MOD            *               FM/MOD          SM/REM          
314 M*              UM*             {ANS_COMP}
315
316 PAD             https://forth-standard.org/standard/core/PAD            
317 >IN             https://forth-standard.org/standard/core/toIN
318 >BODY           https://forth-standard.org/standard/core/toBODY
319 SOURCE          https://forth-standard.org/standard/core/SOURCE
320 .(              https://forth-standard.org/standard/core/Dotp
321 (               https://forth-standard.org/standard/core/p
322 DECIMAL         https://forth-standard.org/standard/core/DECIMAL
323 HEX             https://forth-standard.org/standard/core/HEX
324 FILL            https://forth-standard.org/standard/core/FILL
325 [CHAR]          https://forth-standard.org/standard/core/BracketCHAR
326 CHAR            https://forth-standard.org/standard/core/CHAR
327 +!              https://forth-standard.org/standard/core/PlusStore
328 2/              https://forth-standard.org/standard/core/TwoDiv
329 2*              https://forth-standard.org/standard/core/TwoTimes
330 MIN             https://forth-standard.org/standard/core/MIN
331 MAX             https://forth-standard.org/standard/core/MAX
332 RSHIFT          https://forth-standard.org/standard/core/RSHIFT
333 LSHIFT          https://forth-standard.org/standard/core/LSHIFT
334 INVERT          https://forth-standard.org/standard/core/INVERT
335 XOR             https://forth-standard.org/standard/core/XOR
336 OR              https://forth-standard.org/standard/core/OR
337 AND             https://forth-standard.org/standard/core/AND
338 2OVER           https://forth-standard.org/standard/core/TwoOVER
339 2SWAP           https://forth-standard.org/standard/core/TwoSWAP
340 2DROP           https://forth-standard.org/standard/core/TwoDROP
341 2DUP            https://forth-standard.org/standard/core/TwoDUP
342 2!              https://forth-standard.org/standard/core/TwoStore
343 2@              https://forth-standard.org/standard/core/TwoFetch
344 S>D             https://forth-standard.org/standard/core/StoD
345 CELL+           https://forth-standard.org/standard/core/CELLPlus
346 CELLS           https://forth-standard.org/standard/core/CELLS
347 CHAR+           https://forth-standard.org/standard/core/CHARPlus
348 CHARS           https://forth-standard.org/standard/core/CHARS
349 ALIGN           https://forth-standard.org/standard/core/ALIGN
350 ALIGNED         https://forth-standard.org/standard/core/ALIGNED
351 */              https://forth-standard.org/standard/core/TimesDiv
352 */MOD           https://forth-standard.org/standard/core/TimesDivMOD
353 MOD             https://forth-standard.org/standard/core/MOD
354 /               https://forth-standard.org/standard/core/Div
355 /MOD            https://forth-standard.org/standard/core/DivMOD
356 *               https://forth-standard.org/standard/core/Times
357 FM/MOD          https://forth-standard.org/standard/core/FMDivMOD
358 SM/REM          https://forth-standard.org/standard/core/SMDivREM
359 M*              https://forth-standard.org/standard/core/MTimes
360 UM*             https://forth-standard.org/standard/core/UMTimes
361 {ANS_COMP}
362
363
364 FIXPOINT ADD-ON
365 ---------------
366
367 2CONSTANT       S>F             F.              F*              F#S             
368 F/              F-              F+              HOLDS           {FIXPOINT}
369
370 2CONSTANT       https://forth-standard.org/standard/double/TwoCONSTANT
371 S>F             u/n -- Qlo Qhi       convert u/n in a s15.16 value
372 F.              display a s15.16 value
373 F*              s15.16 multiplication  
374 F#S             Qlo Qhi u -- Qhi 0    
375                 convert fractionnal part of a s15.16 value displaying u digits
376 F/              s15.16 division        
377 F-              s15.16 soustraction
378 F+              s15.16 addition
379 HOLDS           https://forth-standard.org/standard/core/HOLDS
380 {FIXPOINT}      do nothing if compiled in core, else remove all FIXPOINT add-on.
381
382 UTILITY ADD-ON
383 --------------
384
385 DUMP            U.R             WORDS           ?               .RS             .S              {TOOLS}
386
387 DUMP            https://forth-standard.org/standard/tools/DUMP  
388 U.R   u z --    display unsigned number u with size z
389 WORDS           https://forth-standard.org/standard/tools/WORDS 
390 ?               https://forth-standard.org/standard/tools/q
391 .RS             displays return stack content
392 .S              https://forth-standard.org/standard/tools/DotS
393 {TOOLS}         do nothing if compiled in core.
394
395
396 SD_TOOLS ADD-ON
397 ---------------
398
399 DIR             FAT             CLUSTER         SECTOR          {SD_TOOLS}
400
401 DIR             dump first sector of current directory
402 FAT             dump first sector of FAT1
403 CLUSTER         .123 CLUSTER displays first sector of cluster 123
404 SECTOR          .123456789 SECTOR displays sector 123456789
405 {SD_TOOLS}      if you type {SD_TOOLS}  all subsequent loaded words are removed
406
407