FORTH vocabulary ---------------- COLD WARM WIPE RST_HERE PWR_HERE RST_STATE PWR_STATE MOVE LEAVE +LOOP LOOP DO REPEAT WHILE AGAIN UNTIL BEGIN THEN ELSE IF >BODY DEFER DOES> CREATE CONSTANT VARIABLE : ; POSTPONE RECURSE IMMEDIATE IS ['] ] [ \ ' ABORT" ABORT QUIT EVALUATE COUNT LITERAL , EXECUTE >NUMBER FIND WORD ." S" CR TYPE SPACES SPACE NOECHO ECHO EMIT ACCEPT KEY C, ALLOT HERE . D. U. SIGN HOLD #> #S # UM/MOD <# STATE BASE BL J I UNLOOP U< > < = 0< 0= DABS 1- 1+ 1- 1+ - + C! C@ ! @ DEPTH R@ R> >R ROT OVER SWAP NIP DROP ?DUP DUP LIT EXIT COLD Software reset WARM DEFERed word, by default executes ABORT" " WIPE resets the program memory to its original state (Deep_RST adds same effect to COLD). RST_HERE defines the bound of the program memory protected against COLD or hardware reset. PWR_HERE defines the bound of the program memory protected against ON/OFF and also against any error occurring. RST_STATE removes all words defined after RST_HERE (COLD or have same effet) PWR_STATE removes all words defined after PWR_HERE (an occurring error has same effect) MOVE https://forth-standard.org/standard/core/MOVE LEAVE https://forth-standard.org/standard/core/LEAVE +LOOP https://forth-standard.org/standard/core/PlusLOOP LOOP https://forth-standard.org/standard/core/LOOP DO https://forth-standard.org/standard/core/DO REPEAT https://forth-standard.org/standard/core/REPEAT WHILE https://forth-standard.org/standard/core/WHILE AGAIN https://forth-standard.org/standard/core/AGAIN UNTIL https://forth-standard.org/standard/core/UNTIL BEGIN https://forth-standard.org/standard/core/BEGIN THEN https://forth-standard.org/standard/core/THEN ELSE https://forth-standard.org/standard/core/ELSE IF https://forth-standard.org/standard/core/IF ; https://forth-standard.org/standard/core/Semi : https://forth-standard.org/standard/core/Colon DEFER https://forth-standard.org/standard/core/DEFER DOES> https://forth-standard.org/standard/core/DOES CREATE https://forth-standard.org/standard/core/CREATE CONSTANT https://forth-standard.org/standard/core/CONSTANT VARIABLE https://forth-standard.org/standard/core/VARIABLE POSTPONE https://forth-standard.org/standard/core/POSTPONE RECURSE https://forth-standard.org/standard/core/RECURSE IMMEDIATE https://forth-standard.org/standard/core/IMMEDIATE IS https://forth-standard.org/standard/core/IS ['] https://forth-standard.org/standard/core/BracketTick ] https://forth-standard.org/standard/core/right-bracket [ https://forth-standard.org/standard/core/Bracket \ https://forth-standard.org/standard/block/bs ' https://forth-standard.org/standard/core/Tick ABORT" https://forth-standard.org/standard/core/ABORTq ABORT https://forth-standard.org/standard/core/ABORT QUIT https://forth-standard.org/standard/core/QUIT EVALUATE https://forth-standard.org/standard/core/EVALUATE COUNT https://forth-standard.org/standard/core/COUNT LITERAL https://forth-standard.org/standard/core/LITERAL , https://forth-standard.org/standard/core/Comma EXECUTE https://forth-standard.org/standard/core/EXECUTE >NUMBER https://forth-standard.org/standard/core/toNUMBER FIND https://forth-standard.org/standard/core/FIND WORD https://forth-standard.org/standard/core/WORD ." https://forth-standard.org/standard/core/Dotq S" https://forth-standard.org/standard/core/Sq TYPE https://forth-standard.org/standard/core/TYPE SPACES https://forth-standard.org/standard/core/SPACES SPACE https://forth-standard.org/standard/core/SPACE CR DEFERed word, https://forth-standard.org/standard/core/CR NOECHO stop display on output ECHO start display on output EMIT DEFERed word, https://forth-standard.org/standard/core/EMIT ACCEPT DEFERed word, https://forth-standard.org/standard/core/ACCEPT KEY DEFERed word, https://forth-standard.org/standard/core/KEY C, https://forth-standard.org/standard/core/CComma ALLOT https://forth-standard.org/standard/core/ALLOT HERE https://forth-standard.org/standard/core/HERE . https://forth-standard.org/standard/core/d D. https://forth-standard.org/standard/double/Dd U. https://forth-standard.org/standard/core/Ud SIGN https://forth-standard.org/standard/core/SIGN HOLD https://forth-standard.org/standard/core/HOLD #> https://forth-standard.org/standard/core/num-end #S https://forth-standard.org/standard/core/numS # https://forth-standard.org/standard/core/num UM/MOD https://forth-standard.org/standard/core/UMDivMOD <# https://forth-standard.org/standard/core/num-start BL https://forth-standard.org/standard/core/BL STATE https://forth-standard.org/standard/core/STATE BASE https://forth-standard.org/standard/core/BASE J https://forth-standard.org/standard/core/J I https://forth-standard.org/standard/core/I UNLOOP https://forth-standard.org/standard/core/UNLOOP U< https://forth-standard.org/standard/core/Uless > https://forth-standard.org/standard/core/more < https://forth-standard.org/standard/core/less = https://forth-standard.org/standard/core/Equal 0< https://forth-standard.org/standard/core/Zeroless 0= https://forth-standard.org/standard/core/ZeroEqual DABS https://forth-standard.org/standard/double/DABS ABS https://forth-standard.org/standard/core/ABS NEGATE https://forth-standard.org/standard/core/NEGATE 1- https://forth-standard.org/standard/core/OneMinus 1+ https://forth-standard.org/standard/core/OnePlus - https://forth-standard.org/standard/core/Minus + https://forth-standard.org/standard/core/Plus C! https://forth-standard.org/standard/core/CStore C@ https://forth-standard.org/standard/core/CFetch ! https://forth-standard.org/standard/core/Store @ https://forth-standard.org/standard/core/Fetch DEPTH https://forth-standard.org/standard/core/DEPTH R@ https://forth-standard.org/standard/core/RFetch R> https://forth-standard.org/standard/core/Rfrom >R https://forth-standard.org/standard/core/toR ROT https://forth-standard.org/standard/core/ROT OVER https://forth-standard.org/standard/core/OVER SWAP https://forth-standard.org/standard/core/SWAP NIP https://forth-standard.org/standard/core/NIP DROP https://forth-standard.org/standard/core/DROP ?DUP https://forth-standard.org/standard/core/qDUP DUP https://forth-standard.org/standard/core/DUP LIT execution part of LITERAL EXIT https://forth-standard.org/standard/core/EXIT ASSEMBLER vocabulary -------------------- ?GOTO GOTO FW3 FW2 FW1 BW3 BW2 BW1 ?JMP JMP REPEAT WHILE AGAIN UNTIL ELSE THEN IF 0= 0<> U>= U< 0< 0>= S< S>= RRUM RLAM RRAM RRCM POPM PUSHM CALL PUSH.B PUSH SXT RRA.B RRA SWPB RRC.B RRC AND.B AND XOR.B XOR BIS.B BIS BIC.B BIC BIT.B BIT DADD.B DADD CMP.B CMP SUB.B SUB SUBC.B SUBC ADDC.B ADDC ADD.B ADD MOV.B MOV RETI LO2HI COLON ENDASM ENDCODE SLEEP ASM CODE HI2LO (added in forth vocabulary) see: http://www.ece.utep.edu/courses/web3376/Notes_files/ee3376-isa.pdf readme.md for symbolic alias of registers, symbolic jumps (IF ELSE THEN...),.. ?GOTO used after a conditionnal (0=,0<>,U>=,U<,0<,S<,S>=) to branch to a label FWx or BWx GOTO used as unconditionnal branch to a label FWx or BWx BW3 BACKWARD branch destination n°3 BW2 n°2 BW1 N°1 FW3 FORWARD branch destination n°3 FW2 n°2 FW1 n°1 ?JMP used after a conditionnal (0=,0<>,U>=,U<,0<,S<,S>=) to jump to a predefined word JMP unconditionnal jump to a predefined word REPEAT assembler version of the FORTH word REPEAT WHILE idem AGAIN idem UNTIL idem ELSE idem THEN idem IF idem 0= conditionnal 0<> conditionnal U>= conditionnal U< conditionnal 0< conditionnal, to use only with ?JMP ?GOTO 0>= conditionnal, to use only with IF UNTIL WHILE S< conditionnal S>= conditionnal LO2HI switches compilation between low level and high level modes without saving IP register. COLON pushes IP then performs LO2HI, used as: CODE ... assembler instr ... COLON ... FORTH words ... ; ENDASM to end an ASM definition. ENDCODE to end a CODE definition. SLEEP DEFERed word which enables to create a background task, default SLEEP definition: MOV #GIE+LPM0,SR next assembler words are set in FORTH vocabulary: CODE creates a word written in assembler. this defined must be ended with ENDCODE unless COLON or LO2HI use. ASM creates a word written in assembler but not interpretable by FORTH (because ended by RET instr.). this defined must be ended with ENDASM. This word will be recognized only in assembler mode. HI2LO used to switch compilation from high level (FORTH) to low level (assembler). ASSEMBLER WORDS set: RRUM http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=218 RLAM http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=208 RRAM http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=211 RRCM http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=214 POPM http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=204 PUSHM http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=205 CALL http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=142 PUSH.B PUSH http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=168 SXT http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=182 RRA.B RRA http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=173 SWPB http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=181 RRC.B RRC http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=174 AND.B AND http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=137 XOR.B XOR http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=184 BIS.B BIS http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=139 BIC.B BIC http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=138 BIT.B BIT http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=140 DADD.B DADD http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=149 CMP.B CMP http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=147 SUB.B SUB http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=179 SUBC.B SUBC http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=180 ADDC.B ADDC http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=136 ADD.B ADD http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=135 MOV.B MOV http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=165 RETI http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=170 CONDCOMP ADD-ON --------------- MARKER [DEFINED] [UNDEFINED] [IF] [ELSE] [THEN] COMPARE [DEFINED] https://forth-standard.org/standard/tools/BracketDEFINED [UNDEFINED] https://forth-standard.org/standard/tools/BracketUNDEFINED [IF] https://forth-standard.org/standard/tools/BracketIF [ELSE] https://forth-standard.org/standard/tools/BracketELSE [THEN] https://forth-standard.org/standard/tools/BracketTHEN COMPARE https://forth-standard.org/standard/string/COMPARE MARKER https://forth-standard.org/standard/core/MARKER VOCABULARY ADD-ON ----------------- DEFINITIONS ONLY PREVIOUS ALSO ASSEMBLER FORTH VOCABULARY DEFINITIONS https://forth-standard.org/standard/search/DEFINITIONS ONLY https://forth-standard.org/standard/search/ONLY PREVIOUS https://forth-standard.org/standard/search/PREVIOUS ALSO https://forth-standard.org/standard/search/ALSO ASSEMBLER assembler VOCABULARY FORTH FORTH VOCABULARY VOCABULARY creates a new VOCABULARY named word NONAME ADD-ON --------------------- :NONAME CODENNM :NONAME https://forth-standard.org/standard/core/ColonNONAME CODENNM assembly counterpart of :NONAME SD_CARD_LOADER ADD-ON --------------------- LOAD" CIB LOAD" LOAD" SD_TEST.4TH" loads and compile source file SD_TEST.4TH. CIB Currrent Input Buffer, TIB by default. ACCEPT becomes a DEFERed word SD_CARD_READ_WRITE ADD-ON ------------------------- TERM2SD" SD_EMIT WRITE READ CLOSE DEL" WRITE" READ" TERM2SD" TERM2SD" SD_TEST.4TH" copy input file to SD_CARD (use CopySourceFileToTarget_SD_Card.bat to do) SD_EMIT sends output stream at the end of last opened as write file. WRITE write sequentially BUFFER content to a sector READ read sequentially a sector to BUFFER CLOSE close last opened file. DEL" DEL" SD_TEST.4TH" remove this file from SD_CARD. WRITE" WRITE" TRUC" open or create TRUC file ready to write to the end of this file READ" READ" TRUC" open TRUC and load its first sector in BUFFER BOOTLOADER ---------- BOOT QUIT becomes a DEFERed word ; when ADD-ONs are compiled into the kernel, their respective MARKER word identified with braces {} does nothing. ; when ADD-ONs are downloaded, their respective MARKER word identified with braces {} removes all ADD-ONs words. ANS_COMPLEMENT ADD-ON --------------------- PAD SOURCE .( ( DECIMAL HEX FILL [CHAR] CHAR +! MIN MAX 2/ 2* RSHIFT LSHIFT XOR OR AND INVERT 2OVER 2SWAP 2DROP 2DUP 2! 2@ S>D CELL+ CELLS CHAR+ CHARS ALIGN ALIGNED */ */MOD MOD / /MOD * FM/MOD SM/REM M* UM* {ANS_COMP} PAD https://forth-standard.org/standard/core/PAD >IN https://forth-standard.org/standard/core/toIN >BODY https://forth-standard.org/standard/core/toBODY SOURCE https://forth-standard.org/standard/core/SOURCE .( https://forth-standard.org/standard/core/Dotp ( https://forth-standard.org/standard/core/p DECIMAL https://forth-standard.org/standard/core/DECIMAL HEX https://forth-standard.org/standard/core/HEX FILL https://forth-standard.org/standard/core/FILL [CHAR] https://forth-standard.org/standard/core/BracketCHAR CHAR https://forth-standard.org/standard/core/CHAR +! https://forth-standard.org/standard/core/PlusStore 2/ https://forth-standard.org/standard/core/TwoDiv 2* https://forth-standard.org/standard/core/TwoTimes MIN https://forth-standard.org/standard/core/MIN MAX https://forth-standard.org/standard/core/MAX RSHIFT https://forth-standard.org/standard/core/RSHIFT LSHIFT https://forth-standard.org/standard/core/LSHIFT INVERT https://forth-standard.org/standard/core/INVERT XOR https://forth-standard.org/standard/core/XOR OR https://forth-standard.org/standard/core/OR AND https://forth-standard.org/standard/core/AND 2OVER https://forth-standard.org/standard/core/TwoOVER 2SWAP https://forth-standard.org/standard/core/TwoSWAP 2DROP https://forth-standard.org/standard/core/TwoDROP 2DUP https://forth-standard.org/standard/core/TwoDUP 2! https://forth-standard.org/standard/core/TwoStore 2@ https://forth-standard.org/standard/core/TwoFetch S>D https://forth-standard.org/standard/core/StoD CELL+ https://forth-standard.org/standard/core/CELLPlus CELLS https://forth-standard.org/standard/core/CELLS CHAR+ https://forth-standard.org/standard/core/CHARPlus CHARS https://forth-standard.org/standard/core/CHARS ALIGN https://forth-standard.org/standard/core/ALIGN ALIGNED https://forth-standard.org/standard/core/ALIGNED */ https://forth-standard.org/standard/core/TimesDiv */MOD https://forth-standard.org/standard/core/TimesDivMOD MOD https://forth-standard.org/standard/core/MOD / https://forth-standard.org/standard/core/Div /MOD https://forth-standard.org/standard/core/DivMOD * https://forth-standard.org/standard/core/Times FM/MOD https://forth-standard.org/standard/core/FMDivMOD SM/REM https://forth-standard.org/standard/core/SMDivREM M* https://forth-standard.org/standard/core/MTimes UM* https://forth-standard.org/standard/core/UMTimes {ANS_COMP} FIXPOINT ADD-ON --------------- 2CONSTANT S>F F. F* F#S F/ F- F+ HOLDS {FIXPOINT} 2CONSTANT https://forth-standard.org/standard/double/TwoCONSTANT S>F u/n -- Qlo Qhi convert u/n in a s15.16 value F. display a s15.16 value F* s15.16 multiplication F#S Qlo Qhi u -- Qhi 0 convert fractionnal part of a s15.16 value displaying u digits F/ s15.16 division F- s15.16 soustraction F+ s15.16 addition HOLDS https://forth-standard.org/standard/core/HOLDS {FIXPOINT} do nothing if compiled in core, else remove all FIXPOINT add-on. UTILITY ADD-ON -------------- DUMP U.R WORDS ? .RS .S {TOOLS} DUMP https://forth-standard.org/standard/tools/DUMP U.R u z -- display unsigned number u with size z WORDS https://forth-standard.org/standard/tools/WORDS ? https://forth-standard.org/standard/tools/q .RS displays return stack content .S https://forth-standard.org/standard/tools/DotS {TOOLS} do nothing if compiled in core. SD_TOOLS ADD-ON --------------- DIR FAT CLUSTER SECTOR {SD_TOOLS} DIR dump first sector of current directory FAT dump first sector of FAT1 CLUSTER .123 CLUSTER displays first sector of cluster 123 SECTOR .123456789 SECTOR displays sector 123456789 {SD_TOOLS} if you type {SD_TOOLS} all subsequent loaded words are removed