RETURN-STACK-CELLS = 48 maximum size of the return stack, in cells STACK-CELLS = 48 maximum size of the data stack, in cells /COUNTED-STRING = 255 maximum size of a counted string, in characters /HOLD = 34 size of the pictured numeric output string buffer, in characters /PAD = 84 size of the scratch area pointed to by PAD, in characters ADDRESS-UNIT-BITS = 16 size of one address unit, in bits FLOORED = true true if floored division is the default MAX-CHAR = 255 maximum value of any character in the implementation-defined character set MAX-N = 32767 largest usable signed integer MAX-U = 65535 largest usable unsigned integer MAX-D = 2147483647 largest usable signed double number MAX-UD = 4294967295 largest usable unsigned double number FORTH vocabulary ---------------- COLD WARM WIPE RST_HERE PWR_HERE RST_STATE PWR_STATE BEGIN DOES> CREATE ; : IMMEDIATE POSTPONE ] [ \ ['] ABORT" ABORT QUIT EVALUATE COUNT LITERAL ALLOT , >NUMBER FIND WORD ." S" . U. SIGN HOLD #> #S # <# KEY CR TYPE NOECHO ECHO EMIT ACCEPT 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) NOECHO stop display on output ECHO start display on output BEGIN https://forth-standard.org/standard/core/BEGIN DOES> https://forth-standard.org/standard/core/DOES CREATE https://forth-standard.org/standard/core/CREATE ; https://forth-standard.org/standard/core/Semi : https://forth-standard.org/standard/core/Colon IMMEDIATE https://forth-standard.org/standard/core/IMMEDIATE POSTPONE https://forth-standard.org/standard/core/POSTPONE ] 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/BracketTick ' 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 ALLOT https://forth-standard.org/standard/core/ALLOT , https://forth-standard.org/standard/core/Comma >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 . https://forth-standard.org/standard/core/d 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 <# https://forth-standard.org/standard/core/num-start KEY DEFERed word, https://forth-standard.org/standard/core/KEY CR DEFERed word, https://forth-standard.org/standard/core/CR TYPE https://forth-standard.org/standard/core/TYPE EMIT DEFERed word, https://forth-standard.org/standard/core/EMIT ACCEPT DEFERed word, https://forth-standard.org/standard/core/ACCEPT 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: ADD http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=135 ADDC http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=136 AND http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=137 BIC http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=138 BIS http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=139 BIT http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=140 CALL http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=142 CMP http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=147 DADD http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=149 MOV http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=165 PUSH http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=168 RETI http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=170 RRA http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=173 RRC http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=174 SUB http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=179 SUBC http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=180 SWPB http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=181 SXT http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=182 XOR http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=184 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 ASSEMBLER_EXTENDED WORDS set: ADDX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=187 ADDCX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=188 ANDX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=189 BICX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=190 BISX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=191 BITX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=192 CMPX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=194 DADDX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=196 MOVX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=202 PUSHX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=207 RRAX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=212 RRCX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=216 RRUX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=219 SUBX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=221 SUBCX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=222 SWPBX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=223 SXTX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=225 XORX http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=227 ADDA http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=229 CALLA http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=232 CMPA http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=235 MOVA http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=238 SUBA http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=241 RPT http://www.ti.com/lit/ug/slau272d/slau272d.pdf#page=219 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 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 source file SD_TEST.4TH from SD_Card and compile it. 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 --------------------- SPACES SPACE BL PAD >IN BASE STATE CONSTANT VARIABLE SOURCE RECURSE EXECUTE >BODY .( ( DECIMAL HEX HERE FILL MOVE +! [CHAR] CHAR CELL+ CELLS CHAR+ CHARS ALIGN ALIGNED 2OVER 2SWAP 2DROP 2DUP 2! 2@ R@ ROT OVER */ */MOD MOD / /MOD * FM/MOD ABS NEGATE SM/REM UM/MOD M* UM* 2/ 2* MIN MAX RSHIFT LSHIFT INVERT 1- 1+ S>D XOR OR AND LEAVE UNLOOP J I +LOOP LOOP DO REPEAT WHILE AGAIN UNTIL ELSE THEN IF > < U< = 0< 0= C, C! C@ R> >R NIP DROP SWAP DEPTH EXIT ?DUP DUP ! @ - + {CORE_COMP} SPACES https://forth-standard.org/standard/core/SPACES SPACE https://forth-standard.org/standard/core/SPACE BL https://forth-standard.org/standard/core/BL PAD https://forth-standard.org/standard/core/PAD >IN https://forth-standard.org/standard/core/toIN BASE https://forth-standard.org/standard/core/BASE STATE https://forth-standard.org/standard/core/STATE CONSTANT https://forth-standard.org/standard/core/CONSTANT VARIABLE https://forth-standard.org/standard/core/VARIABLE SOURCE https://forth-standard.org/standard/core/SOURCE RECURSE https://forth-standard.org/standard/core/RECURSE EXECUTE https://forth-standard.org/standard/core/EXECUTE >BODY https://forth-standard.org/standard/core/toBODY .( 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 HERE https://forth-standard.org/standard/core/HERE FILL https://forth-standard.org/standard/core/FILL MOVE https://forth-standard.org/standard/core/MOVE +! https://forth-standard.org/standard/core/PlusStore [CHAR] https://forth-standard.org/standard/core/BracketCHAR CHAR https://forth-standard.org/standard/core/CHAR 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 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 R@ https://forth-standard.org/standard/core/RFetch ROT https://forth-standard.org/standard/core/ROT OVER https://forth-standard.org/standard/core/OVER */ 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 ABS https://forth-standard.org/standard/core/ABS NEGATE https://forth-standard.org/standard/core/NEGATE SM/REM https://forth-standard.org/standard/core/SMDivREM UM/MOD https://forth-standard.org/standard/core/UMDivMOD M* https://forth-standard.org/standard/core/MTimes UM* https://forth-standard.org/standard/core/UMTimes 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 1- https://forth-standard.org/standard/core/OneMinus 1+ https://forth-standard.org/standard/core/OnePlus S>D https://forth-standard.org/standard/core/StoD XOR https://forth-standard.org/standard/core/XOR OR https://forth-standard.org/standard/core/OR AND https://forth-standard.org/standard/core/AND LEAVE https://forth-standard.org/standard/core/LEAVE UNLOOP https://forth-standard.org/standard/core/UNLOOP J https://forth-standard.org/standard/core/J I https://forth-standard.org/standard/core/I +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 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/more < https://forth-standard.org/standard/core/less U< https://forth-standard.org/standard/core/Uless = https://forth-standard.org/standard/core/Equal 0< https://forth-standard.org/standard/core/Zeroless 0= https://forth-standard.org/standard/core/ZeroEqual C, https://forth-standard.org/standard/core/CComma C! https://forth-standard.org/standard/core/CStore C@ https://forth-standard.org/standard/core/CFetch R> https://forth-standard.org/standard/core/Rfrom >R https://forth-standard.org/standard/core/toR NIP https://forth-standard.org/standard/core/NIP DROP https://forth-standard.org/standard/core/DROP SWAP https://forth-standard.org/standard/core/SWAP DEPTH https://forth-standard.org/standard/core/DEPTH EXIT https://forth-standard.org/standard/core/EXIT ?DUP https://forth-standard.org/standard/core/qDUP DUP https://forth-standard.org/standard/core/DUP ! https://forth-standard.org/standard/core/Store @ https://forth-standard.org/standard/core/Fetch - https://forth-standard.org/standard/core/Minus + https://forth-standard.org/standard/core/Plus {CORE_COMP} OTHER WORDS MARKER https://forth-standard.org/standard/core/MARKER DEFER https://forth-standard.org/standard/core/DEFER IS https://forth-standard.org/standard/core/IS D. https://forth-standard.org/standard/double/Dd DABS https://forth-standard.org/standard/double/DABS TO https://forth-standard.org/standard/core/TO VALUE https://forth-standard.org/standard/core/VALUE 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