aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/msp430/words
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-08-19 12:15:28 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-08-19 12:15:28 +0200
commit67d25d837ac55f28a366c0a3b262e439a6e75fc3 (patch)
treedf7715c7724c5935ab87c807f3b8b4ef529315e3 /amforth-6.5/msp430/words
parente0d6784e89dba33226c0edb815bb974486fa7c48 (diff)
Add AmForth
Diffstat (limited to 'amforth-6.5/msp430/words')
-rw-r--r--amforth-6.5/msp430/words/1-minus.asm4
-rw-r--r--amforth-6.5/msp430/words/1-plus.asm4
-rw-r--r--amforth-6.5/msp430/words/2-r-from.asm9
-rw-r--r--amforth-6.5/msp430/words/2-slash.asm4
-rw-r--r--amforth-6.5/msp430/words/2-star.asm4
-rw-r--r--amforth-6.5/msp430/words/2-to-r.asm7
-rw-r--r--amforth-6.5/msp430/words/a-to-info.asm5
-rw-r--r--amforth-6.5/msp430/words/align.asm4
-rw-r--r--amforth-6.5/msp430/words/aligned.asm4
-rw-r--r--amforth-6.5/msp430/words/allot.asm4
-rw-r--r--amforth-6.5/msp430/words/and.asm4
-rw-r--r--amforth-6.5/msp430/words/bm-clear.asm6
-rw-r--r--amforth-6.5/msp430/words/bm-set.asm6
-rw-r--r--amforth-6.5/msp430/words/bm-test.asm5
-rw-r--r--amforth-6.5/msp430/words/branch.asm4
-rw-r--r--amforth-6.5/msp430/words/byte-swap.asm4
-rw-r--r--amforth-6.5/msp430/words/c-comma.asm10
-rw-r--r--amforth-6.5/msp430/words/c-fetch.asm4
-rw-r--r--amforth-6.5/msp430/words/c-store.asm6
-rw-r--r--amforth-6.5/msp430/words/cellplus.asm5
-rw-r--r--amforth-6.5/msp430/words/cells.asm2
-rw-r--r--amforth-6.5/msp430/words/cmove-up.asm16
-rw-r--r--amforth-6.5/msp430/words/cmove.asm16
-rw-r--r--amforth-6.5/msp430/words/code.asm5
-rw-r--r--amforth-6.5/msp430/words/colon-noname.asm6
-rw-r--r--amforth-6.5/msp430/words/comma.asm10
-rw-r--r--amforth-6.5/msp430/words/compare.asm18
-rw-r--r--amforth-6.5/msp430/words/d-2slash.asm5
-rw-r--r--amforth-6.5/msp430/words/d-2star.asm5
-rw-r--r--amforth-6.5/msp430/words/d-minus.asm10
-rw-r--r--amforth-6.5/msp430/words/d-plus.asm10
-rw-r--r--amforth-6.5/msp430/words/dabs.asm4
-rw-r--r--amforth-6.5/msp430/words/dnegate.asm5
-rw-r--r--amforth-6.5/msp430/words/do-constant.asm10
-rw-r--r--amforth-6.5/msp430/words/do-defer.asm16
-rw-r--r--amforth-6.5/msp430/words/do-do.asm25
-rw-r--r--amforth-6.5/msp430/words/do-does.asm28
-rw-r--r--amforth-6.5/msp430/words/do-loop.asm20
-rw-r--r--amforth-6.5/msp430/words/do-plusloop.asm20
-rw-r--r--amforth-6.5/msp430/words/do-squote.asm15
-rw-r--r--amforth-6.5/msp430/words/do-value.asm15
-rw-r--r--amforth-6.5/msp430/words/do-variable.asm11
-rw-r--r--amforth-6.5/msp430/words/does.asm20
-rw-r--r--amforth-6.5/msp430/words/dp.asm4
-rw-r--r--amforth-6.5/msp430/words/drop.asm4
-rw-r--r--amforth-6.5/msp430/words/dup.asm5
-rw-r--r--amforth-6.5/msp430/words/end-code.asm5
-rw-r--r--amforth-6.5/msp430/words/environment.asm4
-rw-r--r--amforth-6.5/msp430/words/equal.asm7
-rw-r--r--amforth-6.5/msp430/words/execute.asm7
-rw-r--r--amforth-6.5/msp430/words/exit.asm4
-rw-r--r--amforth-6.5/msp430/words/fetch.asm4
-rw-r--r--amforth-6.5/msp430/words/fill.asm12
-rw-r--r--amforth-6.5/msp430/words/fm-mod.asm12
-rw-r--r--amforth-6.5/msp430/words/forth-recognizer.asm8
-rw-r--r--amforth-6.5/msp430/words/forth-wordlist.asm4
-rw-r--r--amforth-6.5/msp430/words/g-mark.asm3
-rw-r--r--amforth-6.5/msp430/words/g-resolve.asm5
-rw-r--r--amforth-6.5/msp430/words/get-current.asm2
-rw-r--r--amforth-6.5/msp430/words/greater.asm3
-rw-r--r--amforth-6.5/msp430/words/header.asm14
-rw-r--r--amforth-6.5/msp430/words/here.asm4
-rw-r--r--amforth-6.5/msp430/words/hld.asm4
-rw-r--r--amforth-6.5/msp430/words/i-allot.asm4
-rw-r--r--amforth-6.5/msp430/words/i-cellplus.asm4
-rw-r--r--amforth-6.5/msp430/words/i-fetch.asm2
-rw-r--r--amforth-6.5/msp430/words/i-here.asm4
-rw-r--r--amforth-6.5/msp430/words/i.asm8
-rw-r--r--amforth-6.5/msp430/words/ic-fetch.asm2
-rw-r--r--amforth-6.5/msp430/words/icount.asm3
-rw-r--r--amforth-6.5/msp430/words/idp.asm4
-rw-r--r--amforth-6.5/msp430/words/immediate-q.asm15
-rw-r--r--amforth-6.5/msp430/words/immediate.asm4
-rw-r--r--amforth-6.5/msp430/words/infodp.asm4
-rw-r--r--amforth-6.5/msp430/words/int-fetch.asm4
-rw-r--r--amforth-6.5/msp430/words/int-off.asm3
-rw-r--r--amforth-6.5/msp430/words/int-on.asm3
-rw-r--r--amforth-6.5/msp430/words/int-store.asm5
-rw-r--r--amforth-6.5/msp430/words/int-trap.asm4
-rw-r--r--amforth-6.5/msp430/words/invert.asm4
-rw-r--r--amforth-6.5/msp430/words/isr-exec.asm7
-rw-r--r--amforth-6.5/msp430/words/itype.asm6
-rw-r--r--amforth-6.5/msp430/words/j.asm9
-rw-r--r--amforth-6.5/msp430/words/l-0.asm3
-rw-r--r--amforth-6.5/msp430/words/l-mark.asm2
-rw-r--r--amforth-6.5/msp430/words/l-resolve.asm4
-rw-r--r--amforth-6.5/msp430/words/latest.asm3
-rw-r--r--amforth-6.5/msp430/words/less.asm7
-rw-r--r--amforth-6.5/msp430/words/lit.asm8
-rw-r--r--amforth-6.5/msp430/words/lp.asm4
-rw-r--r--amforth-6.5/msp430/words/lshift.asm10
-rw-r--r--amforth-6.5/msp430/words/m-plus.asm6
-rw-r--r--amforth-6.5/msp430/words/m-star.asm8
-rw-r--r--amforth-6.5/msp430/words/mcu-sr-fetch.asm5
-rw-r--r--amforth-6.5/msp430/words/minus.asm6
-rw-r--r--amforth-6.5/msp430/words/n_r_from.asm17
-rw-r--r--amforth-6.5/msp430/words/n_to_r.asm15
-rw-r--r--amforth-6.5/msp430/words/name2flags.asm3
-rw-r--r--amforth-6.5/msp430/words/negate.asm5
-rw-r--r--amforth-6.5/msp430/words/newest.asm3
-rw-r--r--amforth-6.5/msp430/words/nfa-to-cfa.asm5
-rw-r--r--amforth-6.5/msp430/words/nfa-to-lfa.asm4
-rw-r--r--amforth-6.5/msp430/words/nip.asm4
-rw-r--r--amforth-6.5/msp430/words/or.asm4
-rw-r--r--amforth-6.5/msp430/words/over.asm8
-rw-r--r--amforth-6.5/msp430/words/pause.asm7
-rw-r--r--amforth-6.5/msp430/words/plus-store.asm5
-rw-r--r--amforth-6.5/msp430/words/plus.asm4
-rw-r--r--amforth-6.5/msp430/words/q-branch.asm7
-rw-r--r--amforth-6.5/msp430/words/qdup.asm5
-rw-r--r--amforth-6.5/msp430/words/r-0.asm3
-rw-r--r--amforth-6.5/msp430/words/r-fetch.asm6
-rw-r--r--amforth-6.5/msp430/words/r-from.asm6
-rw-r--r--amforth-6.5/msp430/words/reg-a.asm95
-rw-r--r--amforth-6.5/msp430/words/restore.asm7
-rw-r--r--amforth-6.5/msp430/words/rot.asm7
-rw-r--r--amforth-6.5/msp430/words/rp-fetch.asm6
-rw-r--r--amforth-6.5/msp430/words/rp-store.asm5
-rw-r--r--amforth-6.5/msp430/words/rshift.asm11
-rw-r--r--amforth-6.5/msp430/words/s-0.asm3
-rw-r--r--amforth-6.5/msp430/words/s-equal.asm19
-rw-r--r--amforth-6.5/msp430/words/scomma.asm10
-rw-r--r--amforth-6.5/msp430/words/set-current.asm2
-rw-r--r--amforth-6.5/msp430/words/slash-mod.asm4
-rw-r--r--amforth-6.5/msp430/words/sm-rem.asm12
-rw-r--r--amforth-6.5/msp430/words/sp-fetch.asm6
-rw-r--r--amforth-6.5/msp430/words/sp-store.asm5
-rw-r--r--amforth-6.5/msp430/words/state.asm4
-rw-r--r--amforth-6.5/msp430/words/store.asm5
-rw-r--r--amforth-6.5/msp430/words/swap.asm6
-rw-r--r--amforth-6.5/msp430/words/to-body.asm3
-rw-r--r--amforth-6.5/msp430/words/to-r.asm5
-rw-r--r--amforth-6.5/msp430/words/turnkey.asm5
-rw-r--r--amforth-6.5/msp430/words/u-less.asm6
-rw-r--r--amforth-6.5/msp430/words/uinit.asm39
-rw-r--r--amforth-6.5/msp430/words/um-slash-mod.asm31
-rw-r--r--amforth-6.5/msp430/words/um-star.asm38
-rw-r--r--amforth-6.5/msp430/words/unloop.asm5
-rw-r--r--amforth-6.5/msp430/words/up.asm11
-rw-r--r--amforth-6.5/msp430/words/usart-rx.asm10
-rw-r--r--amforth-6.5/msp430/words/usart-rxq.asm14
-rw-r--r--amforth-6.5/msp430/words/usart-tx.asm14
-rw-r--r--amforth-6.5/msp430/words/usart-txq.asm15
-rw-r--r--amforth-6.5/msp430/words/user.asm9
-rw-r--r--amforth-6.5/msp430/words/wlscope.asm5
-rw-r--r--amforth-6.5/msp430/words/wordlist.asm14
-rw-r--r--amforth-6.5/msp430/words/xor.asm5
-rw-r--r--amforth-6.5/msp430/words/zero-equal.asm5
-rw-r--r--amforth-6.5/msp430/words/zero-less.asm6
149 files changed, 1233 insertions, 0 deletions
diff --git a/amforth-6.5/msp430/words/1-minus.asm b/amforth-6.5/msp430/words/1-minus.asm
new file mode 100644
index 0000000..6c71cc7
--- /dev/null
+++ b/amforth-6.5/msp430/words/1-minus.asm
@@ -0,0 +1,4 @@
+;C 1- n1/u1 -- n2/u2 subtract 1 from TOS
+ CODEHEADER(XT_1MINUS,2,"1-")
+ SUB #1,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/1-plus.asm b/amforth-6.5/msp430/words/1-plus.asm
new file mode 100644
index 0000000..c9d78d2
--- /dev/null
+++ b/amforth-6.5/msp430/words/1-plus.asm
@@ -0,0 +1,4 @@
+;C 1+ n1/u1 -- n2/u2 add 1 to TOS
+ CODEHEADER(XT_1PLUS,2,"1+")
+ ADD #1,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/2-r-from.asm b/amforth-6.5/msp430/words/2-r-from.asm
new file mode 100644
index 0000000..16ea605
--- /dev/null
+++ b/amforth-6.5/msp430/words/2-r-from.asm
@@ -0,0 +1,9 @@
+;C 2R> -- d R: d -- pop from return stack
+ CODEHEADER(XT_2R_FROM,3,"2r>")
+ SUB #4,PSP ; 2
+ MOV TOS,2(PSP) ; 4
+ MOV @RSP+,TOS
+ MOV @RSP+,W
+ MOV W,0(PSP) ; 4
+
+ NEXT
diff --git a/amforth-6.5/msp430/words/2-slash.asm b/amforth-6.5/msp430/words/2-slash.asm
new file mode 100644
index 0000000..79abf8e
--- /dev/null
+++ b/amforth-6.5/msp430/words/2-slash.asm
@@ -0,0 +1,4 @@
+;C 2/ x1 -- x2 arithmetic right shift
+ CODEHEADER(XT_2SLASH,2,"2/")
+ RRA TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/2-star.asm b/amforth-6.5/msp430/words/2-star.asm
new file mode 100644
index 0000000..471dc56
--- /dev/null
+++ b/amforth-6.5/msp430/words/2-star.asm
@@ -0,0 +1,4 @@
+;C 2* x1 -- x2 arithmetic left shift
+ CODEHEADER(XT_2STAR,2,"2*")
+ ADD TOS,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/2-to-r.asm b/amforth-6.5/msp430/words/2-to-r.asm
new file mode 100644
index 0000000..b7e38a2
--- /dev/null
+++ b/amforth-6.5/msp430/words/2-to-r.asm
@@ -0,0 +1,7 @@
+;C 2>R d -- R: -- d push to return stack
+ CODEHEADER(XT_2TO_R,3,"2>r")
+ MOV @PSP+,W
+ PUSH W
+ PUSH TOS
+ MOV @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/a-to-info.asm b/amforth-6.5/msp430/words/a-to-info.asm
new file mode 100644
index 0000000..302e2fe
--- /dev/null
+++ b/amforth-6.5/msp430/words/a-to-info.asm
@@ -0,0 +1,5 @@
+; convert a RAM address into an INFO flash address
+; base a>info @ may be 0 or another value
+ HEADER(XT_ADDR_TO_INFO,6,"a>info",DOCOLON)
+
+ .dw XT_DOLITERAL, INFOSTART, XT_DOLITERAL,RAMINFOAREA,XT_MINUS,XT_PLUS,XT_EXIT
diff --git a/amforth-6.5/msp430/words/align.asm b/amforth-6.5/msp430/words/align.asm
new file mode 100644
index 0000000..a9ba1a5
--- /dev/null
+++ b/amforth-6.5/msp430/words/align.asm
@@ -0,0 +1,4 @@
+;C ALIGN -- align HERE
+; IHERE 1 AND IALLOT ;
+ HEADER(XT_ALIGN,5,"align",DOCOLON)
+ DW XT_IHERE,XT_ONE,XT_AND,XT_IALLOT,XT_EXIT
diff --git a/amforth-6.5/msp430/words/aligned.asm b/amforth-6.5/msp430/words/aligned.asm
new file mode 100644
index 0000000..dfdd37b
--- /dev/null
+++ b/amforth-6.5/msp430/words/aligned.asm
@@ -0,0 +1,4 @@
+;C ALIGNED addr -- a-addr align given addr
+; DUP 1 AND + ;
+ HEADER(XT_ALIGNED,7,"aligned",DOCOLON)
+ DW XT_DUP,XT_ONE,XT_AND,XT_PLUS,XT_EXIT
diff --git a/amforth-6.5/msp430/words/allot.asm b/amforth-6.5/msp430/words/allot.asm
new file mode 100644
index 0000000..50b80d8
--- /dev/null
+++ b/amforth-6.5/msp430/words/allot.asm
@@ -0,0 +1,4 @@
+;C ALLOT n -- allocate n bytes in dict
+; DP +! ;
+ HEADER(XT_ALLOT,5,"allot",DOCOLON)
+ DW XT_DP,XT_PLUSSTORE,XT_EXIT
diff --git a/amforth-6.5/msp430/words/and.asm b/amforth-6.5/msp430/words/and.asm
new file mode 100644
index 0000000..7bc3533
--- /dev/null
+++ b/amforth-6.5/msp430/words/and.asm
@@ -0,0 +1,4 @@
+;C AND x1 x2 -- x3 logical AND
+ CODEHEADER(XT_AND,3,"and")
+ AND @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/bm-clear.asm b/amforth-6.5/msp430/words/bm-clear.asm
new file mode 100644
index 0000000..4cffa1d
--- /dev/null
+++ b/amforth-6.5/msp430/words/bm-clear.asm
@@ -0,0 +1,6 @@
+;Z CCLRB c c-addr -- clear bits in memory byte
+ CODEHEADER(XT_BM_CLEAR,8,"bm-clear")
+ MOV @PSP+,W
+ BIC.B W,0(TOS)
+ MOV @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/bm-set.asm b/amforth-6.5/msp430/words/bm-set.asm
new file mode 100644
index 0000000..ac7a071
--- /dev/null
+++ b/amforth-6.5/msp430/words/bm-set.asm
@@ -0,0 +1,6 @@
+;Z CSETB c c-addr -- set bits in memory byte
+ CODEHEADER(XT_BM_SET,6,"bm-set")
+ MOV @PSP+,W
+ BIS.B W,0(TOS)
+ MOV @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/bm-test.asm b/amforth-6.5/msp430/words/bm-test.asm
new file mode 100644
index 0000000..ce9ec0d
--- /dev/null
+++ b/amforth-6.5/msp430/words/bm-test.asm
@@ -0,0 +1,5 @@
+;Z CTSTB c c-addr -- c2 test bits in memory byte
+ CODEHEADER(XT_BM_TEST,5,"bm-test")
+ MOV.B @TOS,TOS
+ AND @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/branch.asm b/amforth-6.5/msp430/words/branch.asm
new file mode 100644
index 0000000..8424672
--- /dev/null
+++ b/amforth-6.5/msp430/words/branch.asm
@@ -0,0 +1,4 @@
+;Z branch -- branch always
+ CODEHEADER(XT_DOBRANCH,6,"branch")
+dobran: ADD @IP,IP ; 2
+ NEXT ; 4
diff --git a/amforth-6.5/msp430/words/byte-swap.asm b/amforth-6.5/msp430/words/byte-swap.asm
new file mode 100644
index 0000000..23cd9e7
--- /dev/null
+++ b/amforth-6.5/msp430/words/byte-swap.asm
@@ -0,0 +1,4 @@
+;Z >< x1 -- x2 swap bytes (not ANSI)
+ CODEHEADER(XT_SWAPBYTES,2,"><")
+ SWPB TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/c-comma.asm b/amforth-6.5/msp430/words/c-comma.asm
new file mode 100644
index 0000000..5064768
--- /dev/null
+++ b/amforth-6.5/msp430/words/c-comma.asm
@@ -0,0 +1,10 @@
+;C IC, char -- append char to Code dict
+; XT_IHERE IC! 1 CHARS IALLOT ;
+ ; HEADER(ICCOMMA,3,"IC,",DOCOLON)
+ DW link
+ DB 0FFh ; not immediate
+.set link = $
+ DB 2,"c,"
+ .align 16
+XT_CCOMMA: DW DOCOLON
+ DW XT_IHERE,XT_CSTOREI,XT_ONE,XT_IALLOT,XT_EXIT
diff --git a/amforth-6.5/msp430/words/c-fetch.asm b/amforth-6.5/msp430/words/c-fetch.asm
new file mode 100644
index 0000000..232603b
--- /dev/null
+++ b/amforth-6.5/msp430/words/c-fetch.asm
@@ -0,0 +1,4 @@
+;C C@ c-addr -- char fetch char from memory
+ CODEHEADER(XT_CFETCH,2,"c@")
+ MOV.B @TOS,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/c-store.asm b/amforth-6.5/msp430/words/c-store.asm
new file mode 100644
index 0000000..8969947
--- /dev/null
+++ b/amforth-6.5/msp430/words/c-store.asm
@@ -0,0 +1,6 @@
+;C C! char c-addr -- store char in memory
+ CODEHEADER(XT_CSTORE,2,"c!")
+ MOV @PSP+,W
+ MOV.B W,0(TOS)
+ MOV @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/cellplus.asm b/amforth-6.5/msp430/words/cellplus.asm
new file mode 100644
index 0000000..c8f4066
--- /dev/null
+++ b/amforth-6.5/msp430/words/cellplus.asm
@@ -0,0 +1,5 @@
+;C CELL+ a-addr1 -- a-addr2 add cell size
+; 2 + ;
+ CODEHEADER(XT_CELLPLUS,5,"cell+")
+ ADD #2,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/cells.asm b/amforth-6.5/msp430/words/cells.asm
new file mode 100644
index 0000000..46aec5a
--- /dev/null
+++ b/amforth-6.5/msp430/words/cells.asm
@@ -0,0 +1,2 @@
+;C CELLS n1 -- n2 cells->adrs units
+ HEADER(XT_CELLS,5,"cells",XT_2STAR+2)
diff --git a/amforth-6.5/msp430/words/cmove-up.asm b/amforth-6.5/msp430/words/cmove-up.asm
new file mode 100644
index 0000000..0bbe4a3
--- /dev/null
+++ b/amforth-6.5/msp430/words/cmove-up.asm
@@ -0,0 +1,16 @@
+;X CMOVE> c-addr1 c-addr2 u -- move from top
+; as defined in the ANSI optional String word set
+ CODEHEADER(XT_CMOVEUP,6,"cmove>")
+ MOV @PSP+,W ; dest adrs
+ MOV @PSP+,X ; src adrs
+ CMP #0,TOS
+ JZ CMOVU_X
+ ADD TOS,W ; start at end
+ ADD TOS,X
+CMOVU_1: SUB #1,X
+ SUB #1,W
+ MOV.B @X,0(W) ; copy byte
+ SUB #1,TOS
+ JNZ CMOVU_1
+CMOVU_X: MOV @PSP+,TOS ; pop new TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/cmove.asm b/amforth-6.5/msp430/words/cmove.asm
new file mode 100644
index 0000000..a25b255
--- /dev/null
+++ b/amforth-6.5/msp430/words/cmove.asm
@@ -0,0 +1,16 @@
+;X CMOVE c-addr1 c-addr2 u -- move from bottom
+; as defined in the ANSI optional String word set
+; On byte machines, CMOVE and CMOVE> are logical
+; factors of MOVE. They are easy to implement on
+; CPUs which have a block-move instruction.
+ CODEHEADER(XT_CMOVE,5,"cmove")
+ MOV @PSP+,W ; dest adrs
+ MOV @PSP+,X ; src adrs
+ CMP #0,TOS
+ JZ CMOVE_X
+CMOVE_1: MOV.B @X+,0(W) ; copy byte
+ ADD #1,W
+ SUB #1,TOS
+ JNZ CMOVE_1
+CMOVE_X: MOV @PSP+,TOS ; pop new TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/code.asm b/amforth-6.5/msp430/words/code.asm
new file mode 100644
index 0000000..73fbf2b
--- /dev/null
+++ b/amforth-6.5/msp430/words/code.asm
@@ -0,0 +1,5 @@
+;U MSP430CODE <name> -- build header for assembler word
+; <builds ihere ihere 2 - i! ;
+ HEADER(XT_CODE,4,"code",DOCOLON)
+ DW XT_DOCREATE,XT_IHERE,XT_ICELLPLUS,XT_COMMA
+ DW XT_REVEAL,XT_EXIT
diff --git a/amforth-6.5/msp430/words/colon-noname.asm b/amforth-6.5/msp430/words/colon-noname.asm
new file mode 100644
index 0000000..476a344
--- /dev/null
+++ b/amforth-6.5/msp430/words/colon-noname.asm
@@ -0,0 +1,6 @@
+;C : -- begin a colon definition
+ HEADER(XT_COLONNONAME,7,":noname",DOCOLON)
+ DW XT_IHERE,XT_DUP,XT_LATEST,XT_STORE
+ DW XT_COMPILE,DOCOLON
+ DW XT_RBRACKET
+ DW XT_EXIT
diff --git a/amforth-6.5/msp430/words/comma.asm b/amforth-6.5/msp430/words/comma.asm
new file mode 100644
index 0000000..0f2c8d1
--- /dev/null
+++ b/amforth-6.5/msp430/words/comma.asm
@@ -0,0 +1,10 @@
+;C I, x -- append cell to Code dict
+; XT_IHERE I! 1 CELLS IALLOT ;
+ ; HEADER(COMMA,2,",",DOCOLON)
+ DW link
+ DB 0FFh ; not immediate
+.set link = $
+ DB 1,","
+ .align 16
+XT_COMMA: DW DOCOLON
+ DW XT_IHERE,XT_STOREI,XT_TWO,XT_IALLOT,XT_EXIT
diff --git a/amforth-6.5/msp430/words/compare.asm b/amforth-6.5/msp430/words/compare.asm
new file mode 100644
index 0000000..75a8644
--- /dev/null
+++ b/amforth-6.5/msp430/words/compare.asm
@@ -0,0 +1,18 @@
+
+HEADER(XT_COMPARE,7,"compare",DOCOLON)
+
+; : compare ( c-addr1 len1 c-addr2 len 2 -- f )
+; f == 0 if both strings are equal
+; f <> 0 if strings differ, details are way more complex
+; rot over <> if ( -- c-addr1 c-addr2 len2)
+; \ string dont have the same length
+; drop drop drop -1 exit then
+; s= ;
+
+ DW XT_ROT,XT_OVER,XT_NOTEQUAL
+ DW XT_DOCONDBRANCH
+ DEST(COMPARE_1)
+ DW XT_DROP,XT_2DROP, XT_MINUSONE,XT_EXIT
+COMPARE_1:
+ DW XT_SEQUAL
+ DW XT_EXIT
diff --git a/amforth-6.5/msp430/words/d-2slash.asm b/amforth-6.5/msp430/words/d-2slash.asm
new file mode 100644
index 0000000..06569f3
--- /dev/null
+++ b/amforth-6.5/msp430/words/d-2slash.asm
@@ -0,0 +1,5 @@
+CODEHEADER(XT_D2SLASH,3,"d2/")
+
+ RRA TOS
+ RRC @PSP
+ NEXT
diff --git a/amforth-6.5/msp430/words/d-2star.asm b/amforth-6.5/msp430/words/d-2star.asm
new file mode 100644
index 0000000..f275f8c
--- /dev/null
+++ b/amforth-6.5/msp430/words/d-2star.asm
@@ -0,0 +1,5 @@
+CODEHEADER(XT_D2STAR,3,"d2*")
+
+ RLA @PSP
+ RLC TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/d-minus.asm b/amforth-6.5/msp430/words/d-minus.asm
new file mode 100644
index 0000000..a39db67
--- /dev/null
+++ b/amforth-6.5/msp430/words/d-minus.asm
@@ -0,0 +1,10 @@
+;C d+ d1/ud1 d2/ud2 -- d3/ud3 sub d1-d2
+; d1-lo d1-hi d2-lo d2-hi -- d3-lo d3 -hi
+; 4(PSP) 2(PSP) @(PSP) TOS -- NOS TOS
+
+ CODEHEADER(XT_DMINUS,2,"d-")
+ SUB 0(PSP),4(PSP) ; subtract contents of scratchregister X from workregister, result is in scratchregister X
+ SUBC TOS,2(PSP) ; subtract content of TOS from the 3rd item, result is in 3rd item
+ MOV 2(PSP),TOS ; move contoent of 3rd item to TOS
+ ADD #4,PSP ; adjust parameterstackpointer, i.e. nip nip
+ NEXT
diff --git a/amforth-6.5/msp430/words/d-plus.asm b/amforth-6.5/msp430/words/d-plus.asm
new file mode 100644
index 0000000..90e62d7
--- /dev/null
+++ b/amforth-6.5/msp430/words/d-plus.asm
@@ -0,0 +1,10 @@
+;C d+ d1/ud1 d2/ud2 -- d3/ud3 add d1+d2
+; d1-lo d1-hi d2-lo d2-hi -- d3-lo d3 -hi
+; 4(PSP) 2(PSP) @(PSP) TOS -- NOS TOS
+
+ CODEHEADER(XT_DPLUS,2,"d+")
+ ADD 0(PSP), 4(PSP) ; add contents of work- and scratchregister, result is in workregister
+ ADDC 2(PSP),TOS ; add content of TOS to the 3rd item, result is in TOS
+ ADD #4,PSP ; adjust parameterstackpointer, i.e. nip nip
+ NEXT
+
diff --git a/amforth-6.5/msp430/words/dabs.asm b/amforth-6.5/msp430/words/dabs.asm
new file mode 100644
index 0000000..4f8259e
--- /dev/null
+++ b/amforth-6.5/msp430/words/dabs.asm
@@ -0,0 +1,4 @@
+;X DABS d1 -- +d2 absolute value dbl.prec.
+; DUP ?DNEGATE ;
+ HEADER(XT_DABS,4,"dabs",DOCOLON)
+ DW XT_DUP,XT_QDNEGATE,XT_EXIT
diff --git a/amforth-6.5/msp430/words/dnegate.asm b/amforth-6.5/msp430/words/dnegate.asm
new file mode 100644
index 0000000..00afc1c
--- /dev/null
+++ b/amforth-6.5/msp430/words/dnegate.asm
@@ -0,0 +1,5 @@
+;X DNEGATE d1 -- d2 negate double precision
+; XT_SWAP INVERT SWAP INVERT 1 M+ ;
+ HEADER(XT_DNEGATE,7,"dnegate",DOCOLON)
+ DW XT_SWAP,XT_INVERT,XT_SWAP,XT_INVERT,XT_ONE,XT_MPLUS
+ DW XT_EXIT
diff --git a/amforth-6.5/msp430/words/do-constant.asm b/amforth-6.5/msp430/words/do-constant.asm
new file mode 100644
index 0000000..d700349
--- /dev/null
+++ b/amforth-6.5/msp430/words/do-constant.asm
@@ -0,0 +1,10 @@
+; DOCREATE's action is for a table in RAM.
+; DOROM is the code action for a table in ROM;
+; it returns the address of the parameter field.
+
+DOROM: ; -- a-addr ; Table in ROM: get PFA into TOS
+PFA_DOCONSTANT:
+ SUB #2,PSP
+ MOV TOS,0(PSP)
+ MOV W,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/do-defer.asm b/amforth-6.5/msp430/words/do-defer.asm
new file mode 100644
index 0000000..46e3e74
--- /dev/null
+++ b/amforth-6.5/msp430/words/do-defer.asm
@@ -0,0 +1,16 @@
+; : (defer) <builds does> dup @i swap i-cell+ @i execute execute ;
+HEADER(XT_DODEFER,7,"(defer)",DOCOLON)
+ .dw XT_DOCREATE
+ .dw XT_REVEAL
+ .dw XT_COMPILE
+ .dw DODEFER
+ .dw XT_EXIT
+
+DODEFER:
+ .dw 04030h, dodoes ; that compiles DOES>
+ .dw XT_DUP
+ .dw XT_ICELLPLUS
+ .dw XT_FETCHI
+ .dw XT_EXECUTE
+ .dw XT_EXECUTE
+ .dw XT_EXIT
diff --git a/amforth-6.5/msp430/words/do-do.asm b/amforth-6.5/msp430/words/do-do.asm
new file mode 100644
index 0000000..cdb0a81
--- /dev/null
+++ b/amforth-6.5/msp430/words/do-do.asm
@@ -0,0 +1,25 @@
+;Z (do) n1|u1 n2|u2 -- R: -- sys1 sys2
+;Z run-time code for DO
+; '83 and ANSI standard loops terminate when the boundary of
+; limit-1 and limit is crossed, in either direction. This can
+; be conveniently implemented by making the limit 8000h, so that
+; arithmetic overflow logic can detect crossing. I learned this
+; trick from Laxen & Perry F83.
+; fudge factor = 8000h-limit, to be added to the start value.
+; ; CODEHEADER(xdo,4,"(do)")
+; DW link
+; DB 0FFh ; not immediate
+;.set link = $
+; DB 4,"(do)"
+; .align 16
+XT_DODO:
+xdo: DW $+2
+ SUB #4,RSP ; push old loop values on return stack
+ MOV LIMIT,2(RSP)
+ MOV INDEX,0(RSP)
+ MOV #8000h,LIMIT ; compute 8000h-limit "fudge factor"
+ SUB @PSP+,LIMIT
+ MOV TOS,INDEX ; loop ctr = index+fudge
+ ADD LIMIT,INDEX
+ MOV @PSP+,TOS ; pop new TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/do-does.asm b/amforth-6.5/msp430/words/do-does.asm
new file mode 100644
index 0000000..ebf1dcf
--- /dev/null
+++ b/amforth-6.5/msp430/words/do-does.asm
@@ -0,0 +1,28 @@
+; DODOES is the code action of a DOES> clause. For ITC Forth:
+; defined word: CFA: doescode
+; PFA: parameter field
+;
+; doescode: MOV #DODOES,PC ; 16-bit direct jump, in two cells
+; high-level thread
+;
+; Note that we use JMP DODOES instead of CALL #DODOES because we can
+; efficiently obtain the thread address. DODOES is entered with W=PFA.
+; It enters the high-level thread with the address of the parameter
+; field on top of stack.
+
+dodoes: ; -- a-addr ; 3 for MOV #DODOES,PC
+ SUB #2,PSP ; 1 make room on stack
+ MOV TOS,0(PSP) ; 4
+ MOV W,TOS ; 1 put defined word's PFA in TOS
+ PUSH IP ; 3 save old IP on return stack
+ MOV -2(W),IP ; 3 fetch adrs of doescode from defined word
+ ADD #4,IP ; 1 skip MOV instruction to get thread adrs
+ NEXT ; 4
+
+; OPTION 1 ; OPTION 2
+; MOV #DODOES,PC 3 ; CALL #DODOES 5
+; ... ; ...
+; PUSH IP 3 ; POP W 2
+; MOVE -2(W),IP 3 ; PUSH IP 3
+; ADD #4,IP 1 ; MOV W,IP 1
+
diff --git a/amforth-6.5/msp430/words/do-loop.asm b/amforth-6.5/msp430/words/do-loop.asm
new file mode 100644
index 0000000..b1a3628
--- /dev/null
+++ b/amforth-6.5/msp430/words/do-loop.asm
@@ -0,0 +1,20 @@
+;Z (loop) R: sys1 sys2 -- | sys1 sys2
+;Z run-time code for LOOP
+; Add 1 to the loop index. If loop terminates, clean up the
+; return stack and skip the branch. Else take the inline branch.
+; Note that LOOP terminates when index=8000h.
+; ; CODEHEADER(xloop,6,"(loop)")
+; DW link
+; DB 0FFh ; not immediate
+;.set link = $
+; DB 6,"(loop)"
+; .align 16
+XT_DOLOOP:
+ DW $+2
+ ADD #1,INDEX
+ BIT #100h,SR ; is overflow bit set?
+ JZ dobran ; no overflow = loop
+ ADD #2,IP ; overflow = loop done, skip branch ofs
+ MOV @RSP+,INDEX ; restore old loop values
+ MOV @RSP+,LIMIT
+ NEXT
diff --git a/amforth-6.5/msp430/words/do-plusloop.asm b/amforth-6.5/msp430/words/do-plusloop.asm
new file mode 100644
index 0000000..ae41980
--- /dev/null
+++ b/amforth-6.5/msp430/words/do-plusloop.asm
@@ -0,0 +1,20 @@
+;Z (+loop) n -- R: sys1 sys2 -- | sys1 sys2
+;Z run-time code for +LOOP
+; Add n to the loop index. If loop terminates, clean up the
+; return stack and skip the branch. Else take the inline branch.
+; ; CODEHEADER(xplusloop,7,"(+loop)")
+; DW link
+; DB 0FFh ; not immediate
+;.set link = $
+; DB 7,"(+loop)"
+; .align 16
+XT_DOPLUSLOOP:
+ DW $+2
+ ADD TOS,INDEX
+ MOV @PSP+,TOS ; get new TOS, doesn't change flags
+ BIT #100h,SR ; is overflow bit set?
+ JZ dobran ; no overflow = loop
+ ADD #2,IP ; overflow = loop done, skip branch ofs
+ MOV @RSP+,INDEX ; restore old loop values
+ MOV @RSP+,LIMIT
+ NEXT
diff --git a/amforth-6.5/msp430/words/do-squote.asm b/amforth-6.5/msp430/words/do-squote.asm
new file mode 100644
index 0000000..3e4e210
--- /dev/null
+++ b/amforth-6.5/msp430/words/do-squote.asm
@@ -0,0 +1,15 @@
+;Z (IS") -- c-addr u run-time code for S"
+; R> ICOUNT 2DUP + ALIGNED >R ;
+; Harvard model, for string stored in Code space
+; e.g. as used by ."
+ ; HEADER(XISQUOTE,5,"(IS\")",DOCOLON)
+ DW link
+ DB 0FFh ; not immediate
+.set link = $
+ DB 4,"(s",'"',')'
+ .align 16
+XT_DOSLITERAL:
+ DW DOCOLON
+
+ DW XT_R_FROM,XT_ICOUNT,XT_2DUP,XT_PLUS,XT_ALIGNED,XT_TO_R
+ DW XT_EXIT
diff --git a/amforth-6.5/msp430/words/do-value.asm b/amforth-6.5/msp430/words/do-value.asm
new file mode 100644
index 0000000..4910ba5
--- /dev/null
+++ b/amforth-6.5/msp430/words/do-value.asm
@@ -0,0 +1,15 @@
+; : (value) <builds does> dup @i swap i-cell+ @i execute ;
+HEADER(XT_DOVALUE,7,"(value)",DOCOLON)
+ .dw XT_DOCREATE
+ .dw XT_REVEAL
+ .dw XT_COMPILE
+ .dw DOVALUE
+ .dw XT_EXIT
+
+DOVALUE:
+ .dw 04030h, dodoes ; that compiles DOES>
+ .dw XT_DUP
+ .dw XT_ICELLPLUS
+ .dw XT_FETCHI
+ .dw XT_EXECUTE
+ .dw XT_EXIT
diff --git a/amforth-6.5/msp430/words/do-variable.asm b/amforth-6.5/msp430/words/do-variable.asm
new file mode 100644
index 0000000..2198c4b
--- /dev/null
+++ b/amforth-6.5/msp430/words/do-variable.asm
@@ -0,0 +1,11 @@
+; DOCON, code action of CONSTANT,
+; entered with W=Parameter Field Adrs
+; This is also the action of VARIABLE (Harvard model)
+; This is also the action of CREATE (Harvard model)
+docreate: ; -- a-addr ; ROMable CREATE fetches address from PFA
+DOCON: ; -- x ; CONSTANT fetches cell from PFA to TOS
+PFA_DOVARIABLE:
+ SUB #2,PSP ; make room on stack
+ MOV TOS,0(PSP)
+ MOV @W,TOS ; fetch from parameter field to TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/does.asm b/amforth-6.5/msp430/words/does.asm
new file mode 100644
index 0000000..235fae7
--- /dev/null
+++ b/amforth-6.5/msp430/words/does.asm
@@ -0,0 +1,20 @@
+;C DOES> -- change action of latest def'n
+; COMPILE (DOES>)
+; dodoes ,JMP ; IMMEDIATE
+; Note that MSP430 uses a JMP, not a CALL, to DODOES.
+ IMMED(XT_DOES,5,"does>",DOCOLON)
+ DW XT_COMPILE,XT_DODOES
+ DW XT_COMPILE,4030h ; compile a machine jump instruction
+ DW XT_COMPILE,dodoes
+ DW XT_EXIT
+
+; runtime part of does>
+ HEADLESS(XT_DODOES,DOCOLON)
+ DW XT_R_FROM
+ DW XT_NEWEST
+ DW XT_CELLPLUS
+ DW XT_FETCH
+ DW XT_FETCH
+ DW XT_NFA2CFA
+ DW XT_STOREI
+ DW XT_EXIT
diff --git a/amforth-6.5/msp430/words/dp.asm b/amforth-6.5/msp430/words/dp.asm
new file mode 100644
index 0000000..4f8a772
--- /dev/null
+++ b/amforth-6.5/msp430/words/dp.asm
@@ -0,0 +1,4 @@
+;Z dp -- a-addr holds dictionary ptr
+; 8 USER DP
+ VARIABLE(XT_DP,2,"dp")
+ DW CFG_DP
diff --git a/amforth-6.5/msp430/words/drop.asm b/amforth-6.5/msp430/words/drop.asm
new file mode 100644
index 0000000..b21df02
--- /dev/null
+++ b/amforth-6.5/msp430/words/drop.asm
@@ -0,0 +1,4 @@
+;C DROP x -- drop top of stack
+ CODEHEADER(XT_DROP,4,"drop")
+ MOV @PSP+,TOS ; 2
+ NEXT ; 4
diff --git a/amforth-6.5/msp430/words/dup.asm b/amforth-6.5/msp430/words/dup.asm
new file mode 100644
index 0000000..4c4dbde
--- /dev/null
+++ b/amforth-6.5/msp430/words/dup.asm
@@ -0,0 +1,5 @@
+;C DUP x -- x x duplicate top of stack
+ CODEHEADER(XT_DUP,3,"dup")
+PUSHTOS: SUB #2,PSP ; 1 push old TOS..
+ MOV TOS,0(PSP) ; 4 ..onto stack
+ NEXT ; 4
diff --git a/amforth-6.5/msp430/words/end-code.asm b/amforth-6.5/msp430/words/end-code.asm
new file mode 100644
index 0000000..e2b4580
--- /dev/null
+++ b/amforth-6.5/msp430/words/end-code.asm
@@ -0,0 +1,5 @@
+;U END-CODE -- mark end of code section
+; ;
+ HEADER(XT_ENDCODE,8,"end-code",DOCOLON)
+ DW XT_COMPILE,4536h,XT_COMPILE,4630h
+ DW XT_EXIT
diff --git a/amforth-6.5/msp430/words/environment.asm b/amforth-6.5/msp430/words/environment.asm
new file mode 100644
index 0000000..0fc7e9e
--- /dev/null
+++ b/amforth-6.5/msp430/words/environment.asm
@@ -0,0 +1,4 @@
+;Z environment -- a-addr Wordlist-ID of the environment
+; 14 USER ENVIRONMENT
+ VARIABLE(XT_ENVIRONMENT,11,"environment")
+ DW CFG_ENVWID
diff --git a/amforth-6.5/msp430/words/equal.asm b/amforth-6.5/msp430/words/equal.asm
new file mode 100644
index 0000000..169078c
--- /dev/null
+++ b/amforth-6.5/msp430/words/equal.asm
@@ -0,0 +1,7 @@
+;C = x1 x2 -- flag test x1=x2
+ CODEHEADER(XT_EQUAL,1,"=")
+ MOV @PSP+,W
+ SUB TOS,W ; x1-x2 in W, flags set
+ JZ TOSTRUE
+TOSFALSE: MOV #0,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/execute.asm b/amforth-6.5/msp430/words/execute.asm
new file mode 100644
index 0000000..a8139c0
--- /dev/null
+++ b/amforth-6.5/msp430/words/execute.asm
@@ -0,0 +1,7 @@
+;C EXECUTE i*x xt -- j*x execute Forth word
+;C at 'xt'
+ CODEHEADER(XT_EXECUTE,7,"execute")
+ MOV TOS,W ; 1 put word address into W
+ MOV @PSP+,TOS ; 2 fetch new TOS
+ MOV @W+,PC ; 2 fetch code address into PC, W=PFA
+
diff --git a/amforth-6.5/msp430/words/exit.asm b/amforth-6.5/msp430/words/exit.asm
new file mode 100644
index 0000000..2a8185a
--- /dev/null
+++ b/amforth-6.5/msp430/words/exit.asm
@@ -0,0 +1,4 @@
+;C EXIT -- exit a colon definition
+ CODEHEADER(XT_EXIT,4,"exit")
+ MOV @RSP+,IP ; 2 pop old IP from return stack
+ NEXT ; 4
diff --git a/amforth-6.5/msp430/words/fetch.asm b/amforth-6.5/msp430/words/fetch.asm
new file mode 100644
index 0000000..1dbeffa
--- /dev/null
+++ b/amforth-6.5/msp430/words/fetch.asm
@@ -0,0 +1,4 @@
+;C @ a-addr -- x fetch cell from memory
+ CODEHEADER(XT_FETCH,1,"@")
+ MOV @TOS,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/fill.asm b/amforth-6.5/msp430/words/fill.asm
new file mode 100644
index 0000000..66e7740
--- /dev/null
+++ b/amforth-6.5/msp430/words/fill.asm
@@ -0,0 +1,12 @@
+;C FILL c-addr u char -- fill memory with char
+ CODEHEADER(XT_FILL,4,"fill")
+ MOV @PSP+,X ; count
+ MOV @PSP+,W ; address
+ CMP #0,X
+ JZ FILL_X
+FILL_1: MOV.B TOS,0(W) ; store char in memory
+ ADD #1,W
+ SUB #1,X
+ JNZ FILL_1
+FILL_X: MOV @PSP+,TOS ; pop new TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/fm-mod.asm b/amforth-6.5/msp430/words/fm-mod.asm
new file mode 100644
index 0000000..4460e8d
--- /dev/null
+++ b/amforth-6.5/msp430/words/fm-mod.asm
@@ -0,0 +1,12 @@
+;C d1 n1 -- n2 n3 floored signed div'n
+; courtesy of Ed Smeda
+ HEADER(FMSLASHMOD,6,"fm/mod",DOCOLON)
+ DW XT_DUP,XT_TO_R,XT_2DUP,XT_XOR,XT_TO_R,XT_TO_R
+ DW XT_DABS,XT_R_FETCH,XT_ABS,XT_UMSLASHMOD
+ DW XT_SWAP,XT_R_FROM,XT_QNEGATE,XT_SWAP,XT_R_FROM,XT_ZEROLESS,XT_DOCONDBRANCH
+ DEST(FMMOD1)
+ DW XT_NEGATE,XT_OVER,XT_DOCONDBRANCH
+ DEST(FMMOD2)
+ DW XT_R_FETCH,XT_ROT,XT_MINUS,XT_SWAP,XT_1MINUS
+FMMOD2:
+FMMOD1: DW XT_R_FROM,XT_DROP,XT_EXIT
diff --git a/amforth-6.5/msp430/words/forth-recognizer.asm b/amforth-6.5/msp430/words/forth-recognizer.asm
new file mode 100644
index 0000000..95340d4
--- /dev/null
+++ b/amforth-6.5/msp430/words/forth-recognizer.asm
@@ -0,0 +1,8 @@
+;Z dp -- a-addr holds dictionary ptr
+; 8 USER DP
+ HEADER(XT_FORTHRECOGNIZER,16,"forth-recognizer",DOVALUE)
+
+ DW CFG_FORTHRECOGNIZER
+ DW XT_RDEFERFETCH
+ DW XT_RDEFERSTORE
+
diff --git a/amforth-6.5/msp430/words/forth-wordlist.asm b/amforth-6.5/msp430/words/forth-wordlist.asm
new file mode 100644
index 0000000..2a29512
--- /dev/null
+++ b/amforth-6.5/msp430/words/forth-wordlist.asm
@@ -0,0 +1,4 @@
+;Z dp -- a-addr holds dictionary ptr
+; 8 USER DP
+ VARIABLE(XT_FORTHWID,14,"forth-wordlist")
+ DW CFG_FORTHWID
diff --git a/amforth-6.5/msp430/words/g-mark.asm b/amforth-6.5/msp430/words/g-mark.asm
new file mode 100644
index 0000000..2249961
--- /dev/null
+++ b/amforth-6.5/msp430/words/g-mark.asm
@@ -0,0 +1,3 @@
+ HEADLESS(XT_GMARK,DOCOLON)
+ DW XT_IHERE,XT_COMPILE,-1
+ DW XT_EXIT
diff --git a/amforth-6.5/msp430/words/g-resolve.asm b/amforth-6.5/msp430/words/g-resolve.asm
new file mode 100644
index 0000000..be39263
--- /dev/null
+++ b/amforth-6.5/msp430/words/g-resolve.asm
@@ -0,0 +1,5 @@
+
+HEADLESS(XT_GRESOLVE,DOCOLON)
+ DW XT_QSTACK
+ DW XT_IHERE,XT_OVER,XT_MINUS,XT_SWAP,XT_STOREI
+ DW XT_EXIT
diff --git a/amforth-6.5/msp430/words/get-current.asm b/amforth-6.5/msp430/words/get-current.asm
new file mode 100644
index 0000000..08abcd0
--- /dev/null
+++ b/amforth-6.5/msp430/words/get-current.asm
@@ -0,0 +1,2 @@
+ HEADER(XT_GET_CURRENT,11,"get-current",DOCOLON)
+ DW XT_DOLITERAL,CFG_CURRENT,XT_FETCH,XT_EXIT
diff --git a/amforth-6.5/msp430/words/greater.asm b/amforth-6.5/msp430/words/greater.asm
new file mode 100644
index 0000000..30979ab
--- /dev/null
+++ b/amforth-6.5/msp430/words/greater.asm
@@ -0,0 +1,3 @@
+;C > n1 n2 -- flag test n1>n2, signed
+ HEADER(XT_GREATER,1,">",DOCOLON)
+ DW XT_SWAP,XT_LESS,XT_EXIT
diff --git a/amforth-6.5/msp430/words/header.asm b/amforth-6.5/msp430/words/header.asm
new file mode 100644
index 0000000..e1b0781
--- /dev/null
+++ b/amforth-6.5/msp430/words/header.asm
@@ -0,0 +1,14 @@
+;Z HEADER ( addr len wid -- nt ) create a Forth word header
+; Separate headers model.
+ HEADER(XT_HEADER,6,"header",DOCOLON)
+ DW XT_FETCH
+ DW XT_COMMA ; link
+ DW XT_DOLITERAL,0FFh,XT_CCOMMA ; immediate flag - see note below
+ DW XT_IHERE,XT_TO_R
+ DW XT_SCOMMA
+ DW XT_R_FROM
+ DW XT_EXIT ; MSP430: headers in I space must be aligned
+; Note for Flashable MSP430: when compiling to RAM, we need to set
+; the immediate byte to 0FFH. When compiling to Flash, the word IC!
+; will not write 0FFH to erased Flash (because the byte is already 0FFH).
+; Thus we can write this byte at a later time (with IMMEDIATE).
diff --git a/amforth-6.5/msp430/words/here.asm b/amforth-6.5/msp430/words/here.asm
new file mode 100644
index 0000000..f86cc76
--- /dev/null
+++ b/amforth-6.5/msp430/words/here.asm
@@ -0,0 +1,4 @@
+;C HERE -- addr returns dictionary ptr
+; DP @ ;
+ HEADER(XT_HERE,4,"here",DOCOLON)
+ DW XT_DP,XT_FETCH,XT_EXIT
diff --git a/amforth-6.5/msp430/words/hld.asm b/amforth-6.5/msp430/words/hld.asm
new file mode 100644
index 0000000..ea6d852
--- /dev/null
+++ b/amforth-6.5/msp430/words/hld.asm
@@ -0,0 +1,4 @@
+;Z hp -- a-addr HOLD pointer
+; 16 USER HLD
+ VARIABLE(XT_HLD,3,"hld")
+ DW RAM_HLD
diff --git a/amforth-6.5/msp430/words/i-allot.asm b/amforth-6.5/msp430/words/i-allot.asm
new file mode 100644
index 0000000..5a74bad
--- /dev/null
+++ b/amforth-6.5/msp430/words/i-allot.asm
@@ -0,0 +1,4 @@
+;C IALLOT n -- allocate n bytes in Code dict
+; IDP +! ;
+ HEADER(XT_IALLOT,6,"iallot",DOCOLON)
+ DW IDP,XT_PLUSSTORE,XT_EXIT
diff --git a/amforth-6.5/msp430/words/i-cellplus.asm b/amforth-6.5/msp430/words/i-cellplus.asm
new file mode 100644
index 0000000..6c472f9
--- /dev/null
+++ b/amforth-6.5/msp430/words/i-cellplus.asm
@@ -0,0 +1,4 @@
+
+HEADER(XT_ICELLPLUS,7,"i-cell+",DOCOLON)
+ .DW XT_CELLPLUS
+ .dw XT_EXIT
diff --git a/amforth-6.5/msp430/words/i-fetch.asm b/amforth-6.5/msp430/words/i-fetch.asm
new file mode 100644
index 0000000..bd0004e
--- /dev/null
+++ b/amforth-6.5/msp430/words/i-fetch.asm
@@ -0,0 +1,2 @@
+;Z I@ a-addr -- x fetch cell from Instruction memory
+ HEADER(XT_FETCHI,2,"@i",XT_FETCH+2)
diff --git a/amforth-6.5/msp430/words/i-here.asm b/amforth-6.5/msp430/words/i-here.asm
new file mode 100644
index 0000000..7bcac83
--- /dev/null
+++ b/amforth-6.5/msp430/words/i-here.asm
@@ -0,0 +1,4 @@
+;C XT_IHERE -- addr returns Code dictionary ptr
+; IDP @ ;
+ HEADER(XT_IHERE,5,"ihere",DOCOLON)
+ DW IDP,XT_FETCH,XT_EXIT
diff --git a/amforth-6.5/msp430/words/i.asm b/amforth-6.5/msp430/words/i.asm
new file mode 100644
index 0000000..bd6b4eb
--- /dev/null
+++ b/amforth-6.5/msp430/words/i.asm
@@ -0,0 +1,8 @@
+;C I -- n R: sys1 sys2 -- sys1 sys2
+;C get the innermost loop index
+ CODEHEADER(XT_I,1,"i")
+ SUB #2,PSP ; make room in TOS
+ MOV TOS,0(PSP)
+ MOV INDEX,TOS ; index = loopctr - fudge
+ SUB LIMIT,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/ic-fetch.asm b/amforth-6.5/msp430/words/ic-fetch.asm
new file mode 100644
index 0000000..c026c0e
--- /dev/null
+++ b/amforth-6.5/msp430/words/ic-fetch.asm
@@ -0,0 +1,2 @@
+;Z IC@ a-addr -- x fetch char from Instruction memory
+ HEADER(XT_CFETCHI,3,"c@i",XT_CFETCH+2)
diff --git a/amforth-6.5/msp430/words/icount.asm b/amforth-6.5/msp430/words/icount.asm
new file mode 100644
index 0000000..d2a8ae2
--- /dev/null
+++ b/amforth-6.5/msp430/words/icount.asm
@@ -0,0 +1,3 @@
+;C COUNT c-addr1 -- c-addr2 u counted->adr/len
+ HEADER(XT_ICOUNT,6,"icount",DOCOLON)
+ DW XT_DUP,XT_1PLUS,XT_SWAP,XT_CFETCH,XT_EXIT
diff --git a/amforth-6.5/msp430/words/idp.asm b/amforth-6.5/msp430/words/idp.asm
new file mode 100644
index 0000000..f64c348
--- /dev/null
+++ b/amforth-6.5/msp430/words/idp.asm
@@ -0,0 +1,4 @@
+;Z IDP -- a-addr ROM dictionary pointer
+; 20 USER IDP
+ VARIABLE(IDP,3,"idp")
+ DW CFG_IDP
diff --git a/amforth-6.5/msp430/words/immediate-q.asm b/amforth-6.5/msp430/words/immediate-q.asm
new file mode 100644
index 0000000..2660efe
--- /dev/null
+++ b/amforth-6.5/msp430/words/immediate-q.asm
@@ -0,0 +1,15 @@
+; ( f -- +/-1 )
+; System
+; return +1 if immediate, -1 otherwise, flag from name>flags
+ HEADLESS(XT_IMMEDIATEQ,DOCOLON)
+ .dw XT_ONE
+ .dw XT_AND
+ .dw XT_ZEROEQUAL
+ .dw XT_DOCONDBRANCH
+ DEST(IMMEDIATEQ1)
+ .dw XT_ONE
+ .dw XT_EXIT
+IMMEDIATEQ1:
+ ; not immediate
+ .dw XT_TRUE
+ .dw XT_EXIT
diff --git a/amforth-6.5/msp430/words/immediate.asm b/amforth-6.5/msp430/words/immediate.asm
new file mode 100644
index 0000000..9be4150
--- /dev/null
+++ b/amforth-6.5/msp430/words/immediate.asm
@@ -0,0 +1,4 @@
+;C IMMEDIATE -- make last def'n immediate
+ HEADER(IMMEDIATE,9,"immediate",DOCOLON)
+ DW XT_DOLITERAL,0FEh,XT_GET_CURRENT,XT_FETCH,XT_1MINUS,XT_CSTOREI
+ DW XT_EXIT
diff --git a/amforth-6.5/msp430/words/infodp.asm b/amforth-6.5/msp430/words/infodp.asm
new file mode 100644
index 0000000..6f9faaf
--- /dev/null
+++ b/amforth-6.5/msp430/words/infodp.asm
@@ -0,0 +1,4 @@
+;Z dp -- a-addr holds dictionary ptr
+; 8 USER DP
+ VARIABLE(XT_INFODP,6,"infodp")
+ DW CFG_INFODP
diff --git a/amforth-6.5/msp430/words/int-fetch.asm b/amforth-6.5/msp430/words/int-fetch.asm
new file mode 100644
index 0000000..793cf25
--- /dev/null
+++ b/amforth-6.5/msp430/words/int-fetch.asm
@@ -0,0 +1,4 @@
+ CODEHEADER(XT_INT_FETCH,4,"int@")
+ ADD TOS,TOS
+ MOV CFG_ISRVECS(TOS),TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/int-off.asm b/amforth-6.5/msp430/words/int-off.asm
new file mode 100644
index 0000000..71f1d25
--- /dev/null
+++ b/amforth-6.5/msp430/words/int-off.asm
@@ -0,0 +1,3 @@
+ CODEHEADER(XT_INT_OFF,4,"-int")
+ DINT
+ NEXT
diff --git a/amforth-6.5/msp430/words/int-on.asm b/amforth-6.5/msp430/words/int-on.asm
new file mode 100644
index 0000000..64b303c
--- /dev/null
+++ b/amforth-6.5/msp430/words/int-on.asm
@@ -0,0 +1,3 @@
+ CODEHEADER(XT_INT_ON,4,"+int")
+ EINT
+ NEXT
diff --git a/amforth-6.5/msp430/words/int-store.asm b/amforth-6.5/msp430/words/int-store.asm
new file mode 100644
index 0000000..cdb9896
--- /dev/null
+++ b/amforth-6.5/msp430/words/int-store.asm
@@ -0,0 +1,5 @@
+ CODEHEADER(XT_INT_STORE,4,"int!")
+ ADD TOS,TOS
+ MOV @PSP+,CFG_ISRVECS(TOS)
+ MOV @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/int-trap.asm b/amforth-6.5/msp430/words/int-trap.asm
new file mode 100644
index 0000000..13a2f6d
--- /dev/null
+++ b/amforth-6.5/msp430/words/int-trap.asm
@@ -0,0 +1,4 @@
+ CODEHEADER(XT_TRAP,8,"int-trap")
+ MOV TOS,ISR
+ MOV @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/invert.asm b/amforth-6.5/msp430/words/invert.asm
new file mode 100644
index 0000000..7108b3c
--- /dev/null
+++ b/amforth-6.5/msp430/words/invert.asm
@@ -0,0 +1,4 @@
+;C INVERT x1 -- x2 bitwise inversion
+ CODEHEADER(XT_INVERT,6,"invert")
+ XOR #-1,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/isr-exec.asm b/amforth-6.5/msp430/words/isr-exec.asm
new file mode 100644
index 0000000..de67130
--- /dev/null
+++ b/amforth-6.5/msp430/words/isr-exec.asm
@@ -0,0 +1,7 @@
+; ( n -- )
+; Interrupt
+; executes an interrupt service routine
+ HEADLESS(XT_ISREXEC,DOCOLON)
+ .dw XT_INT_FETCH
+ .dw XT_EXECUTE
+ .dw XT_EXIT
diff --git a/amforth-6.5/msp430/words/itype.asm b/amforth-6.5/msp430/words/itype.asm
new file mode 100644
index 0000000..68a032e
--- /dev/null
+++ b/amforth-6.5/msp430/words/itype.asm
@@ -0,0 +1,6 @@
+;Z ITYPE c-addr +n -- type line to term'l
+; ?DUP IF from Code space
+; OVER + XT_SWAP DO I IC@ EMIT LOOP
+; ELSE DROP THEN ;
+ HEADER(XT_ITYPE,5,"itype",DOCOLON)
+ DW XT_TYPE,XT_EXIT
diff --git a/amforth-6.5/msp430/words/j.asm b/amforth-6.5/msp430/words/j.asm
new file mode 100644
index 0000000..74e9d58
--- /dev/null
+++ b/amforth-6.5/msp430/words/j.asm
@@ -0,0 +1,9 @@
+
+;C J -- n R: 4*sys -- 4*sys
+;C get the second loop index
+ CODEHEADER(XT_J,1,"j")
+ SUB #2,PSP ; make room in TOS
+ MOV TOS,0(PSP)
+ MOV @RSP,TOS ; index = loopctr - fudge
+ SUB 2(RSP),TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/l-0.asm b/amforth-6.5/msp430/words/l-0.asm
new file mode 100644
index 0000000..a35ef18
--- /dev/null
+++ b/amforth-6.5/msp430/words/l-0.asm
@@ -0,0 +1,3 @@
+;Z l0 -- a-addr bottom of Leave stack
+ VARIABLE(XT_LP0,3,"lp0")
+ DW LSTACK
diff --git a/amforth-6.5/msp430/words/l-mark.asm b/amforth-6.5/msp430/words/l-mark.asm
new file mode 100644
index 0000000..af253cd
--- /dev/null
+++ b/amforth-6.5/msp430/words/l-mark.asm
@@ -0,0 +1,2 @@
+ HEADLESS(XT_LMARK,DOCOLON)
+ DW XT_IHERE,XT_EXIT
diff --git a/amforth-6.5/msp430/words/l-resolve.asm b/amforth-6.5/msp430/words/l-resolve.asm
new file mode 100644
index 0000000..ec912cd
--- /dev/null
+++ b/amforth-6.5/msp430/words/l-resolve.asm
@@ -0,0 +1,4 @@
+ HEADLESS(XT_LRESOLVE,DOCOLON)
+ DW XT_QSTACK
+ DW XT_IHERE,XT_MINUS,XT_COMMA
+ DW XT_EXIT
diff --git a/amforth-6.5/msp430/words/latest.asm b/amforth-6.5/msp430/words/latest.asm
new file mode 100644
index 0000000..029b9fc
--- /dev/null
+++ b/amforth-6.5/msp430/words/latest.asm
@@ -0,0 +1,3 @@
+;Z NEWEST -- a-addr temporary CURRENT storage
+VARIABLE(XT_LATEST,6,"latest")
+ DW RAM_LATEST
diff --git a/amforth-6.5/msp430/words/less.asm b/amforth-6.5/msp430/words/less.asm
new file mode 100644
index 0000000..57b8705
--- /dev/null
+++ b/amforth-6.5/msp430/words/less.asm
@@ -0,0 +1,7 @@
+;C < n1 n2 -- flag test n1<n2, signed
+ CODEHEADER(XT_LESS,1,"<")
+ MOV @PSP+,W
+ SUB TOS,W ; x1-x2 in W, flags set
+ JGE TOSFALSE
+TOSTRUE: MOV #-1,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/lit.asm b/amforth-6.5/msp430/words/lit.asm
new file mode 100644
index 0000000..a186a4f
--- /dev/null
+++ b/amforth-6.5/msp430/words/lit.asm
@@ -0,0 +1,8 @@
+;Z lit -- x fetch inline literal to stack
+; This is the primtive compiled by LITERAL.
+ HEADLESS(XT_DOLITERAL,PFA_DOLITERAL)
+PFA_DOLITERAL:
+ SUB #2,PSP ; 1 push old TOS..
+ MOV TOS,0(PSP) ; 4 ..onto stack
+ MOV @IP+,TOS ; 2 fetch new TOS value
+ NEXT ; 4
diff --git a/amforth-6.5/msp430/words/lp.asm b/amforth-6.5/msp430/words/lp.asm
new file mode 100644
index 0000000..d59dc88
--- /dev/null
+++ b/amforth-6.5/msp430/words/lp.asm
@@ -0,0 +1,4 @@
+;Z lp -- a-addr LEAVE-stack pointer
+; 18 USER LP
+ VARIABLE(XT_LP,2,"lp")
+ DW RAM_LP
diff --git a/amforth-6.5/msp430/words/lshift.asm b/amforth-6.5/msp430/words/lshift.asm
new file mode 100644
index 0000000..810d680
--- /dev/null
+++ b/amforth-6.5/msp430/words/lshift.asm
@@ -0,0 +1,10 @@
+;C LSHIFT x1 u -- x2 logical L shift u places
+ CODEHEADER(LSHIFT,6,"lshift")
+ MOV @PSP+,W
+ AND #1Fh,TOS ; no need to shift more than 16
+ JZ LSH_X
+LSH_1: ADD W,W
+ SUB #1,TOS
+ JNZ LSH_1
+LSH_X: MOV W,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/m-plus.asm b/amforth-6.5/msp430/words/m-plus.asm
new file mode 100644
index 0000000..633e2f8
--- /dev/null
+++ b/amforth-6.5/msp430/words/m-plus.asm
@@ -0,0 +1,6 @@
+;X M+ d n -- d add single to double
+ CODEHEADER(XT_MPLUS,2,"m+")
+ ADD TOS,2(PSP)
+ ADDC #0,0(PSP)
+ MOV @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/m-star.asm b/amforth-6.5/msp430/words/m-star.asm
new file mode 100644
index 0000000..f1e2b44
--- /dev/null
+++ b/amforth-6.5/msp430/words/m-star.asm
@@ -0,0 +1,8 @@
+;C M* n1 n2 -- d signed 16*16->32 multiply
+; 2DUP XOR >R carries sign of the result
+; XT_SWAP ABS SWAP ABS UM*
+; R> ?DNEGATE ;
+ HEADER(XT_MSTAR,2,"m*",DOCOLON)
+ DW XT_2DUP,XT_XOR,XT_TO_R
+ DW XT_SWAP,XT_ABS,XT_SWAP,XT_ABS,XT_UMSTAR
+ DW XT_R_FROM,XT_QDNEGATE,XT_EXIT
diff --git a/amforth-6.5/msp430/words/mcu-sr-fetch.asm b/amforth-6.5/msp430/words/mcu-sr-fetch.asm
new file mode 100644
index 0000000..98ab000
--- /dev/null
+++ b/amforth-6.5/msp430/words/mcu-sr-fetch.asm
@@ -0,0 +1,5 @@
+ CODEHEADER(XT_MCU_SR_FETCH,3,"sr@")
+ sub #2, PSP
+ mov TOS, 0(PSP)
+ mov r2, TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/minus.asm b/amforth-6.5/msp430/words/minus.asm
new file mode 100644
index 0000000..cd49f24
--- /dev/null
+++ b/amforth-6.5/msp430/words/minus.asm
@@ -0,0 +1,6 @@
+;C - n1/u1 n2/u2 -- n3/u3 subtract n1-n2
+ CODEHEADER(XT_MINUS,1,"-")
+ MOV @PSP+,W
+ SUB TOS,W
+ MOV W,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/n_r_from.asm b/amforth-6.5/msp430/words/n_r_from.asm
new file mode 100644
index 0000000..5ac6ab1
--- /dev/null
+++ b/amforth-6.5/msp430/words/n_r_from.asm
@@ -0,0 +1,17 @@
+; ( -- x-n .. x-1 n ) (R: x-n .. x-1 n -- )
+; Stack
+; move n items from return stack to data stack
+ CODEHEADER(XT_N_R_FROM,3,"nr>")
+
+ SUB #2,PSP ; 2
+ MOV TOS,0(PSP) ; 4
+ MOV @RSP+,X
+ MOV X, Y
+PFA_N_R_FROM1:
+ MOV @RSP+,TOS
+ SUB #2,PSP ; 2
+ MOV TOS,0(PSP) ; 4
+ SUB #1, X
+ jnz PFA_N_R_FROM1
+ MOV Y, TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/n_to_r.asm b/amforth-6.5/msp430/words/n_to_r.asm
new file mode 100644
index 0000000..91807e5
--- /dev/null
+++ b/amforth-6.5/msp430/words/n_to_r.asm
@@ -0,0 +1,15 @@
+; ( x-n .. x-1 n -- ) (R: -- x-n .. x-1 n)
+; Stack
+; move n items from data stack to return stack
+ CODEHEADER(XT_N_TO_R,3,"n>r")
+
+ MOV TOS, X ; save count cell twice
+ MOV TOS, Y
+PFA_N_TO_R1:
+ MOV @PSP+,TOS
+ PUSH TOS
+ SUB #1, X
+ JNZ PFA_N_TO_R1
+ PUSH Y ; old TOS (count)
+ MOV @PSP+,TOS ; get new TOS
+ NEXT \ No newline at end of file
diff --git a/amforth-6.5/msp430/words/name2flags.asm b/amforth-6.5/msp430/words/name2flags.asm
new file mode 100644
index 0000000..9af91be
--- /dev/null
+++ b/amforth-6.5/msp430/words/name2flags.asm
@@ -0,0 +1,3 @@
+;Z nfa -- f fetch flag information
+ HEADER(XT_NAME2FLAGS,10,"name>flags",DOCOLON)
+ DW XT_1MINUS,XT_CFETCHI,XT_EXIT
diff --git a/amforth-6.5/msp430/words/negate.asm b/amforth-6.5/msp430/words/negate.asm
new file mode 100644
index 0000000..6c2527e
--- /dev/null
+++ b/amforth-6.5/msp430/words/negate.asm
@@ -0,0 +1,5 @@
+;C NEGATE x1 -- x2 two's complement
+ CODEHEADER(XT_NEGATE,6,"negate")
+ XOR #-1,TOS
+ ADD #1,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/newest.asm b/amforth-6.5/msp430/words/newest.asm
new file mode 100644
index 0000000..bc6a956
--- /dev/null
+++ b/amforth-6.5/msp430/words/newest.asm
@@ -0,0 +1,3 @@
+;Z NEWEST -- a-addr temporary CURRENT storage
+VARIABLE(XT_NEWEST,6,"newest")
+ DW RAM_NEWEST
diff --git a/amforth-6.5/msp430/words/nfa-to-cfa.asm b/amforth-6.5/msp430/words/nfa-to-cfa.asm
new file mode 100644
index 0000000..160e22f
--- /dev/null
+++ b/amforth-6.5/msp430/words/nfa-to-cfa.asm
@@ -0,0 +1,5 @@
+;Z NFA>CFA nfa -- cfa name adr -> code field
+; HCOUNT 7F AND + ALIGNED ; mask off 'smudge' bit
+ HEADER(XT_NFA2CFA,7,"nfa>cfa",DOCOLON)
+ DW XT_ICOUNT
+ DW XT_DOLITERAL,07Fh,XT_AND,XT_PLUS,XT_ALIGNED,XT_EXIT
diff --git a/amforth-6.5/msp430/words/nfa-to-lfa.asm b/amforth-6.5/msp430/words/nfa-to-lfa.asm
new file mode 100644
index 0000000..43c0898
--- /dev/null
+++ b/amforth-6.5/msp430/words/nfa-to-lfa.asm
@@ -0,0 +1,4 @@
+;Z NFA>LFA nfa -- lfa name adr -> link field
+; 3 - ;
+ HEADER(XT_NFA2LFA,7,"nfa>lfa",DOCOLON)
+ DW XT_DOLITERAL,3,XT_MINUS,XT_EXIT
diff --git a/amforth-6.5/msp430/words/nip.asm b/amforth-6.5/msp430/words/nip.asm
new file mode 100644
index 0000000..b9f5299
--- /dev/null
+++ b/amforth-6.5/msp430/words/nip.asm
@@ -0,0 +1,4 @@
+;X NIP x1 x2 -- x2 per stack diagram
+ CODEHEADER(XT_NIP,3,"nip")
+ ADD #2,PSP ; 1
+ NEXT ; 4
diff --git a/amforth-6.5/msp430/words/or.asm b/amforth-6.5/msp430/words/or.asm
new file mode 100644
index 0000000..8bb4cc7
--- /dev/null
+++ b/amforth-6.5/msp430/words/or.asm
@@ -0,0 +1,4 @@
+;C OR x1 x2 -- x3 logical OR
+ CODEHEADER(XT_OR,2,"or")
+ BIS @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/over.asm b/amforth-6.5/msp430/words/over.asm
new file mode 100644
index 0000000..11b1770
--- /dev/null
+++ b/amforth-6.5/msp430/words/over.asm
@@ -0,0 +1,8 @@
+;C OVER x1 x2 -- x1 x2 x1 per stack diagram
+ CODEHEADER(XT_OVER,4,"over")
+ MOV @PSP,W ; 2
+ SUB #2,PSP ; 2
+ MOV TOS,0(PSP) ; 4
+ MOV W,TOS ; 1
+ NEXT ; 4
+
diff --git a/amforth-6.5/msp430/words/pause.asm b/amforth-6.5/msp430/words/pause.asm
new file mode 100644
index 0000000..89362d0
--- /dev/null
+++ b/amforth-6.5/msp430/words/pause.asm
@@ -0,0 +1,7 @@
+; ( -- )
+; Multitasking
+; Fetch pause vector and execute it. may make a context/task switch
+DEFER(XT_PAUSE,5,"pause")
+ .dw RAM_PAUSE
+ .dw XT_RDEFERFETCH
+ .dw XT_RDEFERSTORE
diff --git a/amforth-6.5/msp430/words/plus-store.asm b/amforth-6.5/msp430/words/plus-store.asm
new file mode 100644
index 0000000..970057d
--- /dev/null
+++ b/amforth-6.5/msp430/words/plus-store.asm
@@ -0,0 +1,5 @@
+;C +! n/u a-addr -- add cell to memory
+ CODEHEADER(XT_PLUSSTORE,2,"+!")
+ ADD @PSP+,0(TOS)
+ MOV @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/plus.asm b/amforth-6.5/msp430/words/plus.asm
new file mode 100644
index 0000000..cb57910
--- /dev/null
+++ b/amforth-6.5/msp430/words/plus.asm
@@ -0,0 +1,4 @@
+;C + n1/u1 n2/u2 -- n3/u3 add n1+n2
+ CODEHEADER(XT_PLUS,1,"+")
+ ADD @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/q-branch.asm b/amforth-6.5/msp430/words/q-branch.asm
new file mode 100644
index 0000000..5ec1563
--- /dev/null
+++ b/amforth-6.5/msp430/words/q-branch.asm
@@ -0,0 +1,7 @@
+;Z ?branch x -- branch if TOS zero
+ CODEHEADER(XT_DOCONDBRANCH,7,"?branch")
+ ADD #0,TOS ; 1 test TOS value
+ MOV @PSP+,TOS ; 2 pop new TOS value (doesn't change flags)
+ JZ dobran ; 2 if TOS was zero, take the branch
+ ADD #2,IP ; 1 else skip the branch destination
+ NEXT ; 4
diff --git a/amforth-6.5/msp430/words/qdup.asm b/amforth-6.5/msp430/words/qdup.asm
new file mode 100644
index 0000000..2bb9eb0
--- /dev/null
+++ b/amforth-6.5/msp430/words/qdup.asm
@@ -0,0 +1,5 @@
+;C ?DUP x -- 0 | x x DUP if nonzero
+ CODEHEADER(XT_QDUP,4,"?dup")
+ CMP #0,TOS ; 1 test for TOS nonzero
+ JNZ PUSHTOS ; 2
+NODUP: NEXT ; 4
diff --git a/amforth-6.5/msp430/words/r-0.asm b/amforth-6.5/msp430/words/r-0.asm
new file mode 100644
index 0000000..c3599ac
--- /dev/null
+++ b/amforth-6.5/msp430/words/r-0.asm
@@ -0,0 +1,3 @@
+;Z r0 -- a-addr end of return stack
+ VARIABLE(XT_RP0,3,"rp0")
+ DW RSTACK
diff --git a/amforth-6.5/msp430/words/r-fetch.asm b/amforth-6.5/msp430/words/r-fetch.asm
new file mode 100644
index 0000000..25de529
--- /dev/null
+++ b/amforth-6.5/msp430/words/r-fetch.asm
@@ -0,0 +1,6 @@
+;C R@ -- x R: x -- x fetch from rtn stk
+ CODEHEADER(XT_R_FETCH,2,"r@")
+ SUB #2,PSP
+ MOV TOS,0(PSP)
+ MOV @RSP,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/r-from.asm b/amforth-6.5/msp430/words/r-from.asm
new file mode 100644
index 0000000..b43ce9a
--- /dev/null
+++ b/amforth-6.5/msp430/words/r-from.asm
@@ -0,0 +1,6 @@
+;C R> -- x R: x -- pop from return stack
+ CODEHEADER(XT_R_FROM,2,"r>")
+ SUB #2,PSP ; 2
+ MOV TOS,0(PSP) ; 4
+ MOV @RSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/reg-a.asm b/amforth-6.5/msp430/words/reg-a.asm
new file mode 100644
index 0000000..89d3b8b
--- /dev/null
+++ b/amforth-6.5/msp430/words/reg-a.asm
@@ -0,0 +1,95 @@
+; ( -- n2 )
+; Extended VM
+; Read memory pointed to by register A (Extended VM)
+CODEHEADER(XT_AFETCH,2,"a@")
+ SUB #2,PSP
+ MOV TOS,0(PSP)
+ MOV @REG_A,TOS
+ NEXT
+
+; ( n1 -- n2 )
+; Extended VM
+; Read memory pointed to by register A plus offset (Extended VM)
+CODEHEADER(XT_NAFETCH,3,"na@")
+ ADD REG_A,TOS
+ MOV @TOS,TOS
+ NEXT
+
+; ( -- n )
+; Extended VM
+; Read memory pointed to by register A, increment A by 1 cell (Extended VM)
+CODEHEADER(XT_AFETCHPLUS,3,"a@+")
+ SUB #2,PSP
+ MOV TOS,0(PSP)
+ ADD REG_A,TOS
+ MOV @TOS,TOS
+ ADD #2,REG_A
+ NEXT
+
+; ( -- n )
+; Extended VM
+; Read memory pointed to by register A, decrement A by 1 cell (Extended VM)
+CODEHEADER(XT_AFETCHMINUS,3,"a@-")
+ SUB #2,PSP
+ MOV TOS,0(PSP)
+ ADD REG_A,TOS
+ MOV @TOS,TOS
+ SUB #2,REG_A
+ NEXT
+
+; ( n -- )
+; Extended VM
+; Write memory pointed to by register A (Extended VM)
+CODEHEADER(XT_ASTORE,2,"a!")
+ MOV TOS,@REG_A
+ MOV @PSP+,TOS
+ NEXT
+
+; ( n offs -- )
+; Extended VM
+; Write memory pointed to by register A plus offset (Extended VM)
+CODEHEADER(XT_NASTORE,3,"na!")
+ ADD REG_A, TOS
+ MOV @PSP+,X
+ MOV X,@TOS
+ MOV @PSP+,TOS
+ NEXT
+
+; ( -- n2 )
+; Extended VM
+; Write memory pointed to by register A, increment A by 1 cell (Extended VM)
+CODEHEADER(XT_ASTOREPLUS,3,"a!+")
+ MOV TOS,@REG_A
+ MOV @PSP+,TOS
+ ADD #2,REG_A
+ NEXT
+
+; ( -- n2 )
+; Extended VM
+; Write memory pointed to by register A, decrement A by 1 cell (Extended VM)
+CODEHEADER(XT_ASTOREMINUS,3,"a!-")
+ MOV TOS,@REG_A
+ MOV @PSP+,TOS
+ SUB #2,REG_A
+ NEXT
+
+; ( n -- )
+; Extended VM
+; Write to A register (Extended VM)
+CODEHEADER(XT_TO_A,2,">a")
+ MOV TOS,REG_A
+ MOV @PSP+,TOS
+ NEXT
+
+; ( n1 -- n2 )
+; Extended VM
+; read the A register (Extended VM)
+CODEHEADER(XT_A_FROM,2,"a>")
+ SUB #2,PSP
+ MOV REG_A,TOS
+ NEXT
+
+; for more information read
+; http://www.complang.tuwien.ac.at/anton/euroforth/ef08/papers/pelc.pdf
+; adapted index based access from X/Y registers
+; note: offset is byte address, not cell!
diff --git a/amforth-6.5/msp430/words/restore.asm b/amforth-6.5/msp430/words/restore.asm
new file mode 100644
index 0000000..ba3534b
--- /dev/null
+++ b/amforth-6.5/msp430/words/restore.asm
@@ -0,0 +1,7 @@
+; RESTORE copies the first 128 bytes of Info Flash to
+; the User Area and subsequent RAM.
+ HEADER(RESTORE,7,"RESTORE",DOCOLON)
+ DW XT_DOLITERAL,FLASHINFOAREA
+ DW XT_DOLITERAL,RAMINFOAREA
+ DW XT_DOLITERAL,INFO_SIZE
+ DW XT_ITOD,XT_EXIT
diff --git a/amforth-6.5/msp430/words/rot.asm b/amforth-6.5/msp430/words/rot.asm
new file mode 100644
index 0000000..fe5914b
--- /dev/null
+++ b/amforth-6.5/msp430/words/rot.asm
@@ -0,0 +1,7 @@
+;C ROT x1 x2 x3 -- x2 x3 x1 per stack diagram
+ CODEHEADER(XT_ROT,3,"rot")
+ MOV @PSP,W ; 2 fetch x2
+ MOV TOS,0(PSP) ; 4 store x3
+ MOV 2(PSP),TOS ; 3 fetch x1
+ MOV W,2(PSP) ; 4 store x2
+ NEXT ; 4
diff --git a/amforth-6.5/msp430/words/rp-fetch.asm b/amforth-6.5/msp430/words/rp-fetch.asm
new file mode 100644
index 0000000..74d723d
--- /dev/null
+++ b/amforth-6.5/msp430/words/rp-fetch.asm
@@ -0,0 +1,6 @@
+;Z RP@ -- a-addr get return stack pointer
+ CODEHEADER(XT_RP_FETCH,3,"rp@")
+ SUB #2,PSP
+ MOV TOS,0(PSP)
+ MOV RSP,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/rp-store.asm b/amforth-6.5/msp430/words/rp-store.asm
new file mode 100644
index 0000000..80fa742
--- /dev/null
+++ b/amforth-6.5/msp430/words/rp-store.asm
@@ -0,0 +1,5 @@
+;Z RP! a-addr -- set return stack pointer
+ CODEHEADER(XT_RP_STORE,3,"rp!")
+ MOV TOS,RSP
+ MOV @PSP+,TOS ; 2
+ NEXT
diff --git a/amforth-6.5/msp430/words/rshift.asm b/amforth-6.5/msp430/words/rshift.asm
new file mode 100644
index 0000000..d0201ed
--- /dev/null
+++ b/amforth-6.5/msp430/words/rshift.asm
@@ -0,0 +1,11 @@
+;C RSHIFT x1 u -- x2 logical R shift u places
+ CODEHEADER(RSHIFT,6,"rshift")
+ MOV @PSP+,W
+ AND #1Fh,TOS ; no need to shift more than 16
+ JZ RSH_X
+RSH_1: CLRC
+ RRC W
+ SUB #1,TOS
+ JNZ RSH_1
+RSH_X: MOV W,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/s-0.asm b/amforth-6.5/msp430/words/s-0.asm
new file mode 100644
index 0000000..4e0e63d
--- /dev/null
+++ b/amforth-6.5/msp430/words/s-0.asm
@@ -0,0 +1,3 @@
+;Z s0 -- a-addr end of parameter stack
+ VARIABLE(XT_SP0,3,"sp0")
+ DW PSTACK
diff --git a/amforth-6.5/msp430/words/s-equal.asm b/amforth-6.5/msp430/words/s-equal.asm
new file mode 100644
index 0000000..28e6758
--- /dev/null
+++ b/amforth-6.5/msp430/words/s-equal.asm
@@ -0,0 +1,19 @@
+;Z S= c-addr1 c-addr2 u -- n string compare
+;Z n<0: s1<s2, n=0: s1=s2, n>0: s1>s2
+ CODEHEADER(XT_SEQUAL,2,"s=")
+ MOV @PSP+,W ; adrs2
+ MOV @PSP+,X ; adrs1
+ CMP #0,TOS
+ JZ SEQU_X
+SEQU_1: CMP.B @W+,0(X) ; compare char1-char2
+ JNZ SMISMATCH
+ ADD #1,X
+ SUB #1,TOS
+ JNZ SEQU_1
+ ; no mismatch found, strings are equal, TOS=0
+ JMP SEQU_X
+ ; mismatch found, CY clear if borrow set (s1<s2)
+SMISMATCH: SUBC TOS,TOS ; TOS=-1 if borrow was set
+ ADD TOS,TOS ; TOS=-2 or 0
+ ADD #1,TOS ; TOS=-1 or +1
+SEQU_X: NEXT ; return result in TOS
diff --git a/amforth-6.5/msp430/words/scomma.asm b/amforth-6.5/msp430/words/scomma.asm
new file mode 100644
index 0000000..92614e2
--- /dev/null
+++ b/amforth-6.5/msp430/words/scomma.asm
@@ -0,0 +1,10 @@
+; compiles a string to the dictionary. Does not add a runtime action.
+ DW link
+ DB 0FEh ; immediate
+.set link = $
+ DB 2,"s",','
+ .align 16
+XT_SCOMMA:
+ DW DOCOLON
+ DW XT_DUP,XT_TO_R,XT_CCOMMA,XT_IHERE,XT_R_FETCH,XT_DTOI
+ DW XT_R_FROM,XT_IALLOT,XT_ALIGN,XT_EXIT
diff --git a/amforth-6.5/msp430/words/set-current.asm b/amforth-6.5/msp430/words/set-current.asm
new file mode 100644
index 0000000..c76e3e8
--- /dev/null
+++ b/amforth-6.5/msp430/words/set-current.asm
@@ -0,0 +1,2 @@
+ HEADER(XT_SET_CURRENT,11,"set-current",DOCOLON)
+ DW XT_DOLITERAL,CFG_CURRENT,XT_STORE,XT_EXIT
diff --git a/amforth-6.5/msp430/words/slash-mod.asm b/amforth-6.5/msp430/words/slash-mod.asm
new file mode 100644
index 0000000..ba5d98c
--- /dev/null
+++ b/amforth-6.5/msp430/words/slash-mod.asm
@@ -0,0 +1,4 @@
+;C /MOD n1 n2 -- n3 n4 signed divide/rem'dr
+; >R S>D R> FM/MOD ;
+ HEADER(XT_SLASHMOD,4,"/mod",DOCOLON)
+ DW XT_TO_R,XT_S2D,XT_R_FROM,FMSLASHMOD,XT_EXIT
diff --git a/amforth-6.5/msp430/words/sm-rem.asm b/amforth-6.5/msp430/words/sm-rem.asm
new file mode 100644
index 0000000..5415080
--- /dev/null
+++ b/amforth-6.5/msp430/words/sm-rem.asm
@@ -0,0 +1,12 @@
+;C SM/REM d1 n1 -- n2 n3 symmetric signed div
+; 2DUP XOR >R sign of quotient
+; OVER >R sign of remainder
+; ABS >R DABS R> UM/MOD
+; XT_SWAP R> ?NEGATE
+; XT_SWAP R> ?NEGATE ;
+; Ref. dpANS-6 section 3.2.2.1.
+ HEADER(SMSLASHREM,6,"sm/rem",DOCOLON)
+ DW XT_2DUP,XT_XOR,XT_TO_R,XT_OVER,XT_TO_R
+ DW XT_ABS,XT_TO_R,XT_DABS,XT_R_FROM,XT_UMSLASHMOD
+ DW XT_SWAP,XT_R_FROM,XT_QNEGATE,XT_SWAP,XT_R_FROM,XT_QNEGATE
+ DW XT_EXIT
diff --git a/amforth-6.5/msp430/words/sp-fetch.asm b/amforth-6.5/msp430/words/sp-fetch.asm
new file mode 100644
index 0000000..fbf573a
--- /dev/null
+++ b/amforth-6.5/msp430/words/sp-fetch.asm
@@ -0,0 +1,6 @@
+;Z SP@ -- a-addr get data stack pointer
+ CODEHEADER(XT_SP_FETCH,3,"sp@")
+ SUB #2,PSP
+ MOV TOS,0(PSP)
+ MOV PSP,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/sp-store.asm b/amforth-6.5/msp430/words/sp-store.asm
new file mode 100644
index 0000000..5514744
--- /dev/null
+++ b/amforth-6.5/msp430/words/sp-store.asm
@@ -0,0 +1,5 @@
+;Z SP! a-addr -- set data stack pointer
+ CODEHEADER(XT_SP_STORE,3,"sp!")
+ MOV TOS,PSP
+ MOV @PSP+,TOS ; 2
+ NEXT
diff --git a/amforth-6.5/msp430/words/state.asm b/amforth-6.5/msp430/words/state.asm
new file mode 100644
index 0000000..4527f29
--- /dev/null
+++ b/amforth-6.5/msp430/words/state.asm
@@ -0,0 +1,4 @@
+;C STATE -- a-addr holds compiler state
+; 6 USER STATE
+ VARIABLE(XT_STATE,5,"state")
+ DW RAM_STATE
diff --git a/amforth-6.5/msp430/words/store.asm b/amforth-6.5/msp430/words/store.asm
new file mode 100644
index 0000000..a45fdcc
--- /dev/null
+++ b/amforth-6.5/msp430/words/store.asm
@@ -0,0 +1,5 @@
+;C ! x a-addr -- store cell in memory
+ CODEHEADER(XT_STORE,1,"!")
+ MOV @PSP+,0(TOS)
+ MOV @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/swap.asm b/amforth-6.5/msp430/words/swap.asm
new file mode 100644
index 0000000..7950f18
--- /dev/null
+++ b/amforth-6.5/msp430/words/swap.asm
@@ -0,0 +1,6 @@
+;C XT_SWAP x1 x2 -- x2 x1 swap top two items
+ CODEHEADER(XT_SWAP,4,"swap")
+ MOV @PSP,W ; 2
+ MOV TOS,0(PSP) ; 4
+ MOV W,TOS ; 1
+ NEXT ; 4
diff --git a/amforth-6.5/msp430/words/to-body.asm b/amforth-6.5/msp430/words/to-body.asm
new file mode 100644
index 0000000..b5be7a3
--- /dev/null
+++ b/amforth-6.5/msp430/words/to-body.asm
@@ -0,0 +1,3 @@
+;C >BODY xt -- a-addr adrs of CREATE data
+; 2+ ; 8086 (3 byte CALL)
+ HEADER(XT_TO_BODY,5,">body",XT_CELLPLUS+2)
diff --git a/amforth-6.5/msp430/words/to-r.asm b/amforth-6.5/msp430/words/to-r.asm
new file mode 100644
index 0000000..d4d57b8
--- /dev/null
+++ b/amforth-6.5/msp430/words/to-r.asm
@@ -0,0 +1,5 @@
+;C >R x -- R: -- x push to return stack
+ CODEHEADER(XT_TO_R,2,">r")
+ PUSH TOS
+ MOV @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/turnkey.asm b/amforth-6.5/msp430/words/turnkey.asm
new file mode 100644
index 0000000..58445cf
--- /dev/null
+++ b/amforth-6.5/msp430/words/turnkey.asm
@@ -0,0 +1,5 @@
+
+DEFER(XT_TURNKEY,7,"turnkey")
+ .dw CFG_TURNKEY
+ .dw XT_RDEFERFETCH
+ .dw XT_RDEFERSTORE
diff --git a/amforth-6.5/msp430/words/u-less.asm b/amforth-6.5/msp430/words/u-less.asm
new file mode 100644
index 0000000..2e7b5af
--- /dev/null
+++ b/amforth-6.5/msp430/words/u-less.asm
@@ -0,0 +1,6 @@
+;C U< u1 u2 -- flag test u1<u2, unsigned
+ CODEHEADER(XT_ULESS,2,"u<")
+ MOV @PSP+,W
+ SUB TOS,W ; u1-u2 in W, cy clear if borrow
+ JNC TOSTRUE
+ JMP TOSFALSE
diff --git a/amforth-6.5/msp430/words/uinit.asm b/amforth-6.5/msp430/words/uinit.asm
new file mode 100644
index 0000000..eb4c058
--- /dev/null
+++ b/amforth-6.5/msp430/words/uinit.asm
@@ -0,0 +1,39 @@
+;Z uinit -- addr initial values for user area
+; MSP430: we also use this to initialize the RAM interrupt
+; vectors, which immediately follow the user area.
+; Per init430f1611.s43, allocate 16 cells for user
+; variables, followed by 30 cells for interrupt vectors.
+ HEADER(XT_UINIT,5,"uinit",DOROM)
+; CFG Area
+ DW 2,XT_REC_FIND,XT_REC_NUM,0,0
+ DW 1,CFG_FORTHWID,0,0,0,0,0,0,0
+ DW XT_APPLTURNKEY ; TURNKEY vector
+ DW RAMDICT ; HERE / DP
+ DW ROMDICT ; IHERE / IDP
+ DW INFODICT ; INFOHERE / INFODP
+ DW CFG_FORTHWID ; CURRENT
+ DW lastword ; FORTH WID
+ DW lastenv ; environment WID
+ DW XT_GET_CURRENT ; wlscope
+ DW CFG_RECOGNIZERLISTLEN ; FORTH-RECOGNIZER
+
+.if WANT_INTERRUPTS==1
+ DW XT_NOOP,XT_NOOP,XT_NOOP,XT_NOOP,XT_NOOP
+ DW XT_NOOP,XT_NOOP,XT_NOOP,XT_NOOP,XT_NOOP
+.endif
+
+; USER Area
+ DW 0,0 ; STATE/FOLLOWER
+ DW 0,0,0 ; RP,SP0, SP
+ DW 0 ; HANDLER
+ DW 10 ; BASE
+ DW XT_USART_TX_POLL
+ DW XT_USART_TXQ_POLL
+ DW XT_USART_RX_POLL
+ DW XT_USART_RXQ_POLL
+ DW XT_SOURCETIB
+ DW 0 ; >IN
+ DW XT_REFILLTIB
+ DW XT_DEFAULT_PROMPTOK
+ DW XT_DEFAULT_PROMPTERROR
+ DW XT_DEFAULT_PROMPTREADY
diff --git a/amforth-6.5/msp430/words/um-slash-mod.asm b/amforth-6.5/msp430/words/um-slash-mod.asm
new file mode 100644
index 0000000..3904e8d
--- /dev/null
+++ b/amforth-6.5/msp430/words/um-slash-mod.asm
@@ -0,0 +1,31 @@
+;C UM/MOD ud u1 -- u2 u3 unsigned 32/16->16
+ CODEHEADER(XT_UMSLASHMOD,6,"um/mod")
+ ; IROP1 = TOS register
+ MOV @PSP+,IROP2M ; get ud hi
+ MOV @PSP,IROP2L ; get ud lo, leave room on stack
+;
+; T.I. UNSIGNED DIVISION SUBROUTINE 32-BIT BY 16-BIT
+; IROP2M|IROP2L : IROP1 -> IRACL REMAINDER IN IROP2M
+; RETURN: CARRY = 0: OK CARRY = 1: QUOTIENT > 16 BITS
+DIVIDE: CLR IRACL ; CLEAR RESULT
+ MOV #17,IRBT ; INITIALIZE LOOP COUNTER
+DIV1: CMP IROP1,IROP2M ;
+ JLO DIV2
+ SUB IROP1,IROP2M
+DIV2: RLC IRACL
+ JC DIV4 ; Error: result > 16 bits
+ DEC IRBT ; Decrement loop counter
+ JZ DIV3 ; Is 0: terminate w/o error
+ RLA IROP2L
+ RLC IROP2M
+ JNC DIV1
+ SUB IROP1,IROP2M
+ SETC
+ JMP DIV2
+DIV3: CLRC ; No error, C = 0
+DIV4: ; Error indication in C
+; END T.I. ROUTINE Section 5.1.5 of MSP430 Family Application Reports
+ MOV IROP2M,0(PSP) ; remainder on stack
+ MOV IRACL,TOS ; quotient in TOS
+ NEXT
+
diff --git a/amforth-6.5/msp430/words/um-star.asm b/amforth-6.5/msp430/words/um-star.asm
new file mode 100644
index 0000000..7b031b0
--- /dev/null
+++ b/amforth-6.5/msp430/words/um-star.asm
@@ -0,0 +1,38 @@
+;C UM* u1 u2 -- ud unsigned 16x16->32 mult.
+ CODEHEADER(XT_UMSTAR,3,"um*")
+.ifdef MPY
+ dint
+ mov @PSP, &MPY
+ mov TOS, &OP2
+ nop ; 1 cycle for calculation
+ mov &RESLO, 0(PSP)
+ mov &RESHI, TOS
+ eint
+.else
+ ; IROP1 = TOS register
+ MOV @PSP,IROP2L ; get u1, leave room on stack
+ PUSH IRACL ; possibly used as register B
+;
+; T.I. SIGNED MULTIPLY SUBROUTINE: IROP1 x IROP2L -> IRACM|IRACL
+MPYU: CLR IRACL ; 0 -> LSBs RESULT
+ CLR IRACM ; 0 -> MSBs RESULT
+; UNSIGNED MULTIPLY AND ACCUMULATE SUBROUTINE:
+; (IROP1 x IROP2L) + IRACM|IRACL -> IRACM|IRACL
+MACU: CLR IROP2M ; MSBs MULTIPLIER
+ MOV #1,IRBT ; BIT TEST REGISTER
+L_002: BIT IRBT,IROP1 ; TEST ACTUAL BIT
+ JZ L_01 ; IF 0: DO NOTHING
+ ADD IROP2L,IRACL ; IF 1: ADD MULTIPLIER TO RESULT
+ ADDC IROP2M,IRACM
+L_01: RLA IROP2L ; MULTIPLIER x 2
+ RLC IROP2M
+;
+ RLA IRBT ; NEXT BIT TO TEST
+ JNC L_002 ; IF BIT IN CARRY: FINISHED
+; END T.I. ROUTINE section 5.1.1 of MSP430 Family Application Reports
+ MOV IRACL,0(PSP) ; low result on stack
+ MOV IRACM,TOS ; high result in TOS
+ POP IRACL ; possibly used as register B
+
+.endif
+ NEXT
diff --git a/amforth-6.5/msp430/words/unloop.asm b/amforth-6.5/msp430/words/unloop.asm
new file mode 100644
index 0000000..ac8e5a6
--- /dev/null
+++ b/amforth-6.5/msp430/words/unloop.asm
@@ -0,0 +1,5 @@
+;C UNLOOP -- R: sys1 sys2 -- drop loop parms
+ CODEHEADER(XT_UNLOOP,6,"unloop")
+ MOV @RSP+,INDEX ; restore old loop values
+ MOV @RSP+,LIMIT
+ NEXT
diff --git a/amforth-6.5/msp430/words/up.asm b/amforth-6.5/msp430/words/up.asm
new file mode 100644
index 0000000..a3674d1
--- /dev/null
+++ b/amforth-6.5/msp430/words/up.asm
@@ -0,0 +1,11 @@
+
+CODEHEADER(XT_UP_FETCH,3,"up@")
+ SUB #2,PSP
+ MOV TOS, 0(PSP)
+ MOV UP,TOS
+ NEXT
+
+CODEHEADER(XT_UP_STORE,3,"up!")
+ MOV TOS,UP
+ MOV @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/usart-rx.asm b/amforth-6.5/msp430/words/usart-rx.asm
new file mode 100644
index 0000000..16bd4c1
--- /dev/null
+++ b/amforth-6.5/msp430/words/usart-rx.asm
@@ -0,0 +1,10 @@
+;C KEY -- c get character from keyboard
+ HEADER(XT_USART_RX_POLL,2,"rx",DOCOLON)
+KEYLOOP:
+ .DW XT_KEYQ
+ .dw XT_DOCONDBRANCH
+ DEST(KEYLOOP)
+ .dw XT_DOLITERAL
+ .dw USART_RX_DATA
+ .dw XT_CFETCH
+ .dw XT_EXIT
diff --git a/amforth-6.5/msp430/words/usart-rxq.asm b/amforth-6.5/msp430/words/usart-rxq.asm
new file mode 100644
index 0000000..cc79509
--- /dev/null
+++ b/amforth-6.5/msp430/words/usart-rxq.asm
@@ -0,0 +1,14 @@
+;X KEY? -- f return true if char waiting
+
+HEADER(XT_USART_RXQ_POLL,3,"rx?",DOCOLON)
+ .dw XT_PAUSE
+ .dw XT_DOLITERAL
+ .dw bm_USART_RXRD
+ .dw XT_DUP
+ .dw XT_DOLITERAL
+ .dw USART_RX_CFG
+ .dw XT_CFETCH
+ .dw XT_AND
+ .dw XT_EQUAL
+ .dw XT_EXIT
+
diff --git a/amforth-6.5/msp430/words/usart-tx.asm b/amforth-6.5/msp430/words/usart-tx.asm
new file mode 100644
index 0000000..07b0f5a
--- /dev/null
+++ b/amforth-6.5/msp430/words/usart-tx.asm
@@ -0,0 +1,14 @@
+; ----------------------------------------------------------------------
+; TERMINAL I/O (TARGET-SPECIFIC)
+
+;C EMIT c -- output character to console
+ HEADER(XT_USART_TX_POLL,2,"tx",DOCOLON)
+
+EMITLOOP:
+ .dw XT_EMITQ
+ .dw XT_DOCONDBRANCH
+ DEST(EMITLOOP)
+ .dw XT_DOLITERAL
+ .dw USART_TX_DATA
+ .dw XT_CSTORE
+ .dw XT_EXIT
diff --git a/amforth-6.5/msp430/words/usart-txq.asm b/amforth-6.5/msp430/words/usart-txq.asm
new file mode 100644
index 0000000..9868346
--- /dev/null
+++ b/amforth-6.5/msp430/words/usart-txq.asm
@@ -0,0 +1,15 @@
+; ----------------------------------------------------------------------
+; TERMINAL I/O (TARGET-SPECIFIC)
+
+;C EMIT? c -- output character to console
+HEADER(XT_USART_TXQ_POLL,3,"tx?",DOCOLON)
+ .dw XT_PAUSE
+ .dw XT_DOLITERAL
+ .dw bm_USART_TXRD
+ .dw XT_DUP
+ .dw XT_DOLITERAL
+ .dw USART_TX_CFG
+ .dw XT_CFETCH
+ .dw XT_AND
+ .dw XT_EQUAL
+ .dw XT_EXIT
diff --git a/amforth-6.5/msp430/words/user.asm b/amforth-6.5/msp430/words/user.asm
new file mode 100644
index 0000000..e436355
--- /dev/null
+++ b/amforth-6.5/msp430/words/user.asm
@@ -0,0 +1,9 @@
+;Z USER n -- define user variable with offset 'n'
+ HEADER(XT_USER,4,"user",DOCOLON)
+ DW XT_DOCREATE,XT_COMPILE, DOUSER, XT_COMMA, XT_REVEAL,XT_EXIT
+DOUSER: ; -- a-addr ; add constant to User Pointer, result in TOS
+ SUB #2,PSP
+ MOV TOS,0(PSP)
+ MOV @W,TOS
+ ADD UP,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/wlscope.asm b/amforth-6.5/msp430/words/wlscope.asm
new file mode 100644
index 0000000..a0f8dd0
--- /dev/null
+++ b/amforth-6.5/msp430/words/wlscope.asm
@@ -0,0 +1,5 @@
+
+DEFER(XT_WLSCOPE,7,"wlscope")
+ .dw CFG_WLSCOPE
+ .dw XT_CFGDEFERFETCH
+ .dw XT_CFGDEFERSTORE
diff --git a/amforth-6.5/msp430/words/wordlist.asm b/amforth-6.5/msp430/words/wordlist.asm
new file mode 100644
index 0000000..d2b550c
--- /dev/null
+++ b/amforth-6.5/msp430/words/wordlist.asm
@@ -0,0 +1,14 @@
+; ( -- wid )
+; Search Order
+; create a new, empty wordlist
+HEADER(XT_WORDLIST,8,"wordlist",DOCOLON)
+ .dw XT_INFODP
+ .dw XT_FETCH
+ .dw XT_ZERO
+ .dw XT_OVER
+ .dw XT_STORE
+ .dw XT_DUP
+ .dw XT_CELLPLUS
+ .dw XT_INFODP
+ .dw XT_STORE
+ .dw XT_EXIT
diff --git a/amforth-6.5/msp430/words/xor.asm b/amforth-6.5/msp430/words/xor.asm
new file mode 100644
index 0000000..2989f4c
--- /dev/null
+++ b/amforth-6.5/msp430/words/xor.asm
@@ -0,0 +1,5 @@
+
+;C XOR x1 x2 -- x3 logical XOR
+ CODEHEADER(XT_XOR,3,"xor")
+ XOR @PSP+,TOS
+ NEXT
diff --git a/amforth-6.5/msp430/words/zero-equal.asm b/amforth-6.5/msp430/words/zero-equal.asm
new file mode 100644
index 0000000..2c159e2
--- /dev/null
+++ b/amforth-6.5/msp430/words/zero-equal.asm
@@ -0,0 +1,5 @@
+;C 0= n/u -- flag return true if TOS=0
+ CODEHEADER(XT_ZEROEQUAL,2,"0=")
+ SUB #1,TOS ; borrow (clear cy) if TOS was 0
+ SUBC TOS,TOS ; TOS=-1 if borrow was set
+ NEXT
diff --git a/amforth-6.5/msp430/words/zero-less.asm b/amforth-6.5/msp430/words/zero-less.asm
new file mode 100644
index 0000000..2b8252f
--- /dev/null
+++ b/amforth-6.5/msp430/words/zero-less.asm
@@ -0,0 +1,6 @@
+;C 0< n -- flag true if TOS negative
+ CODEHEADER(XT_ZEROLESS,2,"0<")
+ ADD TOS,TOS ; set cy if TOS negative
+ SUBC TOS,TOS ; TOS=-1 if carry was clear
+ XOR #-1,TOS ; TOS=-1 if carry was set
+ NEXT