AVRASM ver. 2.1.52 duemilanove.asm Sun Apr 30 20:10:13 2017 duemilanove.asm(5): Including file '../../avr8\preamble.inc' ../../avr8\preamble.inc(2): Including file '../../avr8\macros.asm' ../../avr8\macros.asm(6): Including file '../../avr8\user.inc' ../../avr8\preamble.inc(6): Including file '../../avr8/devices/atmega328p\device.asm' ../../avr8/devices/atmega328p\device.asm(5): Including file '../../avr8/Atmel/Appnotes2\m328Pdef.inc' duemilanove.asm(11): Including file '../../avr8\drivers/usart_0.asm' ../../avr8\drivers/usart_0.asm(32): Including file '../../avr8\drivers/usart_common.asm' ../../avr8\drivers/usart_common.asm(11): Including file '../../avr8\drivers/usart-rx-buffer.asm' ../../avr8\drivers/usart_common.asm(24): Including file '../../avr8\words/usart-tx-poll.asm' ../../avr8\drivers/usart_common.asm(29): Including file '../../avr8\words/ubrr.asm' ../../avr8\drivers/usart_common.asm(30): Including file '../../avr8\words/usart.asm' duemilanove.asm(13): Including file '../../avr8\amforth.asm' ../../avr8\amforth.asm(12): Including file '../../avr8\drivers/generic-isr.asm' ../../avr8\amforth.asm(14): Including file '../../avr8\dict/rww.inc' ../../avr8\dict/rww.inc(1): Including file '../../avr8\words/mplus.asm' ../../avr8\dict/rww.inc(2): Including file '../../common\words/ud-star.asm' ../../avr8\dict/rww.inc(3): Including file '../../common\words/umax.asm' ../../avr8\dict/rww.inc(4): Including file '../../common\words/umin.asm' ../../avr8\dict/rww.inc(5): Including file '../../avr8\words/immediate-q.asm' ../../avr8\dict/rww.inc(6): Including file '../../avr8\words/name2flags.asm' ../../avr8\dict/rww.inc(11): Including file '../../avr8\dict/appl_4k.inc' ../../avr8\dict/appl_4k.inc(1): Including file '../../common\words/ver.asm' ../../avr8\dict/appl_4k.inc(4): Including file '../../common\words/noop.asm' ../../avr8\dict/appl_4k.inc(5): Including file '../../avr8\words/unused.asm' ../../avr8\dict/appl_4k.inc(6): Including file '../../common\words/to.asm' ../../avr8\dict/appl_4k.inc(7): Including file '../../avr8\words/i-cellplus.asm' ../../avr8\dict/appl_4k.inc(8): Including file '../../avr8\words/icompare.asm' ../../avr8\dict/appl_4k.inc(9): Including file '../../common\words/star.asm' ../../avr8\dict/appl_4k.inc(10): Including file '../../avr8\words/j.asm' ../../avr8\dict/appl_4k.inc(11): Including file '../../avr8\words/dabs.asm' ../../avr8\dict/appl_4k.inc(12): Including file '../../avr8\words/dnegate.asm' ../../avr8\dict/appl_4k.inc(13): Including file '../../avr8\words/cmove.asm' ../../avr8\dict/appl_4k.inc(14): Including file '../../common\words/2swap.asm' ../../avr8\dict/appl_4k.inc(15): Including file '../../common\words/tib.asm' ../../avr8\dict/appl_4k.inc(16): Including file '../../avr8\words/init-ram.asm' ../../avr8\dict/appl_4k.inc(20): Including file '../../avr8\words/environment.asm' ../../avr8\dict/appl_4k.inc(21): Including file '../../avr8\words/env-wordlists.asm' ../../avr8\dict/appl_4k.inc(22): Including file '../../avr8\words/env-slashpad.asm' ../../avr8\dict/appl_4k.inc(23): Including file '../../common\words/env-slashhold.asm' ../../avr8\dict/appl_4k.inc(24): Including file '../../common\words/env-forthname.asm' ../../avr8\dict/appl_4k.inc(25): Including file '../../common\words/env-forthversion.asm' ../../avr8\dict/appl_4k.inc(26): Including file '../../common\words/env-cpu.asm' ../../avr8\dict/appl_4k.inc(27): Including file '../../avr8\words/env-mcuinfo.asm' ../../avr8\dict/appl_4k.inc(28): Including file '../../common\words/env-usersize.asm' ../../avr8\dict/appl_4k.inc(30): Including file '../../avr8\words/hld.asm' ../../avr8\dict/appl_4k.inc(31): Including file '../../common\words/hold.asm' ../../avr8\dict/appl_4k.inc(32): Including file '../../common\words/less-sharp.asm' ../../avr8\dict/appl_4k.inc(33): Including file '../../common\words/sharp.asm' ../../avr8\dict/appl_4k.inc(34): Including file '../../common\words/sharp-s.asm' ../../avr8\dict/appl_4k.inc(35): Including file '../../common\words/sharp-greater.asm' ../../avr8\dict/appl_4k.inc(36): Including file '../../common\words/sign.asm' ../../avr8\dict/appl_4k.inc(37): Including file '../../common\words/d-dot-r.asm' ../../avr8\dict/appl_4k.inc(38): Including file '../../common\words/dot-r.asm' ../../avr8\dict/appl_4k.inc(39): Including file '../../common\words/d-dot.asm' ../../avr8\dict/appl_4k.inc(40): Including file '../../common\words/dot.asm' ../../avr8\dict/appl_4k.inc(41): Including file '../../common\words/ud-dot.asm' ../../avr8\dict/appl_4k.inc(42): Including file '../../common\words/ud-dot-r.asm' ../../avr8\dict/appl_4k.inc(43): Including file '../../common\words/ud-slash-mod.asm' ../../avr8\dict/appl_4k.inc(44): Including file '../../common\words/digit-q.asm' ../../avr8\dict/appl_4k.inc(46): Including file '../../avr8\words/do-sliteral.asm' ../../avr8\dict/appl_4k.inc(47): Including file '../../avr8\words/scomma.asm' ../../avr8\dict/appl_4k.inc(48): Including file '../../avr8\words/itype.asm' ../../avr8\dict/appl_4k.inc(49): Including file '../../avr8\words/icount.asm' ../../avr8\dict/appl_4k.inc(50): Including file '../../common\words/type.asm' ../../avr8\dict/appl_4k.inc(51): Including file '../../common\words/tick.asm' ../../avr8\dict/appl_4k.inc(53): Including file '../../common\words/cskip.asm' ../../avr8\dict/appl_4k.inc(54): Including file '../../common\words/cscan.asm' ../../avr8\dict/appl_4k.inc(55): Including file '../../common\words/accept.asm' ../../avr8\dict/appl_4k.inc(56): Including file '../../common\words/refill.asm' ../../avr8\dict/appl_4k.inc(57): Including file '../../common\words/char.asm' ../../avr8\dict/appl_4k.inc(58): Including file '../../common\words/number.asm' ../../avr8\dict/appl_4k.inc(59): Including file '../../common\words/q-sign.asm' ../../avr8\dict/appl_4k.inc(60): Including file '../../common\words/set-base.asm' ../../avr8\dict/appl_4k.inc(61): Including file '../../common\words/to-number.asm' ../../avr8\dict/appl_4k.inc(62): Including file '../../common\words/parse.asm' ../../avr8\dict/appl_4k.inc(63): Including file '../../common\words/source.asm' ../../avr8\dict/appl_4k.inc(64): Including file '../../common\words/slash-string.asm' ../../avr8\dict/appl_4k.inc(65): Including file '../../common\words/parse-name.asm' ../../avr8\dict/appl_4k.inc(66): Including file '../../avr8\words/sp0.asm' ../../avr8\dict/appl_4k.inc(67): Including file '../../avr8\words/rp0.asm' ../../avr8\dict/appl_4k.inc(68): Including file '../../common\words/depth.asm' ../../avr8\dict/appl_4k.inc(69): Including file '../../avr8\words/forth-recognizer.asm' ../../avr8\dict/appl_4k.inc(70): Including file '../../common\words/recognize.asm' ../../avr8\dict/appl_4k.inc(71): Including file '../../common\words/interpret.asm' ../../avr8\dict/appl_4k.inc(72): Including file '../../common\words/rec-intnum.asm' ../../avr8\dict/appl_4k.inc(73): Including file '../../common\words/rec-find.asm' ../../avr8\dict/appl_4k.inc(74): Including file '../../common\words/dt-null.asm' ../../avr8\dict/appl_4k.inc(75): Including file '../../common\words/search-wordlist.asm' ../../avr8\dict/appl_4k.inc(76): Including file '../../common\words/traverse-wordlist.asm' ../../avr8\dict/appl_4k.inc(77): Including file '../../common\words/name2string.asm' ../../avr8\dict/appl_4k.inc(78): Including file '../../avr8\words/nfa2cfa.asm' ../../avr8\dict/appl_4k.inc(79): Including file '../../common\words/find-xt.asm' ../../avr8\dict/appl_4k.inc(81): Including file '../../avr8\dict/compiler1.inc' ../../avr8\dict/compiler1.inc(2): Including file '../../avr8\words/newest.asm' ../../avr8\dict/compiler1.inc(3): Including file '../../avr8\words/latest.asm' ../../avr8\dict/compiler1.inc(4): Including file '../../common\words/do-create.asm' ../../avr8\dict/compiler1.inc(5): Including file '../../common\words/backslash.asm' ../../avr8\dict/compiler1.inc(6): Including file '../../common\words/l-paren.asm' ../../avr8\dict/compiler1.inc(8): Including file '../../common\words/compile.asm' ../../avr8\dict/compiler1.inc(9): Including file '../../avr8\words/comma.asm' ../../avr8\dict/compiler1.inc(10): Including file '../../common\words/brackettick.asm' ../../avr8\dict/compiler1.inc(13): Including file '../../common\words/literal.asm' ../../avr8\dict/compiler1.inc(14): Including file '../../common\words/sliteral.asm' ../../avr8\dict/compiler1.inc(15): Including file '../../avr8\words/g-mark.asm' ../../avr8\dict/compiler1.inc(16): Including file '../../avr8\words/g-resolve.asm' ../../avr8\dict/compiler1.inc(17): Including file '../../avr8\words/l_mark.asm' ../../avr8\dict/compiler1.inc(18): Including file '../../avr8\words/l_resolve.asm' ../../avr8\dict/compiler1.inc(20): Including file '../../common\words/ahead.asm' ../../avr8\dict/compiler1.inc(21): Including file '../../common\words/if.asm' ../../avr8\dict/compiler1.inc(22): Including file '../../common\words/else.asm' ../../avr8\dict/compiler1.inc(23): Including file '../../common\words/then.asm' ../../avr8\dict/compiler1.inc(24): Including file '../../common\words/begin.asm' ../../avr8\dict/compiler1.inc(25): Including file '../../common\words/while.asm' ../../avr8\dict/compiler1.inc(26): Including file '../../common\words/repeat.asm' ../../avr8\dict/compiler1.inc(27): Including file '../../common\words/until.asm' ../../avr8\dict/compiler1.inc(28): Including file '../../common\words/again.asm' ../../avr8\dict/compiler1.inc(29): Including file '../../common\words/do.asm' ../../avr8\dict/compiler1.inc(30): Including file '../../common\words/loop.asm' ../../avr8\dict/compiler1.inc(31): Including file '../../common\words/plusloop.asm' ../../avr8\dict/compiler1.inc(32): Including file '../../common\words/leave.asm' ../../avr8\dict/compiler1.inc(33): Including file '../../common\words/qdo.asm' ../../avr8\dict/compiler1.inc(34): Including file '../../common\words/endloop.asm' ../../avr8\dict/compiler1.inc(36): Including file '../../common\words/l-from.asm' ../../avr8\dict/compiler1.inc(37): Including file '../../common\words/to-l.asm' ../../avr8\dict/compiler1.inc(38): Including file '../../avr8\words/lp0.asm' ../../avr8\dict/compiler1.inc(39): Including file '../../avr8\words/lp.asm' ../../avr8\dict/compiler1.inc(41): Including file '../../common\words/create.asm' ../../avr8\dict/compiler1.inc(42): Including file '../../avr8\words/header.asm' ../../avr8\dict/compiler1.inc(43): Including file '../../avr8\words/wlscope.asm' ../../avr8\dict/compiler1.inc(44): Including file '../../common\words/reveal.asm' ../../avr8\dict/compiler1.inc(45): Including file '../../avr8\words/does.asm' ../../avr8\dict/compiler1.inc(46): Including file '../../common\words/colon.asm' ../../avr8\dict/compiler1.inc(47): Including file '../../avr8\words/colon-noname.asm' ../../avr8\dict/compiler1.inc(48): Including file '../../common\words/semicolon.asm' ../../avr8\dict/compiler1.inc(49): Including file '../../common\words/right-bracket.asm' ../../avr8\dict/compiler1.inc(50): Including file '../../common\words/left-bracket.asm' ../../avr8\dict/compiler1.inc(51): Including file '../../common\words/variable.asm' ../../avr8\dict/compiler1.inc(52): Including file '../../common\words/constant.asm' ../../avr8\dict/compiler1.inc(53): Including file '../../avr8\words/user.asm' ../../avr8\dict/compiler1.inc(55): Including file '../../common\words/recurse.asm' ../../avr8\dict/compiler1.inc(56): Including file '../../avr8\words/immediate.asm' ../../avr8\dict/compiler1.inc(58): Including file '../../common\words/bracketchar.asm' ../../avr8\dict/compiler1.inc(59): Including file '../../common\words/abort-string.asm' ../../avr8\dict/compiler1.inc(60): Including file '../../common\words/abort.asm' ../../avr8\dict/compiler1.inc(61): Including file '../../common\words/q-abort.asm' ../../avr8\dict/compiler1.inc(63): Including file '../../common\words/get-stack.asm' ../../avr8\dict/compiler1.inc(64): Including file '../../common\words/set-stack.asm' ../../avr8\dict/compiler1.inc(65): Including file '../../common\words/map-stack.asm' ../../avr8\dict/compiler1.inc(66): Including file '../../avr8\words/get-current.asm' ../../avr8\dict/compiler1.inc(67): Including file '../../common\words/get-order.asm' ../../avr8\dict/compiler1.inc(68): Including file '../../common\words/cfg-order.asm' ../../avr8\dict/compiler1.inc(69): Including file '../../avr8\words/compare.asm' ../../avr8\dict/compiler1.inc(70): Including file '../../avr8\words/nfa2lfa.asm' ../../avr8\amforth.asm(15): Including file 'dict_appl.inc' dict_appl.inc(4): Including file '../../avr8\dict/compiler2.inc' ../../avr8\dict/compiler2.inc(8): Including file '../../avr8\words/set-current.asm' ../../avr8\dict/compiler2.inc(9): Including file '../../avr8\words/wordlist.asm' ../../avr8\dict/compiler2.inc(11): Including file '../../avr8\words/forth-wordlist.asm' ../../avr8\dict/compiler2.inc(12): Including file '../../common\words/set-order.asm' ../../avr8\dict/compiler2.inc(13): Including file '../../common\words/set-recognizer.asm' ../../avr8\dict/compiler2.inc(14): Including file '../../common\words/get-recognizer.asm' ../../avr8\dict/compiler2.inc(15): Including file '../../avr8\words/code.asm' ../../avr8\dict/compiler2.inc(16): Including file '../../avr8\words/end-code.asm' ../../avr8\dict/compiler2.inc(17): Including file '../../avr8\words/marker.asm' ../../avr8\dict/compiler2.inc(18): Including file '../../common\words/postpone.asm' dict_appl.inc(6): Including file 'words/applturnkey.asm' ../../avr8\amforth.asm(23): Including file '../../avr8\amforth-interpreter.asm' ../../avr8\amforth.asm(24): Including file '../../avr8\dict/nrww.inc' ../../avr8\dict/nrww.inc(4): Including file '../../avr8\words/exit.asm' ../../avr8\dict/nrww.inc(5): Including file '../../avr8\words/execute.asm' ../../avr8\dict/nrww.inc(6): Including file '../../avr8\words/dobranch.asm' ../../avr8\dict/nrww.inc(7): Including file '../../avr8\words/docondbranch.asm' ../../avr8\dict/nrww.inc(10): Including file '../../avr8\words/doliteral.asm' ../../avr8\dict/nrww.inc(11): Including file '../../avr8\words/dovariable.asm' ../../avr8\dict/nrww.inc(12): Including file '../../avr8\words/doconstant.asm' ../../avr8\dict/nrww.inc(13): Including file '../../avr8\words/douser.asm' ../../avr8\dict/nrww.inc(14): Including file '../../avr8\words/do-value.asm' ../../avr8\dict/nrww.inc(15): Including file '../../avr8\words/fetch.asm' ../../avr8\dict/nrww.inc(16): Including file '../../avr8\words/store.asm' ../../avr8\dict/nrww.inc(17): Including file '../../avr8\words/cstore.asm' ../../avr8\dict/nrww.inc(18): Including file '../../avr8\words/cfetch.asm' ../../avr8\dict/nrww.inc(19): Including file '../../avr8\words/fetch-u.asm' ../../avr8\dict/nrww.inc(20): Including file '../../avr8\words/store-u.asm' ../../avr8\dict/nrww.inc(23): Including file '../../avr8\words/dup.asm' ../../avr8\dict/nrww.inc(24): Including file '../../avr8\words/qdup.asm' ../../avr8\dict/nrww.inc(25): Including file '../../avr8\words/swap.asm' ../../avr8\dict/nrww.inc(26): Including file '../../avr8\words/over.asm' ../../avr8\dict/nrww.inc(27): Including file '../../avr8\words/drop.asm' ../../avr8\dict/nrww.inc(28): Including file '../../avr8\words/rot.asm' ../../avr8\dict/nrww.inc(29): Including file '../../avr8\words/nip.asm' ../../avr8\dict/nrww.inc(31): Including file '../../avr8\words/r_from.asm' ../../avr8\dict/nrww.inc(32): Including file '../../avr8\words/to_r.asm' ../../avr8\dict/nrww.inc(33): Including file '../../avr8\words/r_fetch.asm' ../../avr8\dict/nrww.inc(36): Including file '../../common\words/not-equal.asm' ../../avr8\dict/nrww.inc(37): Including file '../../avr8\words/equalzero.asm' ../../avr8\dict/nrww.inc(38): Including file '../../avr8\words/lesszero.asm' ../../avr8\dict/nrww.inc(39): Including file '../../avr8\words/greaterzero.asm' ../../avr8\dict/nrww.inc(40): Including file '../../avr8\words/d-greaterzero.asm' ../../avr8\dict/nrww.inc(41): Including file '../../avr8\words/d-lesszero.asm' ../../avr8\dict/nrww.inc(43): Including file '../../avr8\words/true.asm' ../../avr8\dict/nrww.inc(44): Including file '../../avr8\words/zero.asm' ../../avr8\dict/nrww.inc(45): Including file '../../avr8\words/uless.asm' ../../avr8\dict/nrww.inc(46): Including file '../../common\words/u-greater.asm' ../../avr8\dict/nrww.inc(47): Including file '../../avr8\words/less.asm' ../../avr8\dict/nrww.inc(48): Including file '../../avr8\words/greater.asm' ../../avr8\dict/nrww.inc(50): Including file '../../avr8\words/log2.asm' ../../avr8\dict/nrww.inc(51): Including file '../../avr8\words/minus.asm' ../../avr8\dict/nrww.inc(52): Including file '../../avr8\words/plus.asm' ../../avr8\dict/nrww.inc(53): Including file '../../avr8\words/mstar.asm' ../../avr8\dict/nrww.inc(54): Including file '../../avr8\words/umslashmod.asm' ../../avr8\dict/nrww.inc(55): Including file '../../avr8\words/umstar.asm' ../../avr8\dict/nrww.inc(57): Including file '../../avr8\words/invert.asm' ../../avr8\dict/nrww.inc(58): Including file '../../avr8\words/2slash.asm' ../../avr8\dict/nrww.inc(59): Including file '../../avr8\words/2star.asm' ../../avr8\dict/nrww.inc(60): Including file '../../avr8\words/and.asm' ../../avr8\dict/nrww.inc(61): Including file '../../avr8\words/or.asm' ../../avr8\dict/nrww.inc(62): Including file '../../avr8\words/xor.asm' ../../avr8\dict/nrww.inc(64): Including file '../../avr8\words/1plus.asm' ../../avr8\dict/nrww.inc(65): Including file '../../avr8\words/1minus.asm' ../../avr8\dict/nrww.inc(66): Including file '../../common\words/q-negate.asm' ../../avr8\dict/nrww.inc(67): Including file '../../avr8\words/lshift.asm' ../../avr8\dict/nrww.inc(68): Including file '../../avr8\words/rshift.asm' ../../avr8\dict/nrww.inc(69): Including file '../../avr8\words/plusstore.asm' ../../avr8\dict/nrww.inc(71): Including file '../../avr8\words/rpfetch.asm' ../../avr8\dict/nrww.inc(72): Including file '../../avr8\words/rpstore.asm' ../../avr8\dict/nrww.inc(73): Including file '../../avr8\words/spfetch.asm' ../../avr8\dict/nrww.inc(74): Including file '../../avr8\words/spstore.asm' ../../avr8\dict/nrww.inc(76): Including file '../../avr8\words/dodo.asm' ../../avr8\dict/nrww.inc(77): Including file '../../avr8\words/i.asm' ../../avr8\dict/nrww.inc(78): Including file '../../avr8\words/doplusloop.asm' ../../avr8\dict/nrww.inc(79): Including file '../../avr8\words/doloop.asm' ../../avr8\dict/nrww.inc(80): Including file '../../avr8\words/unloop.asm' ../../avr8\dict/nrww.inc(84): Including file '../../avr8\words/cmove_g.asm' ../../avr8\dict/nrww.inc(85): Including file '../../avr8\words/byteswap.asm' ../../avr8\dict/nrww.inc(86): Including file '../../avr8\words/up.asm' ../../avr8\dict/nrww.inc(87): Including file '../../avr8\words/1ms.asm' ../../avr8\dict/nrww.inc(88): Including file '../../avr8\words/2to_r.asm' ../../avr8\dict/nrww.inc(89): Including file '../../avr8\words/2r_from.asm' ../../avr8\dict/nrww.inc(91): Including file '../../avr8\words/store-e.asm' ../../avr8\dict/nrww.inc(92): Including file '../../avr8\words/fetch-e.asm' ../../avr8\dict/nrww.inc(93): Including file '../../avr8\words/store-i.asm' ../../avr8\dict/nrww.inc(97): Including file '../../avr8\words/store-i_nrww.asm' ../../avr8\dict/nrww.inc(99): Including file '../../avr8\words/fetch-i.asm' ../../avr8\dict/nrww.inc(104): Including file '../../avr8\dict/core_4k.inc' ../../avr8\dict/core_4k.inc(3): Including file '../../avr8\words/n_to_r.asm' ../../avr8\dict/core_4k.inc(4): Including file '../../avr8\words/n_r_from.asm' ../../avr8\dict/core_4k.inc(5): Including file '../../avr8\words/d-2star.asm' ../../avr8\dict/core_4k.inc(6): Including file '../../avr8\words/d-2slash.asm' ../../avr8\dict/core_4k.inc(7): Including file '../../avr8\words/d-plus.asm' ../../avr8\dict/core_4k.inc(8): Including file '../../avr8\words/d-minus.asm' ../../avr8\dict/core_4k.inc(9): Including file '../../avr8\words/d-invert.asm' ../../avr8\dict/core_4k.inc(10): Including file '../../avr8\words/slashmod.asm' ../../avr8\dict/core_4k.inc(11): Including file '../../common\words/abs.asm' ../../avr8\dict/core_4k.inc(12): Including file '../../common\words/pick.asm' ../../avr8\dict/core_4k.inc(13): Including file '../../avr8\words/cellplus.asm' ../../avr8\dict/core_4k.inc(14): Including file '../../avr8\dict/interrupt.inc' ../../avr8\dict/interrupt.inc(8): Including file '../../avr8\words/int-on.asm' ../../avr8\dict/interrupt.inc(9): Including file '../../avr8\words/int-off.asm' ../../avr8\dict/interrupt.inc(10): Including file '../../avr8\words/int-store.asm' ../../avr8\dict/interrupt.inc(11): Including file '../../avr8\words/int-fetch.asm' ../../avr8\dict/interrupt.inc(12): Including file '../../avr8\words/int-trap.asm' ../../avr8\dict/interrupt.inc(14): Including file '../../avr8\words/isr-exec.asm' ../../avr8\dict/interrupt.inc(15): Including file '../../avr8\words/isr-end.asm' ../../avr8\dict/core_4k.inc(17): Including file '../../common\words/prompt-ok.asm' ../../avr8\dict/core_4k.inc(18): Including file '../../common\words/prompt-ready.asm' ../../avr8\dict/core_4k.inc(19): Including file '../../common\words/prompt-error.asm' ../../avr8\dict/core_4k.inc(21): Including file '../../common\words/quit.asm' ../../avr8\dict/core_4k.inc(22): Including file '../../avr8\words/pause.asm' ../../avr8\dict/core_4k.inc(23): Including file '../../avr8\words/cold.asm' ../../avr8\dict/core_4k.inc(24): Including file '../../common\words/warm.asm' ../../avr8\dict/core_4k.inc(26): Including file '../../common\words/handler.asm' ../../avr8\dict/core_4k.inc(27): Including file '../../common\words/catch.asm' ../../avr8\dict/core_4k.inc(28): Including file '../../common\words/throw.asm' ../../avr8\dict/core_4k.inc(31): Including file '../../avr8\words/edefer-fetch.asm' ../../avr8\dict/core_4k.inc(32): Including file '../../avr8\words/edefer-store.asm' ../../avr8\dict/core_4k.inc(33): Including file '../../common\words/rdefer-fetch.asm' ../../avr8\dict/core_4k.inc(34): Including file '../../common\words/rdefer-store.asm' ../../avr8\dict/core_4k.inc(35): Including file '../../common\words/udefer-fetch.asm' ../../avr8\dict/core_4k.inc(36): Including file '../../common\words/udefer-store.asm' ../../avr8\dict/core_4k.inc(37): Including file '../../common\words/defer-store.asm' ../../avr8\dict/core_4k.inc(38): Including file '../../common\words/defer-fetch.asm' ../../avr8\dict/core_4k.inc(39): Including file '../../avr8\words/do-defer.asm' ../../avr8\dict/core_4k.inc(41): Including file '../../common\words/u-dot.asm' ../../avr8\dict/core_4k.inc(42): Including file '../../common\words/u-dot-r.asm' ../../avr8\dict/core_4k.inc(45): Including file '../../avr8\words/uslashmod.asm' ../../avr8\dict/core_4k.inc(46): Including file '../../avr8\words/negate.asm' ../../avr8\dict/core_4k.inc(47): Including file '../../common\words/slash.asm' ../../avr8\dict/core_4k.inc(48): Including file '../../common\words/mod.asm' ../../avr8\dict/core_4k.inc(50): Including file '../../common\words/min.asm' ../../avr8\dict/core_4k.inc(51): Including file '../../common\words/max.asm' ../../avr8\dict/core_4k.inc(52): Including file '../../common\words/within.asm' ../../avr8\dict/core_4k.inc(54): Including file '../../common\words/show-wordlist.asm' ../../avr8\dict/core_4k.inc(55): Including file '../../common\words/words.asm' ../../avr8\dict/core_4k.inc(57): Including file '../../common\words/dot-quote.asm' ../../avr8\dict/core_4k.inc(58): Including file '../../common\words/squote.asm' ../../avr8\dict/core_4k.inc(59): Including file '../../avr8\words/fill.asm' ../../avr8\dict/core_4k.inc(61): Including file '../../common\words/f_cpu.asm' ../../avr8\dict/core_4k.inc(62): Including file '../../avr8\words/state.asm' ../../avr8\dict/core_4k.inc(63): Including file '../../common\words/base.asm' ../../avr8\dict/core_4k.inc(65): Including file '../../avr8\words/cells.asm' ../../avr8\dict/core_4k.inc(67): Including file '../../common\words/2dup.asm' ../../avr8\dict/core_4k.inc(68): Including file '../../common\words/2drop.asm' ../../avr8\dict/core_4k.inc(69): Including file '../../common\words/tuck.asm' ../../avr8\dict/core_4k.inc(71): Including file '../../common\words/to-in.asm' ../../avr8\dict/core_4k.inc(72): Including file '../../common\words/pad.asm' ../../avr8\dict/core_4k.inc(73): Including file '../../common\words/emit.asm' ../../avr8\dict/core_4k.inc(74): Including file '../../common\words/emitq.asm' ../../avr8\dict/core_4k.inc(75): Including file '../../common\words/key.asm' ../../avr8\dict/core_4k.inc(76): Including file '../../common\words/keyq.asm' ../../avr8\dict/core_4k.inc(78): Including file '../../avr8\words/dp.asm' ../../avr8\dict/core_4k.inc(79): Including file '../../avr8\words/ehere.asm' ../../avr8\dict/core_4k.inc(80): Including file '../../avr8\words/here.asm' ../../avr8\dict/core_4k.inc(81): Including file '../../avr8\words/allot.asm' ../../avr8\dict/core_4k.inc(83): Including file '../../common\words/bin.asm' ../../avr8\dict/core_4k.inc(84): Including file '../../common\words/decimal.asm' ../../avr8\dict/core_4k.inc(85): Including file '../../common\words/hex.asm' ../../avr8\dict/core_4k.inc(86): Including file '../../common\words/bl.asm' ../../avr8\dict/core_4k.inc(88): Including file '../../avr8\words/turnkey.asm' ../../avr8\dict/core_4k.inc(89): Including file '../../common\words/to-upper.asm' ../../avr8\dict/core_4k.inc(90): Including file '../../common\words/to-lower.asm' ../../avr8\dict/core_4k.inc(92): Including file '../../common\words/q-stack.asm' ../../avr8\dict/core_4k.inc(93): Including file '../../common\words/bounds.asm' ../../avr8\dict/core_4k.inc(94): Including file '../../common\words/cr.asm' ../../avr8\dict/core_4k.inc(95): Including file '../../common\words/space.asm' ../../avr8\dict/core_4k.inc(96): Including file '../../common\words/spaces.asm' ../../avr8\dict/core_4k.inc(97): Including file '../../common\words/s-to-d.asm' ../../avr8\dict/core_4k.inc(98): Including file '../../avr8\words/to-body.asm' ../../avr8\dict/nrww.inc(112): Including file '../../common\words/2literal.asm' ../../avr8\dict/nrww.inc(113): Including file '../../avr8\words/equal.asm' ../../avr8\dict/nrww.inc(114): Including file '../../common\words/num-constants.asm' ../../avr8\amforth.asm(25): Including file 'dict_appl_core.inc' ../../avr8\amforth.asm(36): Including file '../../avr8\amforth-eeprom.inc' ; file see ../template/template.asm. You may want to ; copy that file to this one and edit it afterwards. .include "preamble.inc" .include "macros.asm" .set DICT_COMPILER2 = 0 ; .set cpu_msp430 = 0 .set cpu_avr8 = 1 .include "user.inc" ; ; used by the multitasker .set USER_STATE = 0 .set USER_FOLLOWER = 2 ; stackpointer, used by mulitasker .set USER_RP = 4 .set USER_SP0 = 6 .set USER_SP = 8 ; excpection handling .set USER_HANDLER = 10 ; numeric IO .set USER_BASE = 12 ; character IO .set USER_EMIT = 14 .set USER_EMITQ = 16 .set USER_KEY = 18 .set USER_KEYQ = 20 .set USER_SOURCE = 22 .set USER_TO_IN = 24 .set USER_REFILL = 26 .set USER_P_OK = 28 .set USER_P_ERR = 30 .set USER_P_RDY = 32 .set SYSUSERSIZE = 34 ; .def zerol = r2 .def zeroh = r3 .def upl = r4 .def uph = r5 .def al = r6 .def ah = r7 .def bl = r8 .def bh = r9 ; internal .def mcu_boot = r10 .def isrflag = r11 .def temp4 = r14 .def temp5 = r15 .def temp0 = r16 .def temp1 = r17 .def temp2 = r18 .def temp3 = r19 .def temp6 = r20 .def temp7 = r21 .def tosl = r24 .def tosh = r25 .def wl = r22 .def wh = r23 .macro loadtos ld tosl, Y+ ld tosh, Y+ .endmacro .macro savetos st -Y, tosh st -Y, tosl .endmacro .macro in_ .if (@1 < $40) in @0,@1 .else lds @0,@1 .endif .endmacro .macro out_ .if (@0 < $40) out @0,@1 .else sts @0,@1 .endif .endmacro .macro sbi_ .if (@0 < $40) sbi @0,@1 .else in_ @2,@0 ori @2,exp2(@1) out_ @0,@2 .endif .endmacro .macro cbi_ .if (@0 < $40) cbi @0,@1 .else in_ @2,@0 andi @2,~(exp2(@1)) out_ @0,@2 .endif .endmacro .macro jmp_ ; a more flexible macro .ifdef @0 .if (@0-pc > 2040) || (pc-@0>2040) jmp @0 .else rjmp @0 .endif .else jmp @0 .endif .endmacro .macro call_ ; a more flexible macro .ifdef @0 .if (@0-pc > 2040) || (pc-@0>2040) call @0 .else rcall @0 .endif .else call @0 .endif .endmacro ; F_CPU ; µsec 16000000 14745600 8000000 1000000 ; 1 16 14,74 8 1 ; 10 160 147,45 80 10 ; 100 1600 1474,56 800 100 ; 1000 16000 14745,6 8000 1000 ; ; cycles = µsec * f_cpu / 1e6 ; n_loops=cycles/5 ; ; cycles already used will be subtracted from the delay ; the waittime resolution is 1 cycle (delay from exact to +1 cycle) ; the maximum delay at 20MHz (50ns/clock) is 38350ns ; waitcount register must specify an immediate register ; ; busy waits a specfied amount of microseconds .macro delay .set cycles = ( ( @0 * F_CPU ) / 1000000 ) .if (cycles > ( 256 * 255 * 4 + 2)) .error "MACRO delay - too many cycles to burn" .else .if (cycles > 6) .set loop_cycles = (cycles / 4) ldi zl,low(loop_cycles) ldi zh,high(loop_cycles) sbiw Z, 1 brne pc-1 .set cycles = (cycles - (loop_cycles * 4)) .endif .if (cycles > 0) .if (cycles & 4) rjmp pc+1 rjmp pc+1 .endif .if (cycles & 2) rjmp pc+1 .endif .if (cycles & 1) nop .endif .endif .endif .endmacro ; portability macros, they come from the msp430 branches .macro DEST .dw @0 .endm ; controller specific file selected via include ; directory definition when calling the assembler (-I) .include "device.asm" ; generated automatically, do not edit .list .equ ramstart = 256 .equ CELLSIZE = 2 .macro readflashcell lsl zl rol zh lpm @0, Z+ lpm @1, Z+ .endmacro .macro writeflashcell lsl zl rol zh .endmacro .set WANT_USART0 = 0 .set WANT_TWI = 0 .set WANT_TIMER_COUNTER_1 = 0 .set WANT_TIMER_COUNTER_2 = 0 .set WANT_AD_CONVERTER = 0 .set WANT_ANALOG_COMPARATOR = 0 .set WANT_PORTB = 0 .set WANT_PORTC = 0 .set WANT_PORTD = 0 .set WANT_TIMER_COUNTER_0 = 0 .set WANT_EXTERNAL_INTERRUPT = 0 .set WANT_SPI = 0 .set WANT_WATCHDOG = 0 .set WANT_CPU = 0 .set WANT_EEPROM = 0 .equ intvecsize = 2 ; please verify; flash size: 32768 bytes .equ pclen = 2 ; please verify .overlap .org 2 000002 d0da rcall isr ; External Interrupt Request 0 .org 4 000004 d0d8 rcall isr ; External Interrupt Request 1 .org 6 000006 d0d6 rcall isr ; Pin Change Interrupt Request 0 .org 8 000008 d0d4 rcall isr ; Pin Change Interrupt Request 0 .org 10 00000a d0d2 rcall isr ; Pin Change Interrupt Request 1 .org 12 00000c d0d0 rcall isr ; Watchdog Time-out Interrupt .org 14 00000e d0ce rcall isr ; Timer/Counter2 Compare Match A .org 16 000010 d0cc rcall isr ; Timer/Counter2 Compare Match A .org 18 000012 d0ca rcall isr ; Timer/Counter2 Overflow .org 20 000014 d0c8 rcall isr ; Timer/Counter1 Capture Event .org 22 000016 d0c6 rcall isr ; Timer/Counter1 Compare Match A .org 24 000018 d0c4 rcall isr ; Timer/Counter1 Compare Match B .org 26 00001a d0c2 rcall isr ; Timer/Counter1 Overflow .org 28 00001c d0c0 rcall isr ; TimerCounter0 Compare Match A .org 30 00001e d0be rcall isr ; TimerCounter0 Compare Match B .org 32 000020 d0bc rcall isr ; Timer/Couner0 Overflow .org 34 000022 d0ba rcall isr ; SPI Serial Transfer Complete .org 36 000024 d0b8 rcall isr ; USART Rx Complete .org 38 000026 d0b6 rcall isr ; USART, Data Register Empty .org 40 000028 d0b4 rcall isr ; USART Tx Complete .org 42 00002a d0b2 rcall isr ; ADC Conversion Complete .org 44 00002c d0b0 rcall isr ; EEPROM Ready .org 46 00002e d0ae rcall isr ; Analog Comparator .org 48 000030 d0ac rcall isr ; Two-wire Serial Interface .org 50 000032 d0aa rcall isr ; Store Program Memory Read .equ INTVECTORS = 26 .nooverlap ; compatability layer (maybe empty) .equ SPMEN = SELFPRGEN ; controller data area, environment query mcu-info mcu_info: mcu_ramsize: 000033 0800 .dw 2048 mcu_eepromsize: 000034 0400 .dw 1024 mcu_maxdp: 000035 7000 .dw 28672 mcu_numints: 000036 001a .dw 26 mcu_name: 000037 000a .dw 10 000038 5441 000039 656d 00003a 6167 00003b 3233 00003c 5038 .db "ATmega328P" .set codestart=pc ; some defaults, change them in your application master file ; see template.asm for an example ; enabling Interrupts, disabling them affects ; other settings as well. .set WANT_INTERRUPTS = 1 ; count the number of interrupts individually. ; requires a lot of RAM (one byte per interrupt) ; disabled by default. .set WANT_INTERRUPT_COUNTERS = 0 ; receiving is asynchronously, so an interrupt queue is useful. .set WANT_ISR_RX = 1 ; case insensitve dictionary lookup. .set WANT_IGNORECASE = 0 ; map all memories to one address space. Details in the ; technical guide .set WANT_UNIFIED = 0 ; terminal input buffer .set TIB_SIZE = 90 ; ANS94 needs at least 80 characters per line ; USER variables *in addition* to system ones .set APPUSERSIZE = 10 ; size of application specific user area in bytes ; addresses of various data segments .set rstackstart = RAMEND ; start address of return stack, grows downward .set stackstart = RAMEND - 80 ; start address of data stack, grows downward ; change only if you know what to you do .set NUMWORDLISTS = 8 ; number of word lists in the searh order, at least 8 .set NUMRECOGNIZERS = 4 ; total number of recognizers, two are always used. ; 10 per mille (1 per cent) is ok. .set BAUD = 38400 .set BAUD_MAXERROR = 10 ; Dictionary setup .set VE_HEAD = $0000 .set VE_ENVHEAD = $0000 .set WANT_IGNORECASE = 1 ; cpu clock in hertz .equ F_CPU = 16000000 .include "drivers/usart_0.asm" .equ BAUDRATE_HIGH = UBRR0H .equ USART_C = UCSR0C .equ USART_B = UCSR0B .equ USART_A = UCSR0A .equ USART_DATA = UDR0 .ifndef URXCaddr .endif .equ bm_USART_RXRD = 1 << RXC0 .equ bm_USART_TXRD = 1 << UDRE0 .equ bm_ENABLE_TX = 1 << TXEN0 .equ bm_ENABLE_RX = 1 << RXEN0 .equ bm_ENABLE_INT_RX = 1<rx-buf",0 000042 0000 .dw VE_HEAD .set VE_HEAD = VE_TO_RXBUF XT_TO_RXBUF: 000043 0044 .dw PFA_rx_tobuf PFA_rx_tobuf: 000044 2f08 mov temp0, tosl 000045 9110 0110 lds temp1, usart_rx_in 000047 e0e0 ldi zl, low(usart_rx_data) 000048 e0f1 ldi zh, high(usart_rx_data) 000049 0fe1 add zl, temp1 00004a 1df3 adc zh, zeroh 00004b 8300 st Z, temp0 00004c 9513 inc temp1 00004d 701f andi temp1,usart_rx_mask 00004e 9310 0110 sts usart_rx_in, temp1 000050 9189 000051 9199 loadtos 000052 940c 3804 jmp_ DO_NEXT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; setup with ; ' isr-rx URXCaddr int! VE_ISR_RX: 000054 ff06 .dw $ff06 000055 7369 000056 2d72 000057 7872 .db "isr-rx" 000058 003d .dw VE_HEAD .set VE_HEAD = VE_ISR_RX XT_ISR_RX: 000059 3800 .dw DO_COLON usart_rx_isr: 00005a 383c .dw XT_DOLITERAL 00005b 00c6 .dw usart_data 00005c 3897 .dw XT_CFETCH 00005d 38b0 .dw XT_DUP 00005e 383c .dw XT_DOLITERAL 00005f 0003 .dw 3 000060 3fde .dw XT_EQUAL 000061 3835 .dw XT_DOCONDBRANCH 000062 0064 .dw usart_rx_isr1 000063 3d37 .dw XT_COLD usart_rx_isr1: 000064 0043 .dw XT_TO_RXBUF 000065 381f .dw XT_EXIT ; ( -- ) Hardware Access ; R( --) ; initialize usart ;VE_USART_INIT_RXBUFFER: ; .dw $ff0x ; .db "+usart-buffer" ; .dw VE_HEAD ; .set VE_HEAD = VE_USART_INIT_RXBUFFER XT_USART_INIT_RX_BUFFER: 000066 3800 .dw DO_COLON PFA_USART_INIT_RX_BUFFER: ; ( -- ) 000067 383c 000068 0059 .dw XT_DOLITERAL, XT_ISR_RX 000069 383c 00006a 0024 .dw XT_DOLITERAL, URXCaddr 00006b 3ca4 .dw XT_INTSTORE 00006c 383c .dw XT_DOLITERAL 00006d 0100 .dw usart_rx_data 00006e 383c .dw XT_DOLITERAL 00006f 0016 .dw usart_rx_size + 6 000070 3953 .dw XT_ZERO 000071 3e97 .dw XT_FILL 000072 381f .dw XT_EXIT ; ( -- c) ; MCU ; get 1 character from input queue, wait if needed using interrupt driver VE_RX_BUFFER: 000073 ff06 .dw $ff06 000074 7872 000075 622d 000076 6675 .db "rx-buf" 000077 0054 .dw VE_HEAD .set VE_HEAD = VE_RX_BUFFER XT_RX_BUFFER: 000078 3800 .dw DO_COLON PFA_RX_BUFFER: 000079 0093 .dw XT_RXQ_BUFFER 00007a 3835 .dw XT_DOCONDBRANCH 00007b 0079 .dw PFA_RX_BUFFER 00007c 383c .dw XT_DOLITERAL 00007d 0111 .dw usart_rx_out 00007e 3897 .dw XT_CFETCH 00007f 38b0 .dw XT_DUP 000080 383c .dw XT_DOLITERAL 000081 0100 .dw usart_rx_data 000082 399c .dw XT_PLUS 000083 3897 .dw XT_CFETCH 000084 38c3 .dw XT_SWAP 000085 3a2e .dw XT_1PLUS 000086 383c .dw XT_DOLITERAL 000087 000f .dw usart_rx_mask 000088 3a12 .dw XT_AND 000089 383c .dw XT_DOLITERAL 00008a 0111 .dw usart_rx_out 00008b 388c .dw XT_CSTORE 00008c 381f .dw XT_EXIT ; ( -- f) ; MCU ; check if unread characters are in the input queue VE_RXQ_BUFFER: 00008d ff07 .dw $ff07 00008e 7872 00008f 2d3f 000090 7562 000091 0066 .db "rx?-buf",0 000092 0073 .dw VE_HEAD .set VE_HEAD = VE_RXQ_BUFFER XT_RXQ_BUFFER: 000093 3800 .dw DO_COLON PFA_RXQ_BUFFER: 000094 3d2f .dw XT_PAUSE 000095 383c .dw XT_DOLITERAL 000096 0111 .dw usart_rx_out 000097 3897 .dw XT_CFETCH 000098 383c .dw XT_DOLITERAL 000099 0110 .dw usart_rx_in 00009a 3897 .dw XT_CFETCH 00009b 3912 .dw XT_NOTEQUAL 00009c 381f .dw XT_EXIT ; .include "drivers/timer-usart-isr.asm" .set XT_RX = XT_RX_BUFFER .set XT_RXQ = XT_RXQ_BUFFER .set XT_USART_INIT_RX = XT_USART_INIT_RX_BUFFER .else .endif .include "words/usart-tx-poll.asm" ; MCU ; check availability and send one character to the terminal using register poll VE_TX_POLL: 00009d ff07 .dw $ff07 00009e 7874 00009f 702d 0000a0 6c6f 0000a1 006c .db "tx-poll",0 0000a2 008d .dw VE_HEAD .set VE_HEAD = VE_TX_POLL XT_TX_POLL: 0000a3 3800 .dw DO_COLON PFA_TX_POLL: ; wait for data ready 0000a4 00b1 .dw XT_TXQ_POLL 0000a5 3835 .dw XT_DOCONDBRANCH 0000a6 00a4 .dw PFA_TX_POLL ; send to usart 0000a7 383c .dw XT_DOLITERAL 0000a8 00c6 .dw USART_DATA 0000a9 388c .dw XT_CSTORE 0000aa 381f .dw XT_EXIT ; ( -- f) MCU ; MCU ; check if a character can be send using register poll VE_TXQ_POLL: 0000ab ff08 .dw $ff08 0000ac 7874 0000ad 2d3f 0000ae 6f70 0000af 6c6c .db "tx?-poll" 0000b0 009d .dw VE_HEAD .set VE_HEAD = VE_TXQ_POLL XT_TXQ_POLL: 0000b1 3800 .dw DO_COLON PFA_TXQ_POLL: 0000b2 3d2f .dw XT_PAUSE 0000b3 383c .dw XT_DOLITERAL 0000b4 00c0 .dw USART_A 0000b5 3897 .dw XT_CFETCH 0000b6 383c .dw XT_DOLITERAL 0000b7 0020 .dw bm_USART_TXRD 0000b8 3a12 .dw XT_AND 0000b9 381f .dw XT_EXIT .set XT_TX = XT_TX_POLL .set XT_TXQ = XT_TXQ_POLL .set XT_USART_INIT_TX = 0 .include "words/ubrr.asm" ; MCU ; returns usart UBRR settings VE_UBRR: 0000ba ff04 .dw $ff04 0000bb 6275 0000bc 7272 .db "ubrr" 0000bd 00ab .dw VE_HEAD .set VE_HEAD = VE_UBRR XT_UBRR: 0000be 386e .dw PFA_DOVALUE1 PFA_UBRR: ; ( -- ) 0000bf 008c .dw EE_UBRRVAL 0000c0 3d9f .dw XT_EDEFERFETCH 0000c1 3da9 .dw XT_EDEFERSTORE .include "words/usart.asm" ; MCU ; initialize usart VE_USART: 0000c2 ff06 .dw $ff06 0000c3 752b 0000c4 6173 0000c5 7472 .db "+usart" 0000c6 00ba .dw VE_HEAD .set VE_HEAD = VE_USART XT_USART: 0000c7 3800 .dw DO_COLON PFA_USART: ; ( -- ) 0000c8 383c .dw XT_DOLITERAL 0000c9 0098 .dw USART_B_VALUE 0000ca 383c .dw XT_DOLITERAL 0000cb 00c1 .dw USART_B 0000cc 388c .dw XT_CSTORE 0000cd 383c .dw XT_DOLITERAL 0000ce 0006 .dw USART_C_VALUE 0000cf 383c .dw XT_DOLITERAL 0000d0 00c2 .dw USART_C | bm_USARTC_en 0000d1 388c .dw XT_CSTORE 0000d2 00be .dw XT_UBRR 0000d3 38b0 .dw XT_DUP 0000d4 3af8 .dw XT_BYTESWAP 0000d5 383c .dw XT_DOLITERAL 0000d6 00c5 .dw BAUDRATE_HIGH 0000d7 388c .dw XT_CSTORE 0000d8 383c .dw XT_DOLITERAL 0000d9 00c4 .dw BAUDRATE_LOW 0000da 388c .dw XT_CSTORE .if XT_USART_INIT_RX!=0 0000db 0066 .dw XT_USART_INIT_RX .endif .if XT_USART_INIT_TX!=0 .endif 0000dc 381f .dw XT_EXIT .include "amforth.asm" ;;;; ;;;; GPL V2 (only) .set AMFORTH_NRWW_SIZE=(FLASHEND-AMFORTH_RO_SEG)*2 .set corepc = pc .org $0000 000000 940c 3d38 jmp_ PFA_COLD .org corepc .include "drivers/generic-isr.asm" .eseg 000000 intvec: .byte INTVECTORS * CELLSIZE .dseg 000112 intcnt: .byte INTVECTORS .cseg ; interrupt routine gets called (again) by rcall! This gives the ; address of the int-vector on the stack. isr: 0000dd 920a st -Y, r0 0000de b60f in r0, SREG 0000df 920a st -Y, r0 .if (pclen==3) .endif 0000e0 900f pop r0 0000e1 900f pop r0 ; = intnum * intvectorsize + 1 (address following the rcall) 0000e2 940a dec r0 .if intvecsize == 1 ; .endif 0000e3 2cb0 mov isrflag, r0 0000e4 93ff push zh 0000e5 93ef push zl 0000e6 e1e2 ldi zl, low(intcnt) 0000e7 e0f1 ldi zh, high(intcnt) 0000e8 9406 lsr r0 ; we use byte addresses in the counter array, not words 0000e9 0de0 add zl, r0 0000ea 1df3 adc zh, zeroh 0000eb 8000 ld r0, Z 0000ec 9403 inc r0 0000ed 8200 st Z, r0 0000ee 91ef pop zl 0000ef 91ff pop zh 0000f0 9009 ld r0, Y+ 0000f1 be0f out SREG, r0 0000f2 9009 ld r0, Y+ 0000f3 9508 ret ; returns the interrupt, the rcall stack frame is removed! ; no reti here, see words/isr-end.asm ; lower part of the dictionary .include "dict/rww.inc" ; Arithmetics ; add a number to a double cell VE_MPLUS: 0000f4 ff02 .dw $ff02 0000f5 2b6d .db "m+" 0000f6 00c2 .dw VE_HEAD .set VE_HEAD = VE_MPLUS XT_MPLUS: 0000f7 3800 .dw DO_COLON PFA_MPLUS: 0000f8 3fc6 .dw XT_S2D 0000f9 3c14 .dw XT_DPLUS 0000fa 381f .dw XT_EXIT .include "words/ud-star.asm" .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_UDSTAR: 0000fb ff03 .dw $ff03 0000fc 6475 ../../common\words/ud-star.asm(9): warning: .cseg .db misalignment - padding zero byte 0000fd 002a .db "ud*" 0000fe 00f4 .dw VE_HEAD .set VE_HEAD = VE_UDSTAR XT_UDSTAR: 0000ff 3800 .dw DO_COLON PFA_UDSTAR: .endif ;Z UD* ud1 d2 -- ud3 32*16->32 multiply ; XT_DUP >R UM* DROP XT_SWAP R> UM* ROT + ; 000100 38b0 000101 38fe 000102 39df 000103 38d8 .DW XT_DUP,XT_TO_R,XT_UMSTAR,XT_DROP 000104 38c3 000105 38f5 000106 39df 000107 38e0 000108 399c 000109 381f .DW XT_SWAP,XT_R_FROM,XT_UMSTAR,XT_ROT,XT_PLUS,XT_EXIT .include "words/umax.asm" .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_UMAX: 00010a ff04 .dw $ff04 00010b 6d75 00010c 7861 .db "umax" 00010d 00fb .dw VE_HEAD .set VE_HEAD = VE_UMAX XT_UMAX: 00010e 3800 .dw DO_COLON PFA_UMAX: .endif 00010f 3ec8 000110 395b .DW XT_2DUP,XT_ULESS 000111 3835 .dw XT_DOCONDBRANCH 000112 0114 DEST(UMAX1) 000113 38c3 .DW XT_SWAP 000114 38d8 UMAX1: .DW XT_DROP 000115 381f .dw XT_EXIT .include "words/umin.asm" .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_UMIN: 000116 ff04 .dw $ff04 000117 6d75 000118 6e69 .db "umin" 000119 010a .dw VE_HEAD .set VE_HEAD = VE_UMIN XT_UMIN: 00011a 3800 .dw DO_COLON PFA_UMIN: .endif 00011b 3ec8 00011c 3966 .DW XT_2DUP,XT_UGREATER 00011d 3835 .dw XT_DOCONDBRANCH 00011e 0120 DEST(UMIN1) 00011f 38c3 .DW XT_SWAP 000120 38d8 UMIN1: .DW XT_DROP 000121 381f .dw XT_EXIT .include "words/immediate-q.asm" ; Tools ; return +1 if immediate, -1 otherwise, flag from name>flags ;VE_IMMEDIATEQ: ; .dw $ff06 ; .db "immediate?" ; .dw VE_HEAD ; .set VE_HEAD = VE_IMMEDIATEQ XT_IMMEDIATEQ: 000122 3800 .dw DO_COLON PFA_IMMEDIATEQ: 000123 383c .dw XT_DOLITERAL 000124 8000 .dw $8000 000125 3a12 .dw XT_AND 000126 3919 .dw XT_ZEROEQUAL 000127 3835 .dw XT_DOCONDBRANCH 000128 012b DEST(IMMEDIATEQ1) 000129 3fe5 .dw XT_ONE 00012a 381f .dw XT_EXIT IMMEDIATEQ1: ; not immediate 00012b 394a .dw XT_TRUE 00012c 381f .dw XT_EXIT .include "words/name2flags.asm" ; Tools ; get the flags from a name token VE_NAME2FLAGS: 00012d ff0a .dw $ff0a 00012e 616e 00012f 656d 000130 663e 000131 616c 000132 7367 .db "name>flags" 000133 0116 .dw VE_HEAD .set VE_HEAD = VE_NAME2FLAGS XT_NAME2FLAGS: 000134 3800 .dw DO_COLON PFA_NAME2FLAGS: 000135 3bca .dw XT_FETCHI ; skip to link field 000136 383c .dw XT_DOLITERAL 000137 ff00 .dw $ff00 000138 3a12 .dw XT_AND 000139 381f .dw XT_EXIT .if AMFORTH_NRWW_SIZE > 8000 .elif AMFORTH_NRWW_SIZE > 4000 .include "dict/appl_4k.inc" ; Tools ; print the version string .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DOT_VER: 00013a ff03 .dw $ff03 00013b 6576 ../../common\words/ver.asm(12): warning: .cseg .db misalignment - padding zero byte 00013c 0072 .db "ver" 00013d 012d .dw VE_HEAD .set VE_HEAD = VE_DOT_VER XT_DOT_VER: 00013e 3800 .dw DO_COLON PFA_DOT_VER: .endif 00013f 029f .dw XT_ENV_FORTHNAME 000140 03c8 .dw XT_ITYPE 000141 3fad .dw XT_SPACE 000142 3ebc .dw XT_BASE 000143 3878 .dw XT_FETCH 000144 02ad .dw XT_ENV_FORTHVERSION 000145 3f40 .dw XT_DECIMAL 000146 3fc6 .dw XT_S2D 000147 02e6 .dw XT_L_SHARP 000148 02ee .dw XT_SHARP 000149 383c .dw XT_DOLITERAL 00014a 002e .dw '.' 00014b 02d7 .dw XT_HOLD 00014c 0304 .dw XT_SHARP_S 00014d 030f .dw XT_SHARP_G 00014e 03fe .dw XT_TYPE 00014f 3ebc .dw XT_BASE 000150 3880 .dw XT_STORE 000151 3fad .dw XT_SPACE 000152 02b5 .dw XT_ENV_CPU 000153 03c8 .dw XT_ITYPE 000154 381f .dw XT_EXIT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .include "words/noop.asm" ; Tools ; do nothing .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_NOOP: 000155 ff04 .dw $ff04 000156 6f6e 000157 706f .db "noop" 000158 013a .dw VE_HEAD .set VE_HEAD = VE_NOOP XT_NOOP: 000159 3800 .dw DO_COLON PFA_NOOP: .endif 00015a 381f .DW XT_EXIT .include "words/unused.asm" ; Tools ; Amount of available RAM (incl. PAD) VE_UNUSED: 00015b ff06 .dw $ff06 00015c 6e75 00015d 7375 00015e 6465 .db "unused" 00015f 0155 .dw VE_HEAD .set VE_HEAD = VE_UNUSED XT_UNUSED: 000160 3800 .dw DO_COLON PFA_UNUSED: 000161 3a8c .dw XT_SP_FETCH 000162 3f22 .dw XT_HERE 000163 3992 .dw XT_MINUS 000164 381f .dw XT_EXIT .include "words/to.asm" ; Tools ; store the TOS to the named value (eeprom cell) .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_TO: 000165 0002 .dw $0002 000166 6f74 .db "to" 000167 015b .dw VE_HEAD .set VE_HEAD = VE_TO XT_TO: 000168 3800 .dw DO_COLON PFA_TO: .endif 000169 040d .dw XT_TICK 00016a 3fcf .dw XT_TO_BODY 00016b 3eb6 .dw XT_STATE 00016c 3878 .dw XT_FETCH 00016d 3835 .dw XT_DOCONDBRANCH 00016e 0179 DEST(PFA_TO1) 00016f 0721 .dw XT_COMPILE 000170 0173 .dw XT_DOTO 000171 072c .dw XT_COMMA 000172 381f .dw XT_EXIT ; ( n -- ) (R: IP -- IP+1) ; Tools ; runtime portion of to ;VE_DOTO: ; .dw $ff04 ; .db "(to)" ; .dw VE_HEAD ; .set VE_HEAD = VE_DOTO .if cpu_msp430==1 .endif .if cpu_avr8==1 XT_DOTO: 000173 3800 .dw DO_COLON PFA_DOTO: .endif 000174 38f5 .dw XT_R_FROM 000175 38b0 .dw XT_DUP 000176 0185 .dw XT_ICELLPLUS 000177 38fe .dw XT_TO_R 000178 3bca .dw XT_FETCHI PFA_TO1: 000179 38b0 .dw XT_DUP 00017a 0185 .dw XT_ICELLPLUS 00017b 0185 .dw XT_ICELLPLUS 00017c 3bca .dw XT_FETCHI 00017d 3829 .dw XT_EXECUTE 00017e 381f .dw XT_EXIT .include "words/i-cellplus.asm" ; Compiler ; skip to the next cell in flash VE_ICELLPLUS: 00017f ff07 .dw $FF07 000180 2d69 000181 6563 000182 6c6c 000183 002b .db "i-cell+",0 000184 0165 .dw VE_HEAD .set VE_HEAD = VE_ICELLPLUS XT_ICELLPLUS: 000185 3800 .dw DO_COLON PFA_ICELLPLUS: 000186 3a2e .dw XT_1PLUS 000187 381f .dw XT_EXIT .include "words/icompare.asm" ; Tools ; compares string in RAM with string in flash. f is zero if equal like COMPARE VE_ICOMPARE: 000188 ff08 .dw $ff08 000189 6369 00018a 6d6f 00018b 6170 00018c 6572 .db "icompare" 00018d 017f .dw VE_HEAD .set VE_HEAD = VE_ICOMPARE XT_ICOMPARE: 00018e 3800 .dw DO_COLON PFA_ICOMPARE: 00018f 38fe .dw XT_TO_R ; ( -- r-addr r-len f-addr) 000190 38ce .dw XT_OVER ; ( -- r-addr r-len f-addr r-len) 000191 38f5 .dw XT_R_FROM ; ( -- r-addr r-len f-addr r-len f-len ) 000192 3912 .dw XT_NOTEQUAL ; ( -- r-addr r-len f-addr flag ) 000193 3835 .dw XT_DOCONDBRANCH 000194 0199 .dw PFA_ICOMPARE_SAMELEN 000195 3ed1 .dw XT_2DROP 000196 38d8 .dw XT_DROP 000197 394a .dw XT_TRUE 000198 381f .dw XT_EXIT PFA_ICOMPARE_SAMELEN: 000199 38c3 .dw XT_SWAP ; ( -- r-addr f-addr len ) 00019a 3953 .dw XT_ZERO 00019b 07eb .dw XT_QDOCHECK 00019c 3835 .dw XT_DOCONDBRANCH 00019d 01be .dw PFA_ICOMPARE_DONE 00019e 3a9a .dw XT_DODO PFA_ICOMPARE_LOOP: ; ( r-addr f-addr --) 00019f 38ce .dw XT_OVER 0001a0 3878 .dw XT_FETCH .if WANT_IGNORECASE == 1 0001a1 01c1 .dw XT_ICOMPARE_LC .endif 0001a2 38ce .dw XT_OVER 0001a3 3bca .dw XT_FETCHI ; ( -- r-addr f-addr r-cc f- cc) .if WANT_IGNORECASE == 1 0001a4 01c1 .dw XT_ICOMPARE_LC .endif ; flash strings are zero-padded at the last cell ; that means: if the flash cell is less $0100, than mask the ; high byte in the ram cell 0001a5 38b0 .dw XT_DUP ;.dw XT_BYTESWAP 0001a6 383c .dw XT_DOLITERAL 0001a7 0100 .dw $100 0001a8 395b .dw XT_ULESS 0001a9 3835 .dw XT_DOCONDBRANCH 0001aa 01af .dw PFA_ICOMPARE_LASTCELL 0001ab 38c3 .dw XT_SWAP 0001ac 383c .dw XT_DOLITERAL 0001ad 00ff .dw $00FF 0001ae 3a12 .dw XT_AND ; the final swap can be omitted PFA_ICOMPARE_LASTCELL: 0001af 3912 .dw XT_NOTEQUAL 0001b0 3835 .dw XT_DOCONDBRANCH 0001b1 01b6 .dw PFA_ICOMPARE_NEXTLOOP 0001b2 3ed1 .dw XT_2DROP 0001b3 394a .dw XT_TRUE 0001b4 3ad3 .dw XT_UNLOOP 0001b5 381f .dw XT_EXIT PFA_ICOMPARE_NEXTLOOP: 0001b6 3a2e .dw XT_1PLUS 0001b7 38c3 .dw XT_SWAP 0001b8 3c8f .dw XT_CELLPLUS 0001b9 38c3 .dw XT_SWAP 0001ba 383c .dw XT_DOLITERAL 0001bb 0002 .dw 2 0001bc 3ab9 .dw XT_DOPLUSLOOP 0001bd 019f .dw PFA_ICOMPARE_LOOP PFA_ICOMPARE_DONE: 0001be 3ed1 .dw XT_2DROP 0001bf 3953 .dw XT_ZERO 0001c0 381f .dw XT_EXIT .if WANT_IGNORECASE == 1 ; ( cc1 cc2 -- f) ; Tools ; compares two packed characters ;VE_ICOMPARELC: ; .dw $ff08 ; .db "icompare-lower" ; .dw VE_HEAD ; .set VE_HEAD = VE_ICOMPARELC XT_ICOMPARE_LC: 0001c1 3800 .dw DO_COLON PFA_ICOMPARE_LC: 0001c2 38b0 .dw XT_DUP 0001c3 383c .dw XT_DOLITERAL 0001c4 00ff .dw $00ff 0001c5 3a12 .dw XT_AND 0001c6 3f78 .dw XT_TOLOWER 0001c7 38c3 .dw XT_SWAP 0001c8 3af8 .dw XT_BYTESWAP 0001c9 383c .dw XT_DOLITERAL 0001ca 00ff .dw $00ff 0001cb 3a12 .dw XT_AND 0001cc 3f78 .dw XT_TOLOWER 0001cd 3af8 .dw XT_BYTESWAP 0001ce 3a1b .dw XT_OR 0001cf 381f .dw XT_EXIT .endif .include "words/star.asm" ; Arithmetics ; multiply routine .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_STAR: 0001d0 ff01 .dw $ff01 0001d1 002a .db "*",0 0001d2 0188 .dw VE_HEAD .set VE_HEAD = VE_STAR XT_STAR: 0001d3 3800 .dw DO_COLON PFA_STAR: .endif 0001d4 39a5 .dw XT_MSTAR 0001d5 38d8 .dw XT_DROP 0001d6 381f .dw XT_EXIT .include "words/j.asm" ; Compiler ; loop counter of outer loop VE_J: 0001d7 ff01 .dw $FF01 0001d8 006a .db "j",0 0001d9 01d0 .dw VE_HEAD .set VE_HEAD = VE_J XT_J: 0001da 3800 .dw DO_COLON PFA_J: 0001db 3a75 .dw XT_RP_FETCH 0001dc 383c .dw XT_DOLITERAL 0001dd 0007 .dw 7 0001de 399c .dw XT_PLUS 0001df 3878 .dw XT_FETCH 0001e0 3a75 .dw XT_RP_FETCH 0001e1 383c .dw XT_DOLITERAL 0001e2 0009 .dw 9 0001e3 399c .dw XT_PLUS 0001e4 3878 .dw XT_FETCH 0001e5 399c .dw XT_PLUS 0001e6 381f .dw XT_EXIT .include "words/dabs.asm" ; Arithmetics ; double cell absolute value VE_DABS: 0001e7 ff04 .dw $ff04 0001e8 6164 0001e9 7362 .db "dabs" 0001ea 01d7 .dw VE_HEAD .set VE_HEAD = VE_DABS XT_DABS: 0001eb 3800 .dw DO_COLON PFA_DABS: 0001ec 38b0 .dw XT_DUP 0001ed 3920 .dw XT_ZEROLESS 0001ee 3835 .dw XT_DOCONDBRANCH 0001ef 01f1 .dw PFA_DABS1 0001f0 01f8 .dw XT_DNEGATE PFA_DABS1: 0001f1 381f .dw XT_EXIT ; : dabs ( ud1 -- +d2 ) dup 0< if dnegate then ; .include "words/dnegate.asm" ; Arithmetics ; double cell negation VE_DNEGATE: 0001f2 ff07 .dw $ff07 0001f3 6e64 0001f4 6765 0001f5 7461 0001f6 0065 .db "dnegate",0 0001f7 01e7 .dw VE_HEAD .set VE_HEAD = VE_DNEGATE XT_DNEGATE: 0001f8 3800 .dw DO_COLON PFA_DNEGATE: 0001f9 3c3a .dw XT_DINVERT 0001fa 3fe5 .dw XT_ONE 0001fb 3953 .dw XT_ZERO 0001fc 3c14 .dw XT_DPLUS 0001fd 381f .dw XT_EXIT ; : dnegate ( ud1 -- ud2 ) dinvert 1. d+ ; .include "words/cmove.asm" ; Memory ; copy data in RAM, from lower to higher addresses VE_CMOVE: 0001fe ff05 .dw $ff05 0001ff 6d63 000200 766f 000201 0065 .db "cmove",0 000202 01f2 .dw VE_HEAD .set VE_HEAD = VE_CMOVE XT_CMOVE: 000203 0204 .dw PFA_CMOVE PFA_CMOVE: 000204 93bf push xh 000205 93af push xl 000206 91e9 ld zl, Y+ 000207 91f9 ld zh, Y+ ; addr-to 000208 91a9 ld xl, Y+ 000209 91b9 ld xh, Y+ ; addr-from 00020a 2f09 mov temp0, tosh 00020b 2b08 or temp0, tosl 00020c f021 brbs 1, PFA_CMOVE1 PFA_CMOVE2: 00020d 911d ld temp1, X+ 00020e 9311 st Z+, temp1 00020f 9701 sbiw tosl, 1 000210 f7e1 brbc 1, PFA_CMOVE2 PFA_CMOVE1: 000211 91af pop xl 000212 91bf pop xh 000213 9189 000214 9199 loadtos 000215 940c 3804 jmp_ DO_NEXT .include "words/2swap.asm" ; Stack ; Exchange the two top cell pairs .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_2SWAP: 000217 ff05 .dw $ff05 000218 7332 000219 6177 00021a 0070 .db "2swap",0 00021b 01fe .dw VE_HEAD .set VE_HEAD = VE_2SWAP XT_2SWAP: 00021c 3800 .dw DO_COLON PFA_2SWAP: .endif 00021d 38e0 .dw XT_ROT 00021e 38fe .dw XT_TO_R 00021f 38e0 .dw XT_ROT 000220 38f5 .dw XT_R_FROM 000221 381f .dw XT_EXIT .include "words/tib.asm" ; System ; refills the input buffer .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_REFILLTIB: 000222 ff0a .dw $ff0a 000223 6572 000224 6966 000225 6c6c 000226 742d 000227 6269 .db "refill-tib" 000228 0217 .dw VE_HEAD .set VE_HEAD = VE_REFILLTIB XT_REFILLTIB: 000229 3800 .dw DO_COLON PFA_REFILLTIB: .endif 00022a 0245 .dw XT_TIB 00022b 383c .dw XT_DOLITERAL 00022c 005a .dw TIB_SIZE 00022d 045d .dw XT_ACCEPT 00022e 024b .dw XT_NUMBERTIB 00022f 3880 .dw XT_STORE 000230 3953 .dw XT_ZERO 000231 3ee1 .dw XT_TO_IN 000232 3880 .dw XT_STORE 000233 394a .dw XT_TRUE ; -1 000234 381f .dw XT_EXIT ; ( -- addr n ) ; System ; address and current length of the input buffer .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SOURCETIB: 000235 ff0a .dw $FF0A 000236 6f73 000237 7275 000238 6563 000239 742d 00023a 6269 .db "source-tib" 00023b 0222 .dw VE_HEAD .set VE_HEAD = VE_SOURCETIB XT_SOURCETIB: 00023c 3800 .dw DO_COLON PFA_SOURCETIB: .endif 00023d 0245 .dw XT_TIB 00023e 024b .dw XT_NUMBERTIB 00023f 3878 .dw XT_FETCH 000240 381f .dw XT_EXIT ; ( -- addr ) ; System Variable ; terminal input buffer address .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_TIB: 000241 ff03 .dw $ff03 000242 6974 000243 0062 .db "tib",0 000244 0235 .dw VE_HEAD .set VE_HEAD = VE_TIB XT_TIB: 000245 3847 .dw PFA_DOVARIABLE PFA_TIB: 000246 012c .dw ram_tib .dseg 00012c ram_tib: .byte TIB_SIZE .cseg .endif ; ( -- addr ) ; System Variable ; variable holding the number of characters in TIB .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_NUMBERTIB: 000247 ff04 .dw $ff04 000248 7423 000249 6269 .db "#tib" 00024a 0241 .dw VE_HEAD .set VE_HEAD = VE_NUMBERTIB XT_NUMBERTIB: 00024b 3847 .dw PFA_DOVARIABLE PFA_NUMBERTIB: 00024c 0186 .dw ram_sharptib .dseg 000186 ram_sharptib: .byte 2 .cseg .endif .include "words/init-ram.asm" ; Tools ; copy len cells from eeprom to ram VE_EE2RAM: 00024d ff06 .dw $ff06 00024e 6565 00024f 723e 000250 6d61 .db "ee>ram" 000251 0247 .dw VE_HEAD .set VE_HEAD = VE_EE2RAM XT_EE2RAM: 000252 3800 .dw DO_COLON PFA_EE2RAM: ; ( -- ) 000253 3953 .dw XT_ZERO 000254 3a9a .dw XT_DODO PFA_EE2RAM_1: ; ( -- e-addr r-addr ) 000255 38ce .dw XT_OVER 000256 3b5e .dw XT_FETCHE 000257 38ce .dw XT_OVER 000258 3880 .dw XT_STORE 000259 3c8f .dw XT_CELLPLUS 00025a 38c3 .dw XT_SWAP 00025b 3c8f .dw XT_CELLPLUS 00025c 38c3 .dw XT_SWAP 00025d 3ac8 .dw XT_DOLOOP 00025e 0255 .dw PFA_EE2RAM_1 PFA_EE2RAM_2: 00025f 3ed1 .dw XT_2DROP 000260 381f .dw XT_EXIT ; ( -- ) ; Tools ; setup the default user area from eeprom VE_INIT_RAM: 000261 ff08 .dw $ff08 000262 6e69 000263 7469 000264 722d 000265 6d61 .db "init-ram" 000266 024d .dw VE_HEAD .set VE_HEAD = VE_INIT_RAM XT_INIT_RAM: 000267 3800 .dw DO_COLON PFA_INI_RAM: ; ( -- ) 000268 383c .dw XT_DOLITERAL 000269 006a .dw EE_INITUSER 00026a 3b01 .dw XT_UP_FETCH 00026b 383c .dw XT_DOLITERAL 00026c 0022 .dw SYSUSERSIZE 00026d 3a03 .dw XT_2SLASH 00026e 0252 .dw XT_EE2RAM 00026f 381f .dw XT_EXIT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .include "words/environment.asm" ; System Value ; word list identifier of the environmental search list VE_ENVIRONMENT: 000270 ff0b .dw $ff0b 000271 6e65 000272 6976 000273 6f72 000274 6d6e 000275 6e65 000276 0074 .db "environment",0 000277 0261 .dw VE_HEAD .set VE_HEAD = VE_ENVIRONMENT XT_ENVIRONMENT: 000278 3847 .dw PFA_DOVARIABLE PFA_ENVIRONMENT: 000279 0044 .dw CFG_ENVIRONMENT .include "words/env-wordlists.asm" ; Environment ; maximum number of wordlists in the dictionary search order VE_ENVWORDLISTS: 00027a ff09 .dw $ff09 00027b 6f77 00027c 6472 00027d 696c 00027e 7473 00027f 0073 .db "wordlists",0 000280 0000 .dw VE_ENVHEAD .set VE_ENVHEAD = VE_ENVWORDLISTS XT_ENVWORDLISTS: 000281 3800 .dw DO_COLON PFA_ENVWORDLISTS: 000282 383c .dw XT_DOLITERAL 000283 0008 .dw NUMWORDLISTS 000284 381f .dw XT_EXIT .include "words/env-slashpad.asm" ; Environment ; Size of the PAD buffer in bytes VE_ENVSLASHPAD: 000285 ff04 .dw $ff04 000286 702f 000287 6461 .db "/pad" 000288 027a .dw VE_ENVHEAD .set VE_ENVHEAD = VE_ENVSLASHPAD XT_ENVSLASHPAD: 000289 3800 .dw DO_COLON PFA_ENVSLASHPAD: 00028a 3a8c .dw XT_SP_FETCH 00028b 3ee7 .dw XT_PAD 00028c 3992 .dw XT_MINUS 00028d 381f .dw XT_EXIT .include "words/env-slashhold.asm" ; Environment ; size of the pictured numeric output buffer in bytes .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_ENVSLASHHOLD: 00028e ff05 .dw $ff05 00028f 682f 000290 6c6f 000291 0064 .db "/hold",0 000292 0285 .dw VE_ENVHEAD .set VE_ENVHEAD = VE_ENVSLASHHOLD XT_ENVSLASHHOLD: 000293 3800 .dw DO_COLON PFA_ENVSLASHHOLD: .endif 000294 3ee7 .dw XT_PAD 000295 3f22 .dw XT_HERE 000296 3992 .dw XT_MINUS 000297 381f .dw XT_EXIT .include "words/env-forthname.asm" ; Environment ; flash address of the amforth name string .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_ENV_FORTHNAME: 000298 ff0a .dw $ff0a 000299 6f66 00029a 7472 00029b 2d68 00029c 616e 00029d 656d .db "forth-name" 00029e 028e .dw VE_ENVHEAD .set VE_ENVHEAD = VE_ENV_FORTHNAME XT_ENV_FORTHNAME: 00029f 3800 .dw DO_COLON PFA_EN_FORTHNAME: 0002a0 0395 .dw XT_DOSLITERAL 0002a1 0007 .dw 7 .endif 0002a2 6d61 0002a3 6f66 0002a4 7472 ../../common\words/env-forthname.asm(22): warning: .cseg .db misalignment - padding zero byte 0002a5 0068 .db "amforth" .if cpu_msp430==1 .endif 0002a6 381f .dw XT_EXIT .include "words/env-forthversion.asm" ; Environment ; version number of amforth .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_ENV_FORTHVERSION: 0002a7 ff07 .dw $ff07 0002a8 6576 0002a9 7372 0002aa 6f69 0002ab 006e .db "version",0 0002ac 0298 .dw VE_ENVHEAD .set VE_ENVHEAD = VE_ENV_FORTHVERSION XT_ENV_FORTHVERSION: 0002ad 3800 .dw DO_COLON PFA_EN_FORTHVERSION: .endif 0002ae 383c .dw XT_DOLITERAL 0002af 0041 .dw 65 0002b0 381f .dw XT_EXIT .include "words/env-cpu.asm" ; Environment ; flash address of the CPU identification string .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_ENV_CPU: 0002b1 ff03 .dw $ff03 0002b2 7063 0002b3 0075 .db "cpu",0 0002b4 02a7 .dw VE_ENVHEAD .set VE_ENVHEAD = VE_ENV_CPU XT_ENV_CPU: 0002b5 3800 .dw DO_COLON PFA_EN_CPU: .endif 0002b6 383c .dw XT_DOLITERAL 0002b7 0037 .dw mcu_name 0002b8 03f4 .dw XT_ICOUNT 0002b9 381f .dw XT_EXIT .include "words/env-mcuinfo.asm" ; Environment ; flash address of some CPU specific parameters VE_ENV_MCUINFO: 0002ba ff08 .dw $ff08 0002bb 636d 0002bc 2d75 0002bd 6e69 0002be 6f66 .db "mcu-info" 0002bf 02b1 .dw VE_ENVHEAD .set VE_ENVHEAD = VE_ENV_MCUINFO XT_ENV_MCUINFO: 0002c0 3800 .dw DO_COLON PFA_EN_MCUINFO: 0002c1 383c .dw XT_DOLITERAL 0002c2 0033 .dw mcu_info 0002c3 381f .dw XT_EXIT .include "words/env-usersize.asm" ; Environment ; size of the USER area in bytes .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_ENVUSERSIZE: 0002c4 ff05 .dw $ff05 0002c5 752f 0002c6 6573 0002c7 0072 .db "/user",0 0002c8 02ba .dw VE_ENVHEAD .set VE_ENVHEAD = VE_ENVUSERSIZE XT_ENVUSERSIZE: 0002c9 3800 .dw DO_COLON PFA_ENVUSERSIZE: .endif 0002ca 383c .dw XT_DOLITERAL 0002cb 002c .dw SYSUSERSIZE + APPUSERSIZE 0002cc 381f .dw XT_EXIT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .include "words/hld.asm" ; Numeric IO ; pointer to current write position in the Pictured Numeric Output buffer VE_HLD: 0002cd ff03 .dw $ff03 0002ce 6c68 0002cf 0064 .db "hld",0 0002d0 0270 .dw VE_HEAD .set VE_HEAD = VE_HLD XT_HLD: 0002d1 3847 .dw PFA_DOVARIABLE PFA_HLD: 0002d2 0188 .dw ram_hld .dseg 000188 ram_hld: .byte 2 .cseg .include "words/hold.asm" ; Numeric IO ; prepend character to pictured numeric output buffer .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_HOLD: 0002d3 ff04 .dw $ff04 0002d4 6f68 0002d5 646c .db "hold" 0002d6 02cd .dw VE_HEAD .set VE_HEAD = VE_HOLD XT_HOLD: 0002d7 3800 .dw DO_COLON PFA_HOLD: .endif 0002d8 02d1 .dw XT_HLD 0002d9 38b0 .dw XT_DUP 0002da 3878 .dw XT_FETCH 0002db 3a34 .dw XT_1MINUS 0002dc 38b0 .dw XT_DUP 0002dd 38fe .dw XT_TO_R 0002de 38c3 .dw XT_SWAP 0002df 3880 .dw XT_STORE 0002e0 38f5 .dw XT_R_FROM 0002e1 388c .dw XT_CSTORE 0002e2 381f .dw XT_EXIT .include "words/less-sharp.asm" ; <# ; Numeric IO ; initialize the pictured numeric output conversion process .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_L_SHARP: 0002e3 ff02 .dw $ff02 0002e4 233c .db "<#" 0002e5 02d3 .dw VE_HEAD .set VE_HEAD = VE_L_SHARP XT_L_SHARP: 0002e6 3800 .dw DO_COLON PFA_L_SHARP: .endif 0002e7 3ee7 .dw XT_PAD 0002e8 02d1 .dw XT_HLD 0002e9 3880 .dw XT_STORE 0002ea 381f .dw XT_EXIT .include "words/sharp.asm" ; Numeric IO ; pictured numeric output: convert one digit .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SHARP: 0002eb ff01 .dw $ff01 0002ec 0023 .db "#",0 0002ed 02e3 .dw VE_HEAD .set VE_HEAD = VE_SHARP XT_SHARP: 0002ee 3800 .dw DO_COLON PFA_SHARP: .endif 0002ef 3ebc .dw XT_BASE 0002f0 3878 .dw XT_FETCH 0002f1 036b .dw XT_UDSLASHMOD 0002f2 38e0 .dw XT_ROT 0002f3 383c .dw XT_DOLITERAL 0002f4 0009 .dw 9 0002f5 38ce .dw XT_OVER 0002f6 396d .dw XT_LESS 0002f7 3835 .dw XT_DOCONDBRANCH 0002f8 02fc DEST(PFA_SHARP1) 0002f9 383c .dw XT_DOLITERAL 0002fa 0007 .dw 7 0002fb 399c .dw XT_PLUS PFA_SHARP1: 0002fc 383c .dw XT_DOLITERAL 0002fd 0030 .dw 48 ; ASCII 0 0002fe 399c .dw XT_PLUS 0002ff 02d7 .dw XT_HOLD 000300 381f .dw XT_EXIT ; : # ( ud1 -- ud2 ) ; base @ ud/mod rot 9 over < if 7 + then 30 + hold ; .include "words/sharp-s.asm" ; Numeric IO ; pictured numeric output: convert all digits until 0 (zero) is reached .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SHARP_S: 000301 ff02 .dw $ff02 000302 7323 .db "#s" 000303 02eb .dw VE_HEAD .set VE_HEAD = VE_SHARP_S XT_SHARP_S: 000304 3800 .dw DO_COLON PFA_SHARP_S: .endif NUMS1: 000305 02ee .dw XT_SHARP 000306 3ec8 .dw XT_2DUP 000307 3a1b .dw XT_OR 000308 3919 .dw XT_ZEROEQUAL 000309 3835 .dw XT_DOCONDBRANCH 00030a 0305 DEST(NUMS1) ; PFA_SHARP_S 00030b 381f .dw XT_EXIT .include "words/sharp-greater.asm" ; #> ; Numeric IO ; Pictured Numeric Output: convert PNO buffer into an string .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SHARP_G: 00030c ff02 .dw $ff02 00030d 3e23 .db "#>" 00030e 0301 .dw VE_HEAD .set VE_HEAD = VE_SHARP_G XT_SHARP_G: 00030f 3800 .dw DO_COLON PFA_SHARP_G: .endif 000310 3ed1 .dw XT_2DROP 000311 02d1 .dw XT_HLD 000312 3878 .dw XT_FETCH 000313 3ee7 .dw XT_PAD 000314 38ce .dw XT_OVER 000315 3992 .dw XT_MINUS 000316 381f .dw XT_EXIT .include "words/sign.asm" ; Numeric IO ; place a - in HLD if n is negative .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SIGN: 000317 ff04 .dw $ff04 000318 6973 000319 6e67 .db "sign" 00031a 030c .dw VE_HEAD .set VE_HEAD = VE_SIGN XT_SIGN: 00031b 3800 .dw DO_COLON PFA_SIGN: .endif 00031c 3920 .dw XT_ZEROLESS 00031d 3835 .dw XT_DOCONDBRANCH 00031e 0322 DEST(PFA_SIGN1) 00031f 383c .dw XT_DOLITERAL 000320 002d .dw 45 ; ascii - 000321 02d7 .dw XT_HOLD PFA_SIGN1: 000322 381f .dw XT_EXIT .include "words/d-dot-r.asm" ; Numeric IO ; singed PNO with double cell numbers, right aligned in width w .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DDOTR: 000323 ff03 .dw $ff03 000324 2e64 000325 0072 .db "d.r",0 000326 0317 .dw VE_HEAD .set VE_HEAD = VE_DDOTR XT_DDOTR: 000327 3800 .dw DO_COLON PFA_DDOTR: .endif 000328 38fe .dw XT_TO_R 000329 3ed9 .dw XT_TUCK 00032a 01eb .dw XT_DABS 00032b 02e6 .dw XT_L_SHARP 00032c 0304 .dw XT_SHARP_S 00032d 38e0 .dw XT_ROT 00032e 031b .dw XT_SIGN 00032f 030f .dw XT_SHARP_G 000330 38f5 .dw XT_R_FROM 000331 38ce .dw XT_OVER 000332 3992 .dw XT_MINUS 000333 3fb6 .dw XT_SPACES 000334 03fe .dw XT_TYPE 000335 381f .dw XT_EXIT ; : d.r ( d n -- ) ; >r swap over dabs <# #s rot sign #> r> over - spaces type ; .include "words/dot-r.asm" ; Numeric IO ; singed PNO with single cell numbers, right aligned in width w .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DOTR: 000336 ff02 .dw $ff02 000337 722e .db ".r" 000338 0323 .dw VE_HEAD .set VE_HEAD = VE_DOTR XT_DOTR: 000339 3800 .dw DO_COLON PFA_DOTR: .endif 00033a 38fe .dw XT_TO_R 00033b 3fc6 .dw XT_S2D 00033c 38f5 .dw XT_R_FROM 00033d 0327 .dw XT_DDOTR 00033e 381f .dw XT_EXIT ; : .r ( s n -- ) >r s>d r> d.r ; .include "words/d-dot.asm" ; Numeric IO ; singed PNO with double cell numbers .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DDOT: 00033f ff02 .dw $ff02 000340 2e64 .db "d." 000341 0336 .dw VE_HEAD .set VE_HEAD = VE_DDOT XT_DDOT: 000342 3800 .dw DO_COLON PFA_DDOT: .endif 000343 3953 .dw XT_ZERO 000344 0327 .dw XT_DDOTR 000345 3fad .dw XT_SPACE 000346 381f .dw XT_EXIT ; : d. ( d -- ) 0 d.r space ; .include "words/dot.asm" ; Numeric IO ; singed PNO with single cell numbers .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DOT: 000347 ff01 .dw $ff01 000348 002e .db ".",0 000349 033f .dw VE_HEAD .set VE_HEAD = VE_DOT XT_DOT: 00034a 3800 .dw DO_COLON PFA_DOT: .endif 00034b 3fc6 .dw XT_S2D 00034c 0342 .dw XT_DDOT 00034d 381f .dw XT_EXIT ; : . ( s -- ) s>d d. ; .include "words/ud-dot.asm" ; Numeric IO ; unsigned PNO with double cell numbers .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_UDDOT: 00034e ff03 .dw $ff03 00034f 6475 000350 002e .db "ud.",0 000351 0347 .dw VE_HEAD .set VE_HEAD = VE_UDDOT XT_UDDOT: 000352 3800 .dw DO_COLON PFA_UDDOT: .endif 000353 3953 .dw XT_ZERO 000354 035b .dw XT_UDDOTR 000355 3fad .dw XT_SPACE 000356 381f .dw XT_EXIT .include "words/ud-dot-r.asm" ; Numeric IO ; unsigned PNO with double cell numbers, right aligned in width w .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_UDDOTR: 000357 ff04 .dw $ff04 000358 6475 000359 722e .db "ud.r" 00035a 034e .dw VE_HEAD .set VE_HEAD = VE_UDDOTR XT_UDDOTR: 00035b 3800 .dw DO_COLON PFA_UDDOTR: .endif 00035c 38fe .dw XT_TO_R 00035d 02e6 .dw XT_L_SHARP 00035e 0304 .dw XT_SHARP_S 00035f 030f .dw XT_SHARP_G 000360 38f5 .dw XT_R_FROM 000361 38ce .dw XT_OVER 000362 3992 .dw XT_MINUS 000363 3fb6 .dw XT_SPACES 000364 03fe .dw XT_TYPE 000365 381f .dw XT_EXIT .include "words/ud-slash-mod.asm" ; Arithmetics ; unsigned double cell division with remainder .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_UDSLASHMOD: 000366 ff06 .dw $ff06 000367 6475 000368 6d2f 000369 646f .db "ud/mod" 00036a 0357 .dw VE_HEAD .set VE_HEAD = VE_UDSLASHMOD XT_UDSLASHMOD: 00036b 3800 .dw DO_COLON PFA_UDSLASHMOD: .endif 00036c 38fe .dw XT_TO_R 00036d 3953 .dw XT_ZERO 00036e 3907 .dw XT_R_FETCH 00036f 39c1 .dw XT_UMSLASHMOD 000370 38f5 .dw XT_R_FROM 000371 38c3 .dw XT_SWAP 000372 38fe .dw XT_TO_R 000373 39c1 .dw XT_UMSLASHMOD 000374 38f5 .dw XT_R_FROM 000375 381f .dw XT_EXIT .include "words/digit-q.asm" ; Numeric IO ; tries to convert a character to a number, set flag accordingly .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DIGITQ: 000376 ff06 .dw $ff06 000377 6964 000378 6967 000379 3f74 .db "digit?" 00037a 0366 .dw VE_HEAD .set VE_HEAD = VE_DIGITQ XT_DIGITQ: 00037b 3800 .dw DO_COLON PFA_DIGITQ: .endif 00037c 3f65 .dw XT_TOUPPER 00037d 38b0 00037e 383c 00037f 0039 000380 3977 000381 383c 000382 0100 .DW XT_DUP,XT_DOLITERAL,57,XT_GREATER,XT_DOLITERAL,256 000383 3a12 000384 399c 000385 38b0 000386 383c 000387 0140 000388 3977 .DW XT_AND,XT_PLUS,XT_DUP,XT_DOLITERAL,320,XT_GREATER 000389 383c 00038a 0107 00038b 3a12 00038c 3992 00038d 383c 00038e 0030 .DW XT_DOLITERAL,263,XT_AND,XT_MINUS,XT_DOLITERAL,48 00038f 3992 000390 38b0 000391 3ebc 000392 3878 000393 395b .DW XT_MINUS,XT_DUP,XT_BASE,XT_FETCH,XT_ULESS 000394 381f .DW XT_EXIT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .include "words/do-sliteral.asm" ; String ; runtime portion of sliteral ;VE_DOSLITERAL: ; .dw $ff0a ; .db "(sliteral)" ; .dw VE_HEAD ; .set VE_HEAD = VE_DOSLITERAL XT_DOSLITERAL: 000395 3800 .dw DO_COLON PFA_DOSLITERAL: 000396 3907 .dw XT_R_FETCH ; ( -- addr ) 000397 03f4 .dw XT_ICOUNT 000398 38f5 .dw XT_R_FROM 000399 38ce .dw XT_OVER ; ( -- addr' n addr n) 00039a 3a2e .dw XT_1PLUS 00039b 3a03 .dw XT_2SLASH ; ( -- addr' n addr k ) 00039c 399c .dw XT_PLUS ; ( -- addr' n addr'' ) 00039d 3a2e .dw XT_1PLUS 00039e 38fe .dw XT_TO_R ; ( -- ) 00039f 381f .dw XT_EXIT .include "words/scomma.asm" ; Compiler ; compiles a string from RAM to Flash VE_SCOMMA: 0003a0 ff02 .dw $ff02 0003a1 2c73 .db "s",$2c 0003a2 0376 .dw VE_HEAD .set VE_HEAD = VE_SCOMMA XT_SCOMMA: 0003a3 3800 .dw DO_COLON PFA_SCOMMA: 0003a4 38b0 .dw XT_DUP 0003a5 03a7 .dw XT_DOSCOMMA 0003a6 381f .dw XT_EXIT ; ( addr len len' -- ) ; Compiler ; compiles a string from RAM to Flash ;VE_DOSCOMMA: ; .dw $ff04 ; .db "(s",$2c,")" ; .dw VE_HEAD ; .set VE_HEAD = VE_DOSCOMMA XT_DOSCOMMA: 0003a7 3800 .dw DO_COLON PFA_DOSCOMMA: 0003a8 072c .dw XT_COMMA 0003a9 38b0 .dw XT_DUP ; ( --addr len len) 0003aa 3a03 .dw XT_2SLASH ; ( -- addr len len/2 0003ab 3ed9 .dw XT_TUCK ; ( -- addr len/2 len len/2 0003ac 3a0a .dw XT_2STAR ; ( -- addr len/2 len len' 0003ad 3992 .dw XT_MINUS ; ( -- addr len/2 rem 0003ae 38fe .dw XT_TO_R 0003af 3953 .dw XT_ZERO 0003b0 07eb .dw XT_QDOCHECK 0003b1 3835 .dw XT_DOCONDBRANCH 0003b2 03ba .dw PFA_SCOMMA2 0003b3 3a9a .dw XT_DODO PFA_SCOMMA1: 0003b4 38b0 .dw XT_DUP ; ( -- addr addr ) 0003b5 3878 .dw XT_FETCH ; ( -- addr c1c2 ) 0003b6 072c .dw XT_COMMA ; ( -- addr ) 0003b7 3c8f .dw XT_CELLPLUS ; ( -- addr+cell ) 0003b8 3ac8 .dw XT_DOLOOP 0003b9 03b4 .dw PFA_SCOMMA1 PFA_SCOMMA2: 0003ba 38f5 .dw XT_R_FROM 0003bb 3927 .dw XT_GREATERZERO 0003bc 3835 .dw XT_DOCONDBRANCH 0003bd 03c1 .dw PFA_SCOMMA3 0003be 38b0 .dw XT_DUP ; well, tricky 0003bf 3897 .dw XT_CFETCH 0003c0 072c .dw XT_COMMA PFA_SCOMMA3: 0003c1 38d8 .dw XT_DROP ; ( -- ) 0003c2 381f .dw XT_EXIT .include "words/itype.asm" ; Tools ; reads string from flash and prints it VE_ITYPE: 0003c3 ff05 .dw $ff05 0003c4 7469 0003c5 7079 0003c6 0065 .db "itype",0 0003c7 03a0 .dw VE_HEAD .set VE_HEAD = VE_ITYPE XT_ITYPE: 0003c8 3800 .dw DO_COLON PFA_ITYPE: 0003c9 38b0 .dw XT_DUP ; ( --addr len len) 0003ca 3a03 .dw XT_2SLASH ; ( -- addr len len/2 0003cb 3ed9 .dw XT_TUCK ; ( -- addr len/2 len len/2 0003cc 3a0a .dw XT_2STAR ; ( -- addr len/2 len len' 0003cd 3992 .dw XT_MINUS ; ( -- addr len/2 rem 0003ce 38fe .dw XT_TO_R 0003cf 3953 .dw XT_ZERO 0003d0 07eb .dw XT_QDOCHECK 0003d1 3835 .dw XT_DOCONDBRANCH 0003d2 03dc .dw PFA_ITYPE2 0003d3 3a9a .dw XT_DODO PFA_ITYPE1: 0003d4 38b0 .dw XT_DUP ; ( -- addr addr ) 0003d5 3bca .dw XT_FETCHI ; ( -- addr c1c2 ) 0003d6 38b0 .dw XT_DUP 0003d7 03e9 .dw XT_LOWEMIT 0003d8 03e5 .dw XT_HIEMIT 0003d9 3a2e .dw XT_1PLUS ; ( -- addr+cell ) 0003da 3ac8 .dw XT_DOLOOP 0003db 03d4 .dw PFA_ITYPE1 PFA_ITYPE2: 0003dc 38f5 .dw XT_R_FROM 0003dd 3927 .dw XT_GREATERZERO 0003de 3835 .dw XT_DOCONDBRANCH 0003df 03e3 .dw PFA_ITYPE3 0003e0 38b0 .dw XT_DUP ; make sure the drop below has always something to do 0003e1 3bca .dw XT_FETCHI 0003e2 03e9 .dw XT_LOWEMIT PFA_ITYPE3: 0003e3 38d8 .dw XT_DROP 0003e4 381f .dw XT_EXIT ; ( w -- ) ; R( -- ) ; content of cell fetched on stack. ;VE_HIEMIT: ; .dw $ff06 ; .db "hiemit" ; .dw VE_HEAD ; .set VE_HEAD = VE_HIEMIT XT_HIEMIT: 0003e5 3800 .dw DO_COLON PFA_HIEMIT: 0003e6 3af8 .dw XT_BYTESWAP 0003e7 03e9 .dw XT_LOWEMIT 0003e8 381f .dw XT_EXIT ; ( w -- ) ; R( -- ) ; content of cell fetched on stack. ;VE_LOWEMIT: ; .dw $ff07 ; .db "lowemit" ; .dw VE_HEAD ; .set VE_HEAD = VE_LOWEMIT XT_LOWEMIT: 0003e9 3800 .dw DO_COLON PFA_LOWEMIT: 0003ea 383c .dw XT_DOLITERAL 0003eb 00ff .dw $00ff 0003ec 3a12 .dw XT_AND 0003ed 3ef1 .dw XT_EMIT 0003ee 381f .dw XT_EXIT .include "words/icount.asm" ; Tools ; get count information out of a counted string in flash VE_ICOUNT: 0003ef ff06 .dw $ff06 0003f0 6369 0003f1 756f 0003f2 746e .db "icount" 0003f3 03c3 .dw VE_HEAD .set VE_HEAD = VE_ICOUNT XT_ICOUNT: 0003f4 3800 .dw DO_COLON PFA_ICOUNT: 0003f5 38b0 .dw XT_DUP 0003f6 3a2e .dw XT_1PLUS 0003f7 38c3 .dw XT_SWAP 0003f8 3bca .dw XT_FETCHI 0003f9 381f .dw XT_EXIT .include "words/type.asm" ; Character IO ; print a RAM based string .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_TYPE: 0003fa ff04 .dw $ff04 0003fb 7974 0003fc 6570 .db "type" 0003fd 03ef .dw VE_HEAD .set VE_HEAD = VE_TYPE XT_TYPE: 0003fe 3800 .dw DO_COLON PFA_TYPE: .endif 0003ff 3f98 .dw XT_BOUNDS 000400 07eb .dw XT_QDOCHECK 000401 3835 .dw XT_DOCONDBRANCH 000402 0409 DEST(PFA_TYPE2) 000403 3a9a .dw XT_DODO PFA_TYPE1: 000404 3aab .dw XT_I 000405 3897 .dw XT_CFETCH 000406 3ef1 .dw XT_EMIT 000407 3ac8 .dw XT_DOLOOP 000408 0404 DEST(PFA_TYPE1) PFA_TYPE2: 000409 381f .dw XT_EXIT .include "words/tick.asm" ; Dictionary ; search dictionary for name, return XT or throw an exception -13 .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_TICK: 00040a ff01 .dw $ff01 00040b 0027 .db "'",0 00040c 03fa .dw VE_HEAD .set VE_HEAD = VE_TICK XT_TICK: 00040d 3800 .dw DO_COLON PFA_TICK: .endif 00040e 0580 .dw XT_PARSENAME 00040f 05c3 .dw XT_FORTHRECOGNIZER 000410 05ce .dw XT_RECOGNIZE ; a word is tickable unless DT:TOKEN is DT:NULL or ; the interpret action is a NOOP 000411 38b0 .dw XT_DUP 000412 065b .dw XT_DT_NULL 000413 3fde .dw XT_EQUAL 000414 38c3 .dw XT_SWAP 000415 3bca .dw XT_FETCHI 000416 383c .dw XT_DOLITERAL 000417 0159 .dw XT_NOOP 000418 3fde .dw XT_EQUAL 000419 3a1b .dw XT_OR 00041a 3835 .dw XT_DOCONDBRANCH 00041b 041f DEST(PFA_TICK1) 00041c 383c .dw XT_DOLITERAL 00041d fff3 .dw -13 00041e 3d85 .dw XT_THROW PFA_TICK1: 00041f 38d8 .dw XT_DROP 000420 381f .dw XT_EXIT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .include "words/cskip.asm" ; String ; skips leading occurancies in string at addr1/n1 leaving addr2/n2 pointing to the 1st non-c character .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_CSKIP: 000421 ff05 .dw $ff05 000422 7363 000423 696b 000424 0070 .db "cskip",0 000425 040a .dw VE_HEAD .set VE_HEAD = VE_CSKIP XT_CSKIP: 000426 3800 .dw DO_COLON PFA_CSKIP: .endif 000427 38fe .dw XT_TO_R ; ( -- addr1 n1 ) PFA_CSKIP1: 000428 38b0 .dw XT_DUP ; ( -- addr' n' n' ) 000429 3835 .dw XT_DOCONDBRANCH ; ( -- addr' n') 00042a 0435 DEST(PFA_CSKIP2) 00042b 38ce .dw XT_OVER ; ( -- addr' n' addr' ) 00042c 3897 .dw XT_CFETCH ; ( -- addr' n' c' ) 00042d 3907 .dw XT_R_FETCH ; ( -- addr' n' c' c ) 00042e 3fde .dw XT_EQUAL ; ( -- addr' n' f ) 00042f 3835 .dw XT_DOCONDBRANCH ; ( -- addr' n') 000430 0435 DEST(PFA_CSKIP2) 000431 3fe5 .dw XT_ONE 000432 0571 .dw XT_SLASHSTRING 000433 382e .dw XT_DOBRANCH 000434 0428 DEST(PFA_CSKIP1) PFA_CSKIP2: 000435 38f5 .dw XT_R_FROM 000436 38d8 .dw XT_DROP ; ( -- addr2 n2) 000437 381f .dw XT_EXIT .include "words/cscan.asm" ; String ; Scan string at addr1/n1 for the first occurance of c, leaving addr1/n2, char at n2 is first non-c character .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_CSCAN: 000438 ff05 .dw $ff05 000439 7363 00043a 6163 ../../common\words/cscan.asm(12): warning: .cseg .db misalignment - padding zero byte 00043b 006e .db "cscan" 00043c 0421 .dw VE_HEAD .set VE_HEAD = VE_CSCAN XT_CSCAN: 00043d 3800 .dw DO_COLON PFA_CSCAN: .endif 00043e 38fe .dw XT_TO_R 00043f 38ce .dw XT_OVER PFA_CSCAN1: 000440 38b0 .dw XT_DUP 000441 3897 .dw XT_CFETCH 000442 3907 .dw XT_R_FETCH 000443 3fde .dw XT_EQUAL 000444 3919 .dw XT_ZEROEQUAL 000445 3835 .dw XT_DOCONDBRANCH 000446 0452 DEST(PFA_CSCAN2) 000447 38c3 .dw XT_SWAP 000448 3a34 .dw XT_1MINUS 000449 38c3 .dw XT_SWAP 00044a 38ce .dw XT_OVER 00044b 3920 .dw XT_ZEROLESS ; not negative 00044c 3919 .dw XT_ZEROEQUAL 00044d 3835 .dw XT_DOCONDBRANCH 00044e 0452 DEST(PFA_CSCAN2) 00044f 3a2e .dw XT_1PLUS 000450 382e .dw XT_DOBRANCH 000451 0440 DEST(PFA_CSCAN1) PFA_CSCAN2: 000452 38ef .dw XT_NIP 000453 38ce .dw XT_OVER 000454 3992 .dw XT_MINUS 000455 38f5 .dw XT_R_FROM 000456 38d8 .dw XT_DROP 000457 381f .dw XT_EXIT ; : my-cscan ( addr len c -- addr len' ) ; >r over ( -- addr len addr ) ; begin ; dup c@ r@ <> while ; swap 1- swap over 0 >= while ; 1+ ; repeat then ; nip over - r> drop ; ; .include "words/accept.asm" .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_ACCEPT: 000458 ff06 .dw $ff06 000459 6361 00045a 6563 00045b 7470 .db "accept" 00045c 0438 .dw VE_HEAD .set VE_HEAD = VE_ACCEPT XT_ACCEPT: 00045d 3800 .dw DO_COLON PFA_ACCEPT: .endif 00045e 38ce 00045f 399c 000460 3a34 000461 38ce .DW XT_OVER,XT_PLUS,XT_1MINUS,XT_OVER 000462 3f02 000463 38b0 000464 049e 000465 3919 000466 3835 ACC1: .DW XT_KEY,XT_DUP,XT_CRLFQ,XT_ZEROEQUAL,XT_DOCONDBRANCH 000467 0490 DEST(ACC5) 000468 38b0 000469 383c 00046a 0008 00046b 3fde 00046c 3835 .DW XT_DUP,XT_DOLITERAL,8,XT_EQUAL,XT_DOCONDBRANCH 00046d 0480 DEST(ACC3) 00046e 38d8 00046f 38e0 000470 3ec8 000471 3977 000472 38fe 000473 38e0 000474 38e0 000475 38f5 000476 3835 .DW XT_DROP,XT_ROT,XT_2DUP,XT_GREATER,XT_TO_R,XT_ROT,XT_ROT,XT_R_FROM,XT_DOCONDBRANCH 000477 047e DEST(ACC6) 000478 0496 000479 3a34 00047a 38fe 00047b 38ce 00047c 38f5 00047d 010e .DW XT_BS,XT_1MINUS,XT_TO_R,XT_OVER,XT_R_FROM,XT_UMAX 00047e 382e ACC6: .DW XT_DOBRANCH 00047f 048e DEST(ACC4) ACC3: ; check for remaining control characters, replace them with blank 000480 38b0 .dw XT_DUP ; ( -- addr k k ) 000481 3f53 .dw XT_BL 000482 396d .dw XT_LESS 000483 3835 .dw XT_DOCONDBRANCH 000484 0487 DEST(PFA_ACCEPT6) 000485 38d8 .dw XT_DROP 000486 3f53 .dw XT_BL PFA_ACCEPT6: 000487 38b0 000488 3ef1 000489 38ce 00048a 388c 00048b 3a2e 00048c 38ce 00048d 011a .DW XT_DUP,XT_EMIT,XT_OVER,XT_CSTORE,XT_1PLUS,XT_OVER,XT_UMIN 00048e 382e ACC4: .DW XT_DOBRANCH 00048f 0462 DEST(ACC1) 000490 38d8 000491 38ef 000492 38c3 000493 3992 000494 3fa0 000495 381f ACC5: .DW XT_DROP,XT_NIP,XT_SWAP,XT_MINUS,XT_CR,XT_EXIT ; ( -- ) ; System ; send a backspace character to overwrite the current char .if cpu_msp430==1 .endif .if cpu_avr8==1 ;VE_BS: ; .dw $ff02 ; .db "bs" ; .dw VE_HEAD ; .set VE_HEAD = VE_BS XT_BS: 000496 3800 .dw DO_COLON .endif 000497 383c .dw XT_DOLITERAL 000498 0008 .dw 8 000499 38b0 .dw XT_DUP 00049a 3ef1 .dw XT_EMIT 00049b 3fad .dw XT_SPACE 00049c 3ef1 .dw XT_EMIT 00049d 381f .dw XT_EXIT ; ( c -- f ) ; System ; is the character a line end character? .if cpu_msp430==1 .endif .if cpu_avr8==1 ;VE_CRLFQ: ; .dw $ff02 ; .db "crlf?" ; .dw VE_HEAD ; .set VE_HEAD = VE_CRLFQ XT_CRLFQ: 00049e 3800 .dw DO_COLON .endif 00049f 38b0 .dw XT_DUP 0004a0 383c .dw XT_DOLITERAL 0004a1 000d .dw 13 0004a2 3fde .dw XT_EQUAL 0004a3 38c3 .dw XT_SWAP 0004a4 383c .dw XT_DOLITERAL 0004a5 000a .dw 10 0004a6 3fde .dw XT_EQUAL 0004a7 3a1b .dw XT_OR 0004a8 381f .dw XT_EXIT .include "words/refill.asm" ; System ; refills the input buffer .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_REFILL: 0004a9 ff06 .dw $ff06 0004aa 6572 0004ab 6966 0004ac 6c6c .db "refill" 0004ad 0458 .dw VE_HEAD .set VE_HEAD = VE_REFILL XT_REFILL: 0004ae 3dfe .dw PFA_DODEFER1 PFA_REFILL: .endif 0004af 001a .dw USER_REFILL 0004b0 3dc7 .dw XT_UDEFERFETCH 0004b1 3dd3 .dw XT_UDEFERSTORE .include "words/char.asm" ; Tools ; copy the first character of the next word onto the stack .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_CHAR: 0004b2 ff04 .dw $ff04 0004b3 6863 0004b4 7261 .db "char" 0004b5 04a9 .dw VE_HEAD .set VE_HEAD = VE_CHAR XT_CHAR: 0004b6 3800 .dw DO_COLON PFA_CHAR: .endif 0004b7 0580 .dw XT_PARSENAME 0004b8 38d8 .dw XT_DROP 0004b9 3897 .dw XT_CFETCH 0004ba 381f .dw XT_EXIT .include "words/number.asm" ; Numeric IO ; convert a string at addr to a number .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_NUMBER: 0004bb ff06 .dw $ff06 0004bc 756e 0004bd 626d 0004be 7265 .db "number" 0004bf 04b2 .dw VE_HEAD .set VE_HEAD = VE_NUMBER XT_NUMBER: 0004c0 3800 .dw DO_COLON PFA_NUMBER: .endif 0004c1 3ebc .dw XT_BASE 0004c2 3878 .dw XT_FETCH 0004c3 38fe .dw XT_TO_R 0004c4 0504 .dw XT_QSIGN 0004c5 38fe .dw XT_TO_R 0004c6 0517 .dw XT_SET_BASE 0004c7 0504 .dw XT_QSIGN 0004c8 38f5 .dw XT_R_FROM 0004c9 3a1b .dw XT_OR 0004ca 38fe .dw XT_TO_R ; check whether something is left 0004cb 38b0 .dw XT_DUP 0004cc 3919 .dw XT_ZEROEQUAL 0004cd 3835 .dw XT_DOCONDBRANCH 0004ce 04d7 DEST(PFA_NUMBER0) ; nothing is left. It cannot be a number at all 0004cf 3ed1 .dw XT_2DROP 0004d0 38f5 .dw XT_R_FROM 0004d1 38d8 .dw XT_DROP 0004d2 38f5 .dw XT_R_FROM 0004d3 3ebc .dw XT_BASE 0004d4 3880 .dw XT_STORE 0004d5 3953 .dw XT_ZERO 0004d6 381f .dw XT_EXIT PFA_NUMBER0: 0004d7 3b1d .dw XT_2TO_R 0004d8 3953 .dw XT_ZERO ; starting value 0004d9 3953 .dw XT_ZERO 0004da 3b2c .dw XT_2R_FROM 0004db 0535 .dw XT_TO_NUMBER ; ( 0. addr len -- d addr' len' ; check length of the remaining string. ; if zero: a single cell number is entered 0004dc 38b8 .dw XT_QDUP 0004dd 3835 .dw XT_DOCONDBRANCH 0004de 04f9 DEST(PFA_NUMBER1) ; if equal 1: mayba a trailing dot? --> double cell number 0004df 3fe5 .dw XT_ONE 0004e0 3fde .dw XT_EQUAL 0004e1 3835 .dw XT_DOCONDBRANCH 0004e2 04f0 DEST(PFA_NUMBER2) ; excatly one character is left 0004e3 3897 .dw XT_CFETCH 0004e4 383c .dw XT_DOLITERAL 0004e5 002e .dw 46 ; . 0004e6 3fde .dw XT_EQUAL 0004e7 3835 .dw XT_DOCONDBRANCH 0004e8 04f1 DEST(PFA_NUMBER6) ; its a double cell number ; incorporate sign into number 0004e9 38f5 .dw XT_R_FROM 0004ea 3835 .dw XT_DOCONDBRANCH 0004eb 04ed DEST(PFA_NUMBER3) 0004ec 01f8 .dw XT_DNEGATE PFA_NUMBER3: 0004ed 3fea .dw XT_TWO 0004ee 382e .dw XT_DOBRANCH 0004ef 04ff DEST(PFA_NUMBER5) PFA_NUMBER2: 0004f0 38d8 .dw XT_DROP PFA_NUMBER6: 0004f1 3ed1 .dw XT_2DROP 0004f2 38f5 .dw XT_R_FROM 0004f3 38d8 .dw XT_DROP 0004f4 38f5 .dw XT_R_FROM 0004f5 3ebc .dw XT_BASE 0004f6 3880 .dw XT_STORE 0004f7 3953 .dw XT_ZERO 0004f8 381f .dw XT_EXIT PFA_NUMBER1: 0004f9 3ed1 .dw XT_2DROP ; remove the address ; incorporate sign into number 0004fa 38f5 .dw XT_R_FROM 0004fb 3835 .dw XT_DOCONDBRANCH 0004fc 04fe DEST(PFA_NUMBER4) 0004fd 3e26 .dw XT_NEGATE PFA_NUMBER4: 0004fe 3fe5 .dw XT_ONE PFA_NUMBER5: 0004ff 38f5 .dw XT_R_FROM 000500 3ebc .dw XT_BASE 000501 3880 .dw XT_STORE 000502 394a .dw XT_TRUE 000503 381f .dw XT_EXIT .include "words/q-sign.asm" .if cpu_msp430==1 .endif .if cpu_avr8==1 XT_QSIGN: 000504 3800 .dw DO_COLON PFA_QSIGN: ; ( c -- ) .endif 000505 38ce .dw XT_OVER ; ( -- addr len addr ) 000506 3897 .dw XT_CFETCH 000507 383c .dw XT_DOLITERAL 000508 002d .dw '-' 000509 3fde .dw XT_EQUAL ; ( -- addr len flag ) 00050a 38b0 .dw XT_DUP 00050b 38fe .dw XT_TO_R 00050c 3835 .dw XT_DOCONDBRANCH 00050d 0510 DEST(PFA_NUMBERSIGN_DONE) 00050e 3fe5 .dw XT_ONE ; skip sign character 00050f 0571 .dw XT_SLASHSTRING PFA_NUMBERSIGN_DONE: 000510 38f5 .dw XT_R_FROM 000511 381f .dw XT_EXIT .include "words/set-base.asm" ; Numeric IO ; skip a numeric prefix character .if cpu_msp430==1 .endif .if cpu_avr8==1 XT_BASES: 000512 3851 .dw PFA_DOCONSTANT .endif 000513 000a 000514 0010 000515 0002 000516 000a .dw 10,16,2,10 ; last one could a 8 instead. .if cpu_msp430==1 .endif .if cpu_avr8==1 XT_SET_BASE: 000517 3800 .dw DO_COLON PFA_SET_BASE: ; ( adr1 len1 -- adr2 len2 ) .endif 000518 38ce .dw XT_OVER 000519 3897 .dw XT_CFETCH 00051a 383c .dw XT_DOLITERAL 00051b 0023 .dw 35 00051c 3992 .dw XT_MINUS 00051d 38b0 .dw XT_DUP 00051e 3953 .dw XT_ZERO 00051f 383c .dw XT_DOLITERAL 000520 0004 .dw 4 000521 3e56 .dw XT_WITHIN 000522 3835 .dw XT_DOCONDBRANCH 000523 052d DEST(SET_BASE1) .if cpu_msp430==1 .endif 000524 0512 .dw XT_BASES 000525 399c .dw XT_PLUS 000526 3bca .dw XT_FETCHI 000527 3ebc .dw XT_BASE 000528 3880 .dw XT_STORE 000529 3fe5 .dw XT_ONE 00052a 0571 .dw XT_SLASHSTRING 00052b 382e .dw XT_DOBRANCH 00052c 052e DEST(SET_BASE2) SET_BASE1: 00052d 38d8 .dw XT_DROP SET_BASE2: 00052e 381f .dw XT_EXIT ; create bases 10 , 16 , 2 , 8 , ; : set-base 35 - dup 0 4 within if ; bases + @i base ! 1 /string ; else ; drop ; then ; .include "words/to-number.asm" ; Numeric IO ; convert a string to a number c-addr2/u2 is the unconverted string .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_TO_NUMBER: 00052f ff07 .dw $ff07 000530 6e3e 000531 6d75 000532 6562 000533 0072 .db ">number",0 000534 04bb .dw VE_HEAD .set VE_HEAD = VE_TO_NUMBER XT_TO_NUMBER: 000535 3800 .dw DO_COLON .endif 000536 38b0 000537 3835 TONUM1: .DW XT_DUP,XT_DOCONDBRANCH 000538 054d DEST(TONUM3) 000539 38ce 00053a 3897 00053b 037b .DW XT_OVER,XT_CFETCH,XT_DIGITQ 00053c 3919 00053d 3835 .DW XT_ZEROEQUAL,XT_DOCONDBRANCH 00053e 0541 DEST(TONUM2) 00053f 38d8 000540 381f .DW XT_DROP,XT_EXIT 000541 38fe 000542 021c 000543 3ebc 000544 3878 000545 00ff TONUM2: .DW XT_TO_R,XT_2SWAP,XT_BASE,XT_FETCH,XT_UDSTAR 000546 38f5 000547 00f7 000548 021c .DW XT_R_FROM,XT_MPLUS,XT_2SWAP 000549 3fe5 00054a 0571 00054b 382e .DW XT_ONE,XT_SLASHSTRING,XT_DOBRANCH 00054c 0536 DEST(TONUM1) 00054d 381f TONUM3: .DW XT_EXIT ;C >NUMBER ud adr u -- ud' adr' u' ;C convert string to number ; BEGIN ; DUP WHILE ; OVER C@ DIGIT? ; 0= IF DROP EXIT THEN ; >R 2SWAP BASE @ UD* ; R> M+ 2SWAP ; 1 /STRING ; REPEAT ; .include "words/parse.asm" ; String ; in input buffer parse ccc delimited string by the delimiter char. .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_PARSE: 00054e ff05 .dw $ff05 00054f 6170 000550 7372 000551 0065 .db "parse",0 000552 052f .dw VE_HEAD .set VE_HEAD = VE_PARSE XT_PARSE: 000553 3800 .dw DO_COLON PFA_PARSE: .endif 000554 38fe .dw XT_TO_R ; ( -- ) 000555 0567 .dw XT_SOURCE ; ( -- addr len) 000556 3ee1 .dw XT_TO_IN ; ( -- addr len >in) 000557 3878 .dw XT_FETCH 000558 0571 .dw XT_SLASHSTRING ; ( -- addr' len' ) 000559 38f5 .dw XT_R_FROM ; ( -- addr' len' c) 00055a 043d .dw XT_CSCAN ; ( -- addr' len'') 00055b 38b0 .dw XT_DUP ; ( -- addr' len'' len'') 00055c 3a2e .dw XT_1PLUS 00055d 3ee1 .dw XT_TO_IN ; ( -- addr' len'' len'' >in) 00055e 3a64 .dw XT_PLUSSTORE ; ( -- addr' len') 00055f 3fe5 .dw XT_ONE 000560 0571 .dw XT_SLASHSTRING 000561 381f .dw XT_EXIT .include "words/source.asm" ; System ; address and current length of the input buffer .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SOURCE: 000562 ff06 .dw $FF06 000563 6f73 000564 7275 000565 6563 .db "source" 000566 054e .dw VE_HEAD .set VE_HEAD = VE_SOURCE XT_SOURCE: 000567 3dfe .dw PFA_DODEFER1 PFA_SOURCE: .endif 000568 0016 .dw USER_SOURCE 000569 3dc7 .dw XT_UDEFERFETCH 00056a 3dd3 .dw XT_UDEFERSTORE .include "words/slash-string.asm" ; String ; adjust string from addr1 to addr1+n, reduce length from u1 to u2 by n .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SLASHSTRING: 00056b ff07 .dw $ff07 00056c 732f 00056d 7274 00056e 6e69 00056f 0067 .db "/string",0 000570 0562 .dw VE_HEAD .set VE_HEAD = VE_SLASHSTRING XT_SLASHSTRING: 000571 3800 .dw DO_COLON PFA_SLASHSTRING: .endif 000572 38e0 .dw XT_ROT 000573 38ce .dw XT_OVER 000574 399c .dw XT_PLUS 000575 38e0 .dw XT_ROT 000576 38e0 .dw XT_ROT 000577 3992 .dw XT_MINUS 000578 381f .dw XT_EXIT .include "words/parse-name.asm" ; String ; In the SOURCE buffer parse whitespace delimited string. Returns string address within SOURCE. .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_PARSENAME: 000579 ff0a .dw $FF0A 00057a 6170 00057b 7372 00057c 2d65 00057d 616e 00057e 656d .db "parse-name" 00057f 056b .dw VE_HEAD .set VE_HEAD = VE_PARSENAME XT_PARSENAME: 000580 3800 .dw DO_COLON PFA_PARSENAME: .endif 000581 3f53 .dw XT_BL 000582 0584 .dw XT_SKIPSCANCHAR 000583 381f .dw XT_EXIT ; ( c -- addr2 len2 ) ; String ; skips char and scan what's left in source for char .if cpu_msp430==1 .endif .if cpu_avr8==1 ;VE_SKIPSCANCHAR: ; .dw $FF0A ; .db "skipscanchar" ; .dw VE_HEAD ; .set VE_HEAD = VE_SKIPSCANCHAR XT_SKIPSCANCHAR: 000584 3800 .dw DO_COLON PFA_SKIPSCANCHAR: .endif 000585 38fe .dw XT_TO_R 000586 0567 .dw XT_SOURCE 000587 3ee1 .dw XT_TO_IN 000588 3878 .dw XT_FETCH 000589 0571 .dw XT_SLASHSTRING 00058a 3907 .dw XT_R_FETCH 00058b 0426 .dw XT_CSKIP 00058c 38f5 .dw XT_R_FROM 00058d 043d .dw XT_CSCAN ; adjust >IN 00058e 3ec8 .dw XT_2DUP 00058f 399c .dw XT_PLUS 000590 0567 .dw XT_SOURCE 000591 38d8 .dw XT_DROP 000592 3992 .dw XT_MINUS 000593 3ee1 .dw XT_TO_IN 000594 3880 .dw XT_STORE 000595 381f .dw XT_EXIT .include "words/sp0.asm" ; Stack ; start address of the data stack VE_SP0: 000596 ff03 .dw $ff03 000597 7073 000598 0030 .db "sp0",0 000599 0579 .dw VE_HEAD .set VE_HEAD = VE_SP0 XT_SP0: 00059a 386e .dw PFA_DOVALUE1 PFA_SP0: 00059b 0006 .dw USER_SP0 00059c 3dc7 .dw XT_UDEFERFETCH 00059d 3dd3 .dw XT_UDEFERSTORE ; ( -- addr) ; Stack ; address of user variable to store top-of-stack for inactive tasks VE_SP: 00059e ff02 .dw $ff02 00059f 7073 .db "sp" 0005a0 0596 .dw VE_HEAD .set VE_HEAD = VE_SP XT_SP: 0005a1 3857 .dw PFA_DOUSER PFA_SP: 0005a2 0008 .dw USER_SP .include "words/rp0.asm" ; Stack ; start address of return stack VE_RP0: 0005a3 ff03 .dw $ff03 0005a4 7072 0005a5 0030 .db "rp0",0 0005a6 059e .dw VE_HEAD .set VE_HEAD = VE_RP0 XT_RP0: 0005a7 3800 .dw DO_COLON PFA_RP0: 0005a8 05ab .dw XT_DORP0 0005a9 3878 .dw XT_FETCH 0005aa 381f .dw XT_EXIT ; ( -- addr) ; Stack ; user variable of the address of the initial return stack ;VE_DORP0: ; .dw $ff05 ; .db "(rp0)" ; .dw VE_HEAD ; .set VE_HEAD = VE_DORP0 XT_DORP0: 0005ab 3857 .dw PFA_DOUSER PFA_DORP0: 0005ac 0004 .dw USER_RP .include "words/depth.asm" ; Stack ; number of single-cell values contained in the data stack before n was placed on the stack. .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DEPTH: 0005ad ff05 .dw $ff05 0005ae 6564 0005af 7470 0005b0 0068 .db "depth",0 0005b1 05a3 .dw VE_HEAD .set VE_HEAD = VE_DEPTH XT_DEPTH: 0005b2 3800 .dw DO_COLON PFA_DEPTH: .endif 0005b3 059a .dw XT_SP0 0005b4 3a8c .dw XT_SP_FETCH 0005b5 3992 .dw XT_MINUS 0005b6 3a03 .dw XT_2SLASH 0005b7 3a34 .dw XT_1MINUS 0005b8 381f .dw XT_EXIT .include "words/forth-recognizer.asm" ; System Value ; address of the next free data space (RAM) cell VE_FORTHRECOGNIZER: 0005b9 ff10 .dw $ff10 0005ba 6f66 0005bb 7472 0005bc 2d68 0005bd 6572 0005be 6f63 0005bf 6e67 0005c0 7a69 0005c1 7265 .db "forth-recognizer" 0005c2 05ad .dw VE_HEAD .set VE_HEAD = VE_FORTHRECOGNIZER XT_FORTHRECOGNIZER: 0005c3 386e .dw PFA_DOVALUE1 PFA_FORTHRECOGNIZER: 0005c4 003e .dw CFG_FORTHRECOGNIZER 0005c5 3d9f .dw XT_EDEFERFETCH 0005c6 3da9 .dw XT_EDEFERSTORE .include "words/recognize.asm" ; System ; walk the recognizer stack .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_RECOGNIZE: 0005c7 ff09 .dw $ff09 0005c8 6572 0005c9 6f63 0005ca 6e67 0005cb 7a69 0005cc 0065 .db "recognize",0 0005cd 05b9 .dw VE_HEAD .set VE_HEAD = VE_RECOGNIZE XT_RECOGNIZE: 0005ce 3800 .dw DO_COLON PFA_RECOGNIZE: .endif 0005cf 383c .dw XT_DOLITERAL 0005d0 05d9 .dw XT_RECOGNIZE_A 0005d1 38c3 .dw XT_SWAP 0005d2 096c .dw XT_MAPSTACK 0005d3 3919 .dw XT_ZEROEQUAL 0005d4 3835 .dw XT_DOCONDBRANCH 0005d5 05d8 DEST(PFA_RECOGNIZE1) 0005d6 3ed1 .dw XT_2DROP 0005d7 065b .dw XT_DT_NULL PFA_RECOGNIZE1: 0005d8 381f .dw XT_EXIT .if cpu_msp430==1 .endif .if cpu_avr8==1 ; ( addr len XT -- addr len [ dt:xt -1 | 0 ] ) XT_RECOGNIZE_A: 0005d9 3800 .dw DO_COLON PFA_RECOGNIZE_A: .endif 0005da 38e0 .dw XT_ROT ; -- len xt addr 0005db 38e0 .dw XT_ROT ; -- xt addr len 0005dc 3ec8 .dw XT_2DUP 0005dd 3b1d .dw XT_2TO_R 0005de 38e0 .dw XT_ROT ; -- addr len xt 0005df 3829 .dw XT_EXECUTE ; -- i*x dt:* | dt:null 0005e0 3b2c .dw XT_2R_FROM 0005e1 38e0 .dw XT_ROT 0005e2 38b0 .dw XT_DUP 0005e3 065b .dw XT_DT_NULL 0005e4 3fde .dw XT_EQUAL 0005e5 3835 .dw XT_DOCONDBRANCH 0005e6 05ea DEST(PFA_RECOGNIZE_A1) 0005e7 38d8 .dw XT_DROP 0005e8 3953 .dw XT_ZERO 0005e9 381f .dw XT_EXIT PFA_RECOGNIZE_A1: 0005ea 38ef .dw XT_NIP 0005eb 38ef .dw XT_NIP 0005ec 394a .dw XT_TRUE 0005ed 381f .dw XT_EXIT ; : recognize ( addr len stack-id -- i*x dt:* | dt:null ) ; [: ( addr len -- addr len 0 | i*x dt:* -1 ) ; rot rot 2dup 2>r rot execute 2r> rot ; dup dt:null = ( -- addr len dt:* f ) ; if drop 0 else nip nip -1 then ; ;] ; map-stack ( -- i*x addr len dt:* f ) ; 0= if \ a recognizer did the job, remove addr/len ; 2drop dt:null ; then ; ; .include "words/interpret.asm" ; System ; Interpret SOURCE word by word. .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_INTERPRET: 0005ee ff09 .dw $ff09 0005ef 6e69 0005f0 6574 0005f1 7072 0005f2 6572 0005f3 0074 .db "interpret",0 0005f4 05c7 .dw VE_HEAD .set VE_HEAD = VE_INTERPRET XT_INTERPRET: 0005f5 3800 .dw DO_COLON .endif PFA_INTERPRET: 0005f6 0580 .dw XT_PARSENAME ; ( -- addr len ) 0005f7 38b0 .dw XT_DUP ; ( -- addr len flag) 0005f8 3835 .dw XT_DOCONDBRANCH 0005f9 0606 DEST(PFA_INTERPRET2) 0005fa 05c3 .dw XT_FORTHRECOGNIZER 0005fb 05ce .dw XT_RECOGNIZE 0005fc 3eb6 .dw XT_STATE 0005fd 3878 .dw XT_FETCH 0005fe 3835 .dw XT_DOCONDBRANCH 0005ff 0601 DEST(PFA_INTERPRET1) 000600 0185 .dw XT_ICELLPLUS ; we need the compile action PFA_INTERPRET1: 000601 3bca .dw XT_FETCHI 000602 3829 .dw XT_EXECUTE 000603 3f8a .dw XT_QSTACK 000604 382e .dw XT_DOBRANCH 000605 05f6 DEST(PFA_INTERPRET) PFA_INTERPRET2: 000606 3ed1 .dw XT_2DROP 000607 381f .dw XT_EXIT .include "words/rec-intnum.asm" ; Interpreter ; Method table for single cell integers .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DT_NUM: 000608 ff06 .dw $ff06 000609 7464 00060a 6e3a 00060b 6d75 .db "dt:num" 00060c 05ee .dw VE_HEAD .set VE_HEAD = VE_DT_NUM XT_DT_NUM: 00060d 3851 .dw PFA_DOCONSTANT PFA_DT_NUM: .endif 00060e 0159 .dw XT_NOOP ; interpret 00060f 0742 .dw XT_LITERAL ; compile 000610 0742 .dw XT_LITERAL ; postpone ; ( -- addr ) ; Interpreter ; Method table for double cell integers .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DT_DNUM: 000611 ff07 .dw $ff07 000612 7464 000613 643a 000614 756e 000615 006d .db "dt:dnum",0 000616 0608 .dw VE_HEAD .set VE_HEAD = VE_DT_DNUM XT_DT_DNUM: 000617 3851 .dw PFA_DOCONSTANT PFA_DT_DNUM: .endif 000618 0159 .dw XT_NOOP ; interpret 000619 3fd6 .dw XT_2LITERAL ; compile 00061a 3fd6 .dw XT_2LITERAL ; postpone ; ( addr len -- f ) ; Interpreter ; recognizer for integer numbers .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_REC_NUM: 00061b ff07 .dw $ff07 00061c 6572 00061d 3a63 00061e 756e 00061f 006d .db "rec:num",0 000620 0611 .dw VE_HEAD .set VE_HEAD = VE_REC_NUM XT_REC_NUM: 000621 3800 .dw DO_COLON PFA_REC_NUM: .endif ; try converting to a number 000622 04c0 .dw XT_NUMBER 000623 3835 .dw XT_DOCONDBRANCH 000624 062d DEST(PFA_REC_NONUMBER) 000625 3fe5 .dw XT_ONE 000626 3fde .dw XT_EQUAL 000627 3835 .dw XT_DOCONDBRANCH 000628 062b DEST(PFA_REC_INTNUM2) 000629 060d .dw XT_DT_NUM 00062a 381f .dw XT_EXIT PFA_REC_INTNUM2: 00062b 0617 .dw XT_DT_DNUM 00062c 381f .dw XT_EXIT PFA_REC_NONUMBER: 00062d 065b .dw XT_DT_NULL 00062e 381f .dw XT_EXIT .include "words/rec-find.asm" ; Interpreter ; search for a word .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_REC_FIND: 00062f ff08 .dw $ff08 000630 6572 000631 3a63 000632 6966 000633 646e .db "rec:find" 000634 061b .dw VE_HEAD .set VE_HEAD = VE_REC_FIND XT_REC_FIND: 000635 3800 .dw DO_COLON PFA_REC_FIND: .endif 000636 06d0 .DW XT_FINDXT 000637 38b0 .dw XT_DUP 000638 3919 .dw XT_ZEROEQUAL 000639 3835 .dw XT_DOCONDBRANCH 00063a 063e DEST(PFA_REC_WORD_FOUND) 00063b 38d8 .dw XT_DROP 00063c 065b .dw XT_DT_NULL 00063d 381f .dw XT_EXIT PFA_REC_WORD_FOUND: 00063e 0645 .dw XT_DT_XT 00063f 381f .dw XT_EXIT ; ( -- addr ) ; Interpreter ; actions to handle execution tokens and their flags .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DT_XT: 000640 ff05 .dw $ff05 000641 7464 000642 783a 000643 0074 .db "dt:xt",0 000644 062f .dw VE_HEAD .set VE_HEAD = VE_DT_XT XT_DT_XT: 000645 3851 .dw PFA_DOCONSTANT PFA_DT_XT: .endif 000646 0649 .dw XT_R_WORD_INTERPRET 000647 064d .dw XT_R_WORD_COMPILE 000648 3fd6 .dw XT_2LITERAL ; ( XT flags -- ) ; Interpreter ; interpret method for WORD recognizer .if cpu_msp430==1 .endif .if cpu_avr8==1 XT_R_WORD_INTERPRET: 000649 3800 .dw DO_COLON PFA_R_WORD_INTERPRET: .endif 00064a 38d8 .dw XT_DROP ; the flags are in the way 00064b 3829 .dw XT_EXECUTE 00064c 381f .dw XT_EXIT ; ( XT flags -- ) ; Interpreter ; Compile method for WORD recognizer .if cpu_msp430==1 .endif .if cpu_avr8==1 XT_R_WORD_COMPILE: 00064d 3800 .dw DO_COLON PFA_R_WORD_COMPILE: .endif 00064e 3920 .dw XT_ZEROLESS 00064f 3835 .dw XT_DOCONDBRANCH 000650 0653 DEST(PFA_R_WORD_COMPILE1) 000651 072c .dw XT_COMMA 000652 381f .dw XT_EXIT PFA_R_WORD_COMPILE1: 000653 3829 .dw XT_EXECUTE 000654 381f .dw XT_EXIT .include "words/dt-null.asm" ; Interpreter ; there is no parser for this recognizer, this is the default and failsafe part .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DT_NULL: 000655 ff07 .dw $ff07 000656 7464 000657 6e3a 000658 6c75 ../../common\words/dt-null.asm(12): warning: .cseg .db misalignment - padding zero byte 000659 006c .db "dt:null" 00065a 0640 .dw VE_HEAD .set VE_HEAD = VE_DT_NULL XT_DT_NULL: 00065b 3851 .dw PFA_DOCONSTANT PFA_DT_NULL: .endif 00065c 065f .dw XT_FAIL ; interpret 00065d 065f .dw XT_FAIL ; compile 00065e 065f .dw XT_FAIL ; postpone ; ( addr len -- ) ; Interpreter ; default failure action: throw exception -13. .if cpu_msp430==1 .endif .if cpu_avr8==1 ;VE_FAIL: ; .dw $ff04 ; .db "fail" ; .dw VE_HEAD ; .set VE_HEAD = VE_FAIL XT_FAIL: 00065f 3800 .dw DO_COLON PFA_FAIL: .endif 000660 383c .dw XT_DOLITERAL 000661 fff3 .dw -13 000662 3d85 .dw XT_THROW .include "words/search-wordlist.asm" ; Search Order ; searches the word list wid for the word at c-addr/len .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SEARCH_WORDLIST: 000663 ff0f .dw $ff0f 000664 6573 000665 7261 000666 6863 000667 772d 000668 726f 000669 6c64 00066a 7369 00066b 0074 .db "search-wordlist",0 00066c 0655 .dw VE_HEAD .set VE_HEAD = VE_SEARCH_WORDLIST XT_SEARCH_WORDLIST: 00066d 3800 .dw DO_COLON PFA_SEARCH_WORDLIST: .endif 00066e 38fe .dw XT_TO_R 00066f 3953 .dw XT_ZERO 000670 383c .dw XT_DOLITERAL 000671 0682 .dw XT_ISWORD 000672 38f5 .dw XT_R_FROM 000673 069f .dw XT_TRAVERSEWORDLIST 000674 38b0 .dw XT_DUP 000675 3919 .dw XT_ZEROEQUAL 000676 3835 .dw XT_DOCONDBRANCH 000677 067c DEST(PFA_SEARCH_WORDLIST1) 000678 3ed1 .dw XT_2DROP 000679 38d8 .dw XT_DROP 00067a 3953 .dw XT_ZERO 00067b 381f .dw XT_EXIT PFA_SEARCH_WORDLIST1: ; ... get the XT ... 00067c 38b0 .dw XT_DUP 00067d 06c6 .dw XT_NFA2CFA ; .. and get the header flag 00067e 38c3 .dw XT_SWAP 00067f 0134 .dw XT_NAME2FLAGS 000680 0122 .dw XT_IMMEDIATEQ 000681 381f .dw XT_EXIT .if cpu_msp430==1 .endif .if cpu_avr8==1 XT_ISWORD: 000682 3800 .dw DO_COLON PFA_ISWORD: .endif ; ( c-addr len 0 nt -- c-addr len 0 true| nt false ) 000683 38fe .dw XT_TO_R 000684 38d8 .dw XT_DROP 000685 3ec8 .dw XT_2DUP 000686 3907 .dw XT_R_FETCH ; -- addr len addr len nt 000687 06ba .dw XT_NAME2STRING 000688 018e .dw XT_ICOMPARE ; (-- addr len f ) 000689 3835 .dw XT_DOCONDBRANCH 00068a 0690 DEST(PFA_ISWORD3) ; not now 00068b 38f5 .dw XT_R_FROM 00068c 38d8 .dw XT_DROP 00068d 3953 .dw XT_ZERO 00068e 394a .dw XT_TRUE ; maybe next word 00068f 381f .dw XT_EXIT PFA_ISWORD3: ; we found the word, now clean up iteration data ... 000690 3ed1 .dw XT_2DROP 000691 38f5 .dw XT_R_FROM 000692 3953 .dw XT_ZERO ; finish traverse-wordlist 000693 381f .dw XT_EXIT .include "words/traverse-wordlist.asm" ; Tools Ext (2012) ; call the xt for every member of the wordlist wid until xt returns false .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_TRAVERSEWORDLIST: 000694 ff11 .dw $ff11 000695 7274 000696 7661 000697 7265 000698 6573 000699 772d 00069a 726f 00069b 6c64 00069c 7369 00069d 0074 .db "traverse-wordlist",0 00069e 0663 .dw VE_HEAD .set VE_HEAD = VE_TRAVERSEWORDLIST XT_TRAVERSEWORDLIST: 00069f 3800 .dw DO_COLON PFA_TRAVERSEWORDLIST: .endif 0006a0 3b5e .dw XT_FETCHE PFA_TRAVERSEWORDLIST1: 0006a1 38b0 .dw XT_DUP ; ( -- xt nt nt ) 0006a2 3835 .dw XT_DOCONDBRANCH ; ( -- nt ) is nfa = counted string 0006a3 06b0 DEST(PFA_TRAVERSEWORDLIST2) 0006a4 3ec8 .dw XT_2DUP 0006a5 3b1d .dw XT_2TO_R 0006a6 38c3 .dw XT_SWAP 0006a7 3829 .dw XT_EXECUTE 0006a8 3b2c .dw XT_2R_FROM 0006a9 38e0 .dw XT_ROT 0006aa 3835 .dw XT_DOCONDBRANCH 0006ab 06b0 DEST(PFA_TRAVERSEWORDLIST2) 0006ac 09db .dw XT_NFA2LFA 0006ad 3bca .dw XT_FETCHI 0006ae 382e .dw XT_DOBRANCH ; ( -- addr ) 0006af 06a1 DEST(PFA_TRAVERSEWORDLIST1) ; ( -- addr ) PFA_TRAVERSEWORDLIST2: 0006b0 3ed1 .dw XT_2DROP 0006b1 381f .dw XT_EXIT ; : traverse-wordlist ( i*x xt wid -- i*x' ) ; begin @ dup ; while ; 2dup 2>r ; swap execute ( i*x nt -- i*x' f ) ; 2r> rot ; while ; nfa>lfa @i ; repeat then 2drop ; .include "words/name2string.asm" ; Tools Ext (2012) ; get a (flash) string from a name token nt .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_NAME2STRING: 0006b2 ff0b .dw $ff0b 0006b3 616e 0006b4 656d 0006b5 733e 0006b6 7274 0006b7 6e69 0006b8 0067 .db "name>string",0 0006b9 0694 .dw VE_HEAD .set VE_HEAD = VE_NAME2STRING XT_NAME2STRING: 0006ba 3800 .dw DO_COLON PFA_NAME2STRING: .endif 0006bb 03f4 .dw XT_ICOUNT ; ( -- addr n ) 0006bc 383c .dw XT_DOLITERAL 0006bd 00ff .dw 255 0006be 3a12 .dw XT_AND ; mask immediate bit 0006bf 381f .dw XT_EXIT .include "words/nfa2cfa.asm" ; Tools ; get the XT from a name token VE_NFA2CFA: 0006c0 ff07 .dw $ff07 0006c1 666e 0006c2 3e61 0006c3 6663 ../../avr8\words/nfa2cfa.asm(6): warning: .cseg .db misalignment - padding zero byte 0006c4 0061 .db "nfa>cfa" 0006c5 06b2 .dw VE_HEAD .set VE_HEAD = VE_NFA2CFA XT_NFA2CFA: 0006c6 3800 .dw DO_COLON PFA_NFA2CFA: 0006c7 09db .dw XT_NFA2LFA ; skip to link field 0006c8 3a2e .dw XT_1PLUS ; next is the execution token 0006c9 381f .dw XT_EXIT .include "words/find-xt.asm" ; Tools ; search wordlists for an entry with the xt from c-addr/len .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_FINDXT: 0006ca ff07 .dw $ff07 0006cb 6966 0006cc 646e 0006cd 782d 0006ce 0074 .db "find-xt",0 0006cf 06c0 .dw VE_HEAD .set VE_HEAD = VE_FINDXT XT_FINDXT: 0006d0 3800 .dw DO_COLON PFA_FINDXT: .endif 0006d1 383c .dw XT_DOLITERAL 0006d2 06dc .dw XT_FINDXTA 0006d3 383c .dw XT_DOLITERAL 0006d4 004a .dw CFG_ORDERLISTLEN 0006d5 096c .dw XT_MAPSTACK 0006d6 3919 .dw XT_ZEROEQUAL 0006d7 3835 .dw XT_DOCONDBRANCH 0006d8 06db DEST(PFA_FINDXT1) 0006d9 3ed1 .dw XT_2DROP 0006da 3953 .dw XT_ZERO PFA_FINDXT1: 0006db 381f .dw XT_EXIT .if cpu_msp430==1 .endif .if cpu_avr8==1 XT_FINDXTA: 0006dc 3800 .dw DO_COLON PFA_FINDXTA: .endif 0006dd 38fe .dw XT_TO_R 0006de 3ec8 .dw XT_2DUP 0006df 38f5 .dw XT_R_FROM 0006e0 066d .dw XT_SEARCH_WORDLIST 0006e1 38b0 .dw XT_DUP 0006e2 3835 .dw XT_DOCONDBRANCH 0006e3 06e9 DEST(PFA_FINDXTA1) 0006e4 38fe .dw XT_TO_R 0006e5 38ef .dw XT_NIP 0006e6 38ef .dw XT_NIP 0006e7 38f5 .dw XT_R_FROM 0006e8 394a .dw XT_TRUE PFA_FINDXTA1: 0006e9 381f .dw XT_EXIT .include "dict/compiler1.inc" .include "words/newest.asm" ; System Variable ; system state VE_NEWEST: 0006ea ff06 .dw $ff06 0006eb 656e 0006ec 6577 0006ed 7473 .db "newest" 0006ee 06ca .dw VE_HEAD .set VE_HEAD = VE_NEWEST XT_NEWEST: 0006ef 3847 .dw PFA_DOVARIABLE PFA_NEWEST: 0006f0 018a .dw ram_newest .dseg 00018a ram_newest: .byte 4 .include "words/latest.asm" ; System Variable ; system state VE_LATEST: 0006f1 ff06 .dw $ff06 0006f2 616c 0006f3 6574 0006f4 7473 .db "latest" 0006f5 06ea .dw VE_HEAD .set VE_HEAD = VE_LATEST XT_LATEST: 0006f6 3847 .dw PFA_DOVARIABLE PFA_LATEST: 0006f7 018e .dw ram_latest .dseg 00018e ram_latest: .byte 2 .include "words/do-create.asm" ; Compiler ; parse the input and create an empty vocabulary entry without XT and data field (PF) .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DOCREATE: 0006f8 ff08 .dw $ff08 0006f9 6328 0006fa 6572 0006fb 7461 0006fc 2965 .db "(create)" 0006fd 06f1 .dw VE_HEAD .set VE_HEAD = VE_DOCREATE XT_DOCREATE: 0006fe 3800 .dw DO_COLON PFA_DOCREATE: .endif 0006ff 0580 000700 0855 .DW XT_PARSENAME,XT_WLSCOPE ; ( -- addr len wid) 000701 38b0 000702 06ef 000703 3c8f 000704 3880 .DW XT_DUP,XT_NEWEST,XT_CELLPLUS,XT_STORE ; save the wid 000705 083a 000706 06ef 000707 3880 .DW XT_HEADER,XT_NEWEST,XT_STORE ; save the nt 000708 381f .DW XT_EXIT .include "words/backslash.asm" ; Compiler ; everything up to the end of the current line is a comment .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_BACKSLASH: 000709 0001 .dw $0001 00070a 005c .db $5c,0 00070b 06f8 .dw VE_HEAD .set VE_HEAD = VE_BACKSLASH XT_BACKSLASH: 00070c 3800 .dw DO_COLON PFA_BACKSLASH: .endif 00070d 0567 .dw XT_SOURCE 00070e 38ef .dw XT_NIP 00070f 3ee1 .dw XT_TO_IN 000710 3880 .dw XT_STORE 000711 381f .dw XT_EXIT .include "words/l-paren.asm" ; Compiler ; skip everything up to the closing bracket on the same line .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_LPAREN: 000712 0001 .dw $0001 000713 0028 .db "(" ,0 000714 0709 .dw VE_HEAD .set VE_HEAD = VE_LPAREN XT_LPAREN: 000715 3800 .dw DO_COLON PFA_LPAREN: .endif 000716 383c .dw XT_DOLITERAL 000717 0029 .dw ')' 000718 0553 .dw XT_PARSE 000719 3ed1 .dw XT_2DROP 00071a 381f .dw XT_EXIT .include "words/compile.asm" ; Dictionary ; read the following cell from the dictionary and append it to the current dictionary position. .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_COMPILE: 00071b ff07 .dw $ff07 00071c 6f63 00071d 706d 00071e 6c69 00071f 0065 .db "compile",0 000720 0712 .dw VE_HEAD .set VE_HEAD = VE_COMPILE XT_COMPILE: 000721 3800 .dw DO_COLON PFA_COMPILE: .endif 000722 38f5 .dw XT_R_FROM 000723 38b0 .dw XT_DUP 000724 0185 .dw XT_ICELLPLUS 000725 38fe .dw XT_TO_R 000726 3bca .dw XT_FETCHI 000727 072c .dw XT_COMMA 000728 381f .dw XT_EXIT .include "words/comma.asm" ; Dictionary ; compile 16 bit into flash at DP VE_COMMA: 000729 ff01 .dw $ff01 00072a 002c .db ',',0 ; , 00072b 071b .dw VE_HEAD .set VE_HEAD = VE_COMMA XT_COMMA: 00072c 3800 .dw DO_COLON PFA_COMMA: 00072d 3f11 .dw XT_DP 00072e 3b72 .dw XT_STOREI 00072f 3f11 .dw XT_DP 000730 3a2e .dw XT_1PLUS 000731 0173 .dw XT_DOTO 000732 3f12 .dw PFA_DP 000733 381f .dw XT_EXIT .include "words/brackettick.asm" ; Compiler ; what ' does in the interpreter mode, do in colon definitions .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_BRACKETTICK: 000734 0003 .dw $0003 000735 275b 000736 005d .db "[']",0 000737 0729 .dw VE_HEAD .set VE_HEAD = VE_BRACKETTICK XT_BRACKETTICK: 000738 3800 .dw DO_COLON PFA_BRACKETTICK: .endif 000739 040d .dw XT_TICK 00073a 0742 .dw XT_LITERAL 00073b 381f .dw XT_EXIT .include "words/literal.asm" ; Compiler ; compile a literal in colon defintions .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_LITERAL: 00073c 0007 .dw $0007 00073d 696c 00073e 6574 00073f 6172 000740 006c .db "literal",0 000741 0734 .dw VE_HEAD .set VE_HEAD = VE_LITERAL XT_LITERAL: 000742 3800 .dw DO_COLON PFA_LITERAL: .endif 000743 0721 .DW XT_COMPILE 000744 383c .DW XT_DOLITERAL 000745 072c .DW XT_COMMA 000746 381f .DW XT_EXIT .include "words/sliteral.asm" ; String ; compiles a string to flash, at runtime leaves ( -- flash-addr count) on stack .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SLITERAL: 000747 0008 .dw $0008 000748 6c73 000749 7469 00074a 7265 00074b 6c61 .db "sliteral" 00074c 073c .dw VE_HEAD .set VE_HEAD = VE_SLITERAL XT_SLITERAL: 00074d 3800 .dw DO_COLON PFA_SLITERAL: .endif 00074e 0721 .dw XT_COMPILE 00074f 0395 .dw XT_DOSLITERAL ; ( -- addr n) 000750 03a3 .dw XT_SCOMMA 000751 381f .dw XT_EXIT .include "words/g-mark.asm" ; Compiler ; places current dictionary position for backward resolves ;VE_GMARK: ; .dw $ff05 ; .db ">mark" ; .dw VE_HEAD ; .set VE_HEAD = VE_GMARK XT_GMARK: 000752 3800 .dw DO_COLON PFA_GMARK: 000753 3f11 .dw XT_DP 000754 0721 .dw XT_COMPILE 000755 ffff .dw -1 ; ffff does not erase flash 000756 381f .dw XT_EXIT .include "words/g-resolve.asm" ; Compiler ; resolve backward jumps ;VE_GRESOLVE: ; .dw $ff08 ; .db ">resolve" ; .dw VE_HEAD ; .set VE_HEAD = VE_GRESOLVE XT_GRESOLVE: 000757 3800 .dw DO_COLON PFA_GRESOLVE: 000758 3f8a .dw XT_QSTACK 000759 3f11 .dw XT_DP 00075a 38c3 .dw XT_SWAP 00075b 3b72 .dw XT_STOREI 00075c 381f .dw XT_EXIT .include "words/l_mark.asm" ; Compiler ; place destination for backward branch ;VE_LMARK: ; .dw $ff05 ; .db "r if 2drop then r> invert ; .if cpu_msp430==1 .endif .if cpu_avr8==1 XT_QDOCHECK: 0007eb 3800 .dw DO_COLON PFA_QDOCHECK: .endif 0007ec 3ec8 .dw XT_2DUP 0007ed 3fde .dw XT_EQUAL 0007ee 38b0 .dw XT_DUP 0007ef 38fe .dw XT_TO_R 0007f0 3835 .dw XT_DOCONDBRANCH 0007f1 07f3 DEST(PFA_QDOCHECK1) 0007f2 3ed1 .dw XT_2DROP PFA_QDOCHECK1: 0007f3 38f5 .dw XT_R_FROM 0007f4 39fc .dw XT_INVERT 0007f5 381f .dw XT_EXIT .include "words/endloop.asm" .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_ENDLOOP: 0007f6 ff07 .dw $ff07 0007f7 6e65 0007f8 6c64 0007f9 6f6f 0007fa 0070 .db "endloop",0 0007fb 07df .dw VE_HEAD .set VE_HEAD = VE_ENDLOOP XT_ENDLOOP: 0007fc 3800 .dw DO_COLON PFA_ENDLOOP: .endif ;Z ENDLOOP adrs xt -- L: 0 a1 a2 .. aN -- ; ?DUP WHILE POSTPONE THEN REPEAT ; ; resolve LEAVEs ; This is a common factor of LOOP and +LOOP. 0007fd 0760 .DW XT_LRESOLVE 0007fe 0809 0007ff 38b8 000800 3835 LOOP1: .DW XT_L_FROM,XT_QDUP,XT_DOCONDBRANCH 000801 0805 DEST(LOOP2) 000802 0785 .DW XT_THEN 000803 382e .dw XT_DOBRANCH 000804 07fe DEST(LOOP1) 000805 381f LOOP2: .DW XT_EXIT ; leave address stack .include "words/l-from.asm" .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_L_FROM: 000806 ff02 .dw $ff02 000807 3e6c .db "l>" 000808 07f6 .dw VE_HEAD .set VE_HEAD = VE_L_FROM XT_L_FROM: 000809 3800 .dw DO_COLON PFA_L_FROM: .endif ;Z L> -- x L: x -- move from leave stack ; LP @ @ -2 LP +! ; 00080a 0828 .dw XT_LP 00080b 3878 .dw XT_FETCH 00080c 3878 .dw XT_FETCH 00080d 383c .dw XT_DOLITERAL 00080e fffe .dw -2 00080f 0828 .dw XT_LP 000810 3a64 .dw XT_PLUSSTORE 000811 381f .dw XT_EXIT .include "words/to-l.asm" .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_TO_L: 000812 ff02 .dw $ff02 000813 6c3e .db ">l" 000814 0806 .dw VE_HEAD .set VE_HEAD = VE_TO_L XT_TO_L: 000815 3800 .dw DO_COLON PFA_TO_L: .endif ;Z >L x -- L: -- x move to leave stack ; CELL LP +! LP @ ! ; (L stack grows up) 000816 3fea .dw XT_TWO 000817 0828 .dw XT_LP 000818 3a64 .dw XT_PLUSSTORE 000819 0828 .dw XT_LP 00081a 3878 .dw XT_FETCH 00081b 3880 .dw XT_STORE 00081c 381f .dw XT_EXIT .include "words/lp0.asm" ; Stack ; start address of leave stack VE_LP0: 00081d ff03 .dw $ff03 00081e 706c 00081f 0030 .db "lp0",0 000820 0812 .dw VE_HEAD .set VE_HEAD = VE_LP0 XT_LP0: 000821 386e .dw PFA_DOVALUE1 PFA_LP0: 000822 0040 .dw CFG_LP0 000823 3d9f .dw XT_EDEFERFETCH 000824 3da9 .dw XT_EDEFERSTORE .include "words/lp.asm" ; System Variable ; leave stack pointer VE_LP: 000825 ff02 .dw $ff02 000826 706c .db "lp" 000827 081d .dw VE_HEAD .set VE_HEAD = VE_LP XT_LP: 000828 3847 .dw PFA_DOVARIABLE PFA_LP: 000829 0190 .dw ram_lp .dseg 000190 ram_lp: .byte 2 .cseg .include "words/create.asm" ; Dictionary ; create a dictionary header. XT is (constant), with the address of the data field of name .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_CREATE: 00082a ff06 .dw $ff06 00082b 7263 00082c 6165 00082d 6574 .db "create" 00082e 0825 .dw VE_HEAD .set VE_HEAD = VE_CREATE XT_CREATE: 00082f 3800 .dw DO_COLON PFA_CREATE: .endif 000830 06fe .dw XT_DOCREATE 000831 085e .dw XT_REVEAL 000832 0721 .dw XT_COMPILE 000833 3851 .dw PFA_DOCONSTANT 000834 381f .dw XT_EXIT .include "words/header.asm" ; Compiler ; creates the vocabulary header without XT and data field (PF) in the wordlist wid VE_HEADER: 000835 ff06 .dw $ff06 000836 6568 000837 6461 000838 7265 .db "header" 000839 082a .dw VE_HEAD .set VE_HEAD = VE_HEADER XT_HEADER: 00083a 3800 .dw DO_COLON PFA_HEADER: 00083b 3f11 .dw XT_DP ; the new Name Field 00083c 38fe .dw XT_TO_R 00083d 38fe .dw XT_TO_R ; ( R: NFA WID ) 00083e 38b0 .dw XT_DUP 00083f 3927 .dw XT_GREATERZERO 000840 3835 .dw XT_DOCONDBRANCH 000841 084c .dw PFA_HEADER1 000842 38b0 .dw XT_DUP 000843 383c .dw XT_DOLITERAL 000844 ff00 .dw $ff00 ; all flags are off (e.g. immediate) 000845 3a1b .dw XT_OR 000846 03a7 .dw XT_DOSCOMMA ; make the link to the previous entry in this wordlist 000847 38f5 .dw XT_R_FROM 000848 3b5e .dw XT_FETCHE 000849 072c .dw XT_COMMA 00084a 38f5 .dw XT_R_FROM 00084b 381f .dw XT_EXIT PFA_HEADER1: ; -16: attempt to use zero length string as a name 00084c 383c .dw XT_DOLITERAL 00084d fff0 .dw -16 00084e 3d85 .dw XT_THROW .include "words/wlscope.asm" ; Compiler ; dynamically place a word in a wordlist. The word name may be changed. VE_WLSCOPE: 00084f ff07 .dw $ff07 000850 6c77 000851 6373 000852 706f 000853 0065 .db "wlscope",0 000854 0835 .dw VE_HEAD .set VE_HEAD = VE_WLSCOPE XT_WLSCOPE: 000855 3dfe .dw PFA_DODEFER1 PFA_WLSCOPE: 000856 003c .dw CFG_WLSCOPE 000857 3d9f .dw XT_EDEFERFETCH 000858 3da9 .dw XT_EDEFERSTORE ; wlscope, "wordlist scope" ( addr len -- addr' len' wid ), is a deferred word ; which enables the AmForth application to choose the wordlist ( wid ) for the ; new voc entry based on the input ( addr len ) string. The name of the new voc ; entry ( addr' len' ) may be different from the input string. Note that all ; created voc entry types pass through the wlscope mechanism. The default ; wlscope action passes the input string to the output without modification and ; uses get-current to select the wid. .include "words/reveal.asm" ; Dictionary ; makes an entry in a wordlist visible, if not already done. .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_REVEAL: 000859 ff06 .dw $ff06 00085a 6572 00085b 6576 00085c 6c61 .db "reveal" 00085d 084f .dw VE_HEAD .set VE_HEAD = VE_REVEAL XT_REVEAL: 00085e 3800 .dw DO_COLON PFA_REVEAL: .endif 00085f 06ef 000860 3c8f 000861 3878 .DW XT_NEWEST,XT_CELLPLUS,XT_FETCH ; only if wordlist is in use 000862 38b8 000863 3835 .DW XT_QDUP,XT_DOCONDBRANCH 000864 0869 DEST(REVEAL1) 000865 06ef 000866 3878 000867 38c3 000868 3b3a .DW XT_NEWEST,XT_FETCH,XT_SWAP,XT_STOREE ; .DW XT_ZERO,XT_NEWEST,XT_CELLPLUS,XT_STORE ; clean wordlist entry REVEAL1: 000869 381f .DW XT_EXIT .include "words/does.asm" ; Compiler ; organize the XT replacement to call other colon code VE_DOES: 00086a 0005 .dw $0005 00086b 6f64 00086c 7365 00086d 003e .db "does>",0 00086e 0859 .dw VE_HEAD .set VE_HEAD = VE_DOES XT_DOES: 00086f 3800 .dw DO_COLON PFA_DOES: 000870 0721 .dw XT_COMPILE 000871 0882 .dw XT_DODOES 000872 0721 .dw XT_COMPILE ; create a code snippet to be used in an embedded XT 000873 940e .dw $940e ; the address of this compiled 000874 0721 .dw XT_COMPILE ; code will replace the XT of the 000875 0877 .dw DO_DODOES ; word that CREATE created 000876 381f .dw XT_EXIT ; DO_DODOES: ; ( -- PFA ) 000877 939a 000878 938a savetos 000879 01cb movw tosl, wl 00087a 9601 adiw tosl, 1 ; the following takes the address from a real uC-call .if (pclen==3) .endif 00087b 917f pop wh 00087c 916f pop wl 00087d 93bf push XH 00087e 93af push XL 00087f 01db movw XL, wl 000880 940c 3804 jmp_ DO_NEXT ; ( -- ) ; System ; replace the XT written by CREATE to call the code that follows does> ;VE_DODOES: ; .dw $ff07 ; .db "(does>)" ; .set VE_HEAD = VE_DODOES XT_DODOES: 000882 3800 .dw DO_COLON PFA_DODOES: 000883 38f5 .dw XT_R_FROM 000884 06ef .dw XT_NEWEST 000885 3c8f .dw XT_CELLPLUS 000886 3878 .dw XT_FETCH 000887 3b5e .dw XT_FETCHE 000888 06c6 .dw XT_NFA2CFA 000889 3b72 .dw XT_STOREI 00088a 381f .dw XT_EXIT .include "words/colon.asm" ; Compiler ; create a named entry in the dictionary, XT is DO_COLON .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_COLON: 00088b ff01 .dw $ff01 00088c 003a .db ":",0 00088d 086a .dw VE_HEAD .set VE_HEAD = VE_COLON XT_COLON: 00088e 3800 .dw DO_COLON PFA_COLON: .endif 00088f 06fe .dw XT_DOCREATE 000890 0899 .dw XT_COLONNONAME 000891 38d8 .dw XT_DROP 000892 381f .dw XT_EXIT .include "words/colon-noname.asm" ; Compiler ; create an unnamed entry in the dictionary, XT is DO_COLON VE_COLONNONAME: 000893 ff07 .dw $ff07 000894 6e3a 000895 6e6f 000896 6d61 000897 0065 .db ":noname",0 000898 088b .dw VE_HEAD .set VE_HEAD = VE_COLONNONAME XT_COLONNONAME: 000899 3800 .dw DO_COLON PFA_COLONNONAME: 00089a 3f11 .dw XT_DP 00089b 38b0 .dw XT_DUP 00089c 06f6 .dw XT_LATEST 00089d 3880 .dw XT_STORE 00089e 0721 .dw XT_COMPILE 00089f 3800 .dw DO_COLON 0008a0 08ae .dw XT_RBRACKET 0008a1 381f .dw XT_EXIT .include "words/semicolon.asm" ; Compiler ; finish colon defintion, compiles (exit) and returns to interpret state .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SEMICOLON: 0008a2 0001 .dw $0001 0008a3 003b .db $3b,0 0008a4 0893 .dw VE_HEAD .set VE_HEAD = VE_SEMICOLON XT_SEMICOLON: 0008a5 3800 .dw DO_COLON PFA_SEMICOLON: .endif 0008a6 0721 .dw XT_COMPILE 0008a7 381f .dw XT_EXIT 0008a8 08b6 .dw XT_LBRACKET 0008a9 085e .dw XT_REVEAL 0008aa 381f .dw XT_EXIT .include "words/right-bracket.asm" ; Compiler ; enter compiler mode .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_RBRACKET: 0008ab ff01 .dw $ff01 0008ac 005d .db "]",0 0008ad 08a2 .dw VE_HEAD .set VE_HEAD = VE_RBRACKET XT_RBRACKET: 0008ae 3800 .dw DO_COLON PFA_RBRACKET: .endif 0008af 3fe5 .dw XT_ONE 0008b0 3eb6 .dw XT_STATE 0008b1 3880 .dw XT_STORE 0008b2 381f .dw XT_EXIT .include "words/left-bracket.asm" ; Compiler ; enter interpreter mode .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_LBRACKET: 0008b3 0001 .dw $0001 0008b4 005b .db "[",0 0008b5 08ab .dw VE_HEAD .set VE_HEAD = VE_LBRACKET XT_LBRACKET: 0008b6 3800 .dw DO_COLON PFA_LBRACKET: .endif 0008b7 3953 .dw XT_ZERO 0008b8 3eb6 .dw XT_STATE 0008b9 3880 .dw XT_STORE 0008ba 381f .dw XT_EXIT .include "words/variable.asm" ; Compiler ; create a dictionary entry for a variable and allocate 1 cell RAM .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_VARIABLE: 0008bb ff08 .dw $ff08 0008bc 6176 0008bd 6972 0008be 6261 0008bf 656c .db "variable" 0008c0 08b3 .dw VE_HEAD .set VE_HEAD = VE_VARIABLE XT_VARIABLE: 0008c1 3800 .dw DO_COLON PFA_VARIABLE: .endif 0008c2 3f22 .dw XT_HERE 0008c3 08cd .dw XT_CONSTANT 0008c4 3fea .dw XT_TWO 0008c5 3f2b .dw XT_ALLOT 0008c6 381f .dw XT_EXIT .include "words/constant.asm" ; Compiler ; create a constant in the dictionary .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_CONSTANT: 0008c7 ff08 .dw $ff08 0008c8 6f63 0008c9 736e 0008ca 6174 0008cb 746e .db "constant" 0008cc 08bb .dw VE_HEAD .set VE_HEAD = VE_CONSTANT XT_CONSTANT: 0008cd 3800 .dw DO_COLON PFA_CONSTANT: .endif 0008ce 06fe .dw XT_DOCREATE 0008cf 085e .dw XT_REVEAL 0008d0 0721 .dw XT_COMPILE 0008d1 3847 .dw PFA_DOVARIABLE 0008d2 072c .dw XT_COMMA 0008d3 381f .dw XT_EXIT .include "words/user.asm" ; Compiler ; create a dictionary entry for a user variable at offset n VE_USER: 0008d4 ff04 .dw $ff04 0008d5 7375 0008d6 7265 .db "user" 0008d7 08c7 .dw VE_HEAD .set VE_HEAD = VE_USER XT_USER: 0008d8 3800 .dw DO_COLON PFA_USER: 0008d9 06fe .dw XT_DOCREATE 0008da 085e .dw XT_REVEAL 0008db 0721 .dw XT_COMPILE 0008dc 3857 .dw PFA_DOUSER 0008dd 072c .dw XT_COMMA 0008de 381f .dw XT_EXIT .include "words/recurse.asm" ; Compiler ; compile the XT of the word currently being defined into the dictionary .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_RECURSE: 0008df 0007 .dw $0007 0008e0 6572 0008e1 7563 0008e2 7372 0008e3 0065 .db "recurse",0 0008e4 08d4 .dw VE_HEAD .set VE_HEAD = VE_RECURSE XT_RECURSE: 0008e5 3800 .dw DO_COLON PFA_RECURSE: .endif 0008e6 06f6 .dw XT_LATEST 0008e7 3878 .dw XT_FETCH 0008e8 072c .dw XT_COMMA 0008e9 381f .dw XT_EXIT .include "words/immediate.asm" ; Compiler ; set immediate flag for the most recent word definition VE_IMMEDIATE: 0008ea ff09 .dw $ff09 0008eb 6d69 0008ec 656d 0008ed 6964 0008ee 7461 0008ef 0065 .db "immediate",0 0008f0 08df .dw VE_HEAD .set VE_HEAD = VE_IMMEDIATE XT_IMMEDIATE: 0008f1 3800 .dw DO_COLON PFA_IMMEDIATE: 0008f2 0993 .dw XT_GET_CURRENT 0008f3 3b5e .dw XT_FETCHE 0008f4 38b0 .dw XT_DUP 0008f5 3bca .dw XT_FETCHI 0008f6 383c .dw XT_DOLITERAL 0008f7 7fff .dw $7fff 0008f8 3a12 .dw XT_AND 0008f9 38c3 .dw XT_SWAP 0008fa 3b72 .dw XT_STOREI 0008fb 381f .dw XT_EXIT .include "words/bracketchar.asm" ; Tools ; skip leading space delimites, place the first character of the word on the stack .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_BRACKETCHAR: 0008fc 0006 .dw $0006 0008fd 635b 0008fe 6168 0008ff 5d72 .db "[char]" 000900 08ea .dw VE_HEAD .set VE_HEAD = VE_BRACKETCHAR XT_BRACKETCHAR: 000901 3800 .dw DO_COLON PFA_BRACKETCHAR: .endif 000902 0721 .dw XT_COMPILE 000903 383c .dw XT_DOLITERAL 000904 04b6 .dw XT_CHAR 000905 072c .dw XT_COMMA 000906 381f .dw XT_EXIT .include "words/abort-string.asm" ;C i*x x1 -- R: j*x -- x1<>0 ; POSTPONE IS" POSTPONE ?ABORT ; IMMEDIATE .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_ABORTQUOTE: 000907 0006 .dw $0006 000908 6261 000909 726f 00090a 2274 .db "abort",'"' 00090b 08fc .dw VE_HEAD .set VE_HEAD = VE_ABORTQUOTE XT_ABORTQUOTE: 00090c 3800 .dw DO_COLON PFA_ABORTQUOTE: .endif 00090d 3e89 .dw XT_SQUOTE 00090e 0721 .dw XT_COMPILE 00090f 091e .dw XT_QABORT 000910 381f .DW XT_EXIT .include "words/abort.asm" ; Exceptions ; send an exception -1 .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_ABORT: 000911 ff05 .dw $ff05 000912 6261 000913 726f 000914 0074 .db "abort",0 000915 0907 .dw VE_HEAD .set VE_HEAD = VE_ABORT XT_ABORT: 000916 3800 .dw DO_COLON PFA_ABORT: .endif 000917 394a .dw XT_TRUE 000918 3d85 .dw XT_THROW .include "words/q-abort.asm" ; ROT IF ITYPE ABORT THEN 2DROP ; .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_QABORT: 000919 ff06 .dw $ff06 00091a 613f 00091b 6f62 00091c 7472 .db "?abort" 00091d 0911 .dw VE_HEAD .set VE_HEAD = VE_QABORT XT_QABORT: 00091e 3800 .dw DO_COLON PFA_QABORT: .endif 00091f 38e0 000920 3835 .DW XT_ROT,XT_DOCONDBRANCH 000921 0924 DEST(QABO1) 000922 03c8 000923 0916 .DW XT_ITYPE,XT_ABORT 000924 3ed1 000925 381f QABO1: .DW XT_2DROP,XT_EXIT .include "words/get-stack.asm" ; Tools ; Get a stack from EEPROM .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_GET_STACK: 000926 ff09 .dw $ff09 000927 6567 000928 2d74 000929 7473 00092a 6361 00092b 006b .db "get-stack",0 00092c 0919 .dw VE_HEAD .set VE_HEAD = VE_GET_STACK XT_GET_STACK: 00092d 3800 .dw DO_COLON .endif 00092e 38b0 .dw XT_DUP 00092f 3c8f .dw XT_CELLPLUS 000930 38c3 .dw XT_SWAP 000931 3b5e .dw XT_FETCHE 000932 38b0 .dw XT_DUP 000933 38fe .dw XT_TO_R 000934 3953 .dw XT_ZERO 000935 38c3 .dw XT_SWAP ; go from bigger to smaller addresses 000936 07eb .dw XT_QDOCHECK 000937 3835 .dw XT_DOCONDBRANCH 000938 0944 DEST(PFA_N_FETCH_E2) 000939 3a9a .dw XT_DODO PFA_N_FETCH_E1: ; ( ee-addr ) 00093a 3aab .dw XT_I 00093b 3a34 .dw XT_1MINUS 00093c 3ec3 .dw XT_CELLS ; ( -- ee-addr i*2 ) 00093d 38ce .dw XT_OVER ; ( -- ee-addr i*2 ee-addr ) 00093e 399c .dw XT_PLUS ; ( -- ee-addr ee-addr+i 00093f 3b5e .dw XT_FETCHE ;( -- ee-addr item_i ) 000940 38c3 .dw XT_SWAP ;( -- item_i ee-addr ) 000941 394a .dw XT_TRUE ; shortcut for -1 000942 3ab9 .dw XT_DOPLUSLOOP 000943 093a DEST(PFA_N_FETCH_E1) PFA_N_FETCH_E2: 000944 3ed1 .dw XT_2DROP 000945 38f5 .dw XT_R_FROM 000946 381f .dw XT_EXIT .include "words/set-stack.asm" ; Tools ; Write a stack to EEPROM .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SET_STACK: 000947 ff09 .dw $ff09 000948 6573 000949 2d74 00094a 7473 00094b 6361 00094c 006b .db "set-stack",0 00094d 0926 .dw VE_HEAD .set VE_HEAD = VE_SET_STACK XT_SET_STACK: 00094e 3800 .dw DO_COLON PFA_SET_STACK: .endif 00094f 38ce .dw XT_OVER 000950 3920 .dw XT_ZEROLESS 000951 3835 .dw XT_DOCONDBRANCH 000952 0956 DEST(PFA_SET_STACK0) 000953 383c .dw XT_DOLITERAL 000954 fffc .dw -4 000955 3d85 .dw XT_THROW PFA_SET_STACK0: 000956 3ec8 .dw XT_2DUP 000957 3b3a .dw XT_STOREE ; ( -- i_n .. i_0 n e-addr ) 000958 38c3 .dw XT_SWAP 000959 3953 .dw XT_ZERO 00095a 07eb .dw XT_QDOCHECK 00095b 3835 .dw XT_DOCONDBRANCH 00095c 0963 DEST(PFA_SET_STACK2) 00095d 3a9a .dw XT_DODO PFA_SET_STACK1: 00095e 3c8f .dw XT_CELLPLUS ; ( -- i_x e-addr ) 00095f 3ed9 .dw XT_TUCK ; ( -- e-addr i_x e-addr 000960 3b3a .dw XT_STOREE 000961 3ac8 .dw XT_DOLOOP 000962 095e DEST(PFA_SET_STACK1) PFA_SET_STACK2: 000963 38d8 .dw XT_DROP 000964 381f .dw XT_EXIT .include "words/map-stack.asm" ; Tools ; Iterate over a stack .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_MAPSTACK: 000965 ff09 .dw $ff09 000966 616d 000967 2d70 000968 7473 000969 6361 00096a 006b .db "map-stack",0 00096b 0947 .dw VE_HEAD .set VE_HEAD = VE_MAPSTACK XT_MAPSTACK: 00096c 3800 .dw DO_COLON PFA_MAPSTACK: .endif 00096d 38b0 .dw XT_DUP 00096e 3c8f .dw XT_CELLPLUS 00096f 38c3 .dw XT_SWAP 000970 3b5e .dw XT_FETCHE 000971 3ec3 .dw XT_CELLS 000972 3f98 .dw XT_BOUNDS 000973 07eb .dw XT_QDOCHECK 000974 3835 .dw XT_DOCONDBRANCH 000975 0988 DEST(PFA_MAPSTACK3) 000976 3a9a .dw XT_DODO PFA_MAPSTACK1: 000977 3aab .dw XT_I 000978 3b5e .dw XT_FETCHE ; -- i*x XT id 000979 38c3 .dw XT_SWAP 00097a 38fe .dw XT_TO_R 00097b 3907 .dw XT_R_FETCH 00097c 3829 .dw XT_EXECUTE ; i*x id -- j*y true | i*x false 00097d 38b8 .dw XT_QDUP 00097e 3835 .dw XT_DOCONDBRANCH 00097f 0984 DEST(PFA_MAPSTACK2) 000980 38f5 .dw XT_R_FROM 000981 38d8 .dw XT_DROP 000982 3ad3 .dw XT_UNLOOP 000983 381f .dw XT_EXIT PFA_MAPSTACK2: 000984 38f5 .dw XT_R_FROM 000985 3fea .dw XT_TWO 000986 3ab9 .dw XT_DOPLUSLOOP 000987 0977 DEST(PFA_MAPSTACK1) PFA_MAPSTACK3: 000988 38d8 .dw XT_DROP 000989 3953 .dw XT_ZERO 00098a 381f .dw XT_EXIT ; ; : map-stack ( i*x XT e-addr -- j*y ) ; dup cell+ swap @e cells bounds ?do ; ( -- i*x XT ) ; i @e swap >r r@ execute ; ?dup if r> drop unloop exit then ; r> ; 2 +loop drop 0 ; ; .include "words/get-current.asm" ; Search Order ; get the wid of the current compilation word list VE_GET_CURRENT: 00098b ff0b .dw $ff0b 00098c 6567 00098d 2d74 00098e 7563 00098f 7272 000990 6e65 000991 0074 .db "get-current",0 000992 0965 .dw VE_HEAD .set VE_HEAD = VE_GET_CURRENT XT_GET_CURRENT: 000993 3800 .dw DO_COLON PFA_GET_CURRENT: 000994 383c .dw XT_DOLITERAL 000995 0046 .dw CFG_CURRENT 000996 3b5e .dw XT_FETCHE 000997 381f .dw XT_EXIT .include "words/get-order.asm" ; Search Order ; Get the current search order word list .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_GET_ORDER: 000998 ff09 .dw $ff09 000999 6567 00099a 2d74 00099b 726f 00099c 6564 00099d 0072 .db "get-order",0 00099e 098b .dw VE_HEAD .set VE_HEAD = VE_GET_ORDER XT_GET_ORDER: 00099f 3800 .dw DO_COLON PFA_GET_ORDER: .endif 0009a0 383c .dw XT_DOLITERAL 0009a1 004a .dw CFG_ORDERLISTLEN 0009a2 092d .dw XT_GET_STACK 0009a3 381f .dw XT_EXIT .include "words/cfg-order.asm" ; Search Order ; Get the current search order word list .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_CFG_ORDER: 0009a4 ff09 .dw $ff09 0009a5 6663 0009a6 2d67 0009a7 726f 0009a8 6564 0009a9 0072 .db "cfg-order",0 0009aa 0998 .dw VE_HEAD .set VE_HEAD = VE_CFG_ORDER XT_CFG_ORDER: 0009ab 3847 .dw PFA_DOVARIABLE PFA_CFG_ORDER: .endif 0009ac 004a .dw CFG_ORDERLISTLEN .include "words/compare.asm" ; String ; compares two strings in RAM VE_COMPARE: 0009ad ff07 .dw $ff07 0009ae 6f63 0009af 706d 0009b0 7261 0009b1 0065 .db "compare",0 0009b2 09a4 .dw VE_HEAD .set VE_HEAD = VE_COMPARE XT_COMPARE: 0009b3 09b4 .dw PFA_COMPARE PFA_COMPARE: 0009b4 93bf push xh 0009b5 93af push xl 0009b6 018c movw temp0, tosl 0009b7 9189 0009b8 9199 loadtos 0009b9 01dc movw xl, tosl 0009ba 9189 0009bb 9199 loadtos 0009bc 019c movw temp2, tosl 0009bd 9189 0009be 9199 loadtos 0009bf 01fc movw zl, tosl PFA_COMPARE_LOOP: 0009c0 90ed ld temp4, X+ 0009c1 90f1 ld temp5, Z+ 0009c2 14ef cp temp4, temp5 0009c3 f451 brne PFA_COMPARE_NOTEQUAL 0009c4 950a dec temp0 0009c5 f019 breq PFA_COMPARE_ENDREACHED2 0009c6 952a dec temp2 0009c7 f7c1 brne PFA_COMPARE_LOOP 0009c8 c001 rjmp PFA_COMPARE_ENDREACHED PFA_COMPARE_ENDREACHED2: 0009c9 952a dec temp2 PFA_COMPARE_ENDREACHED: 0009ca 2b02 or temp0, temp2 0009cb f411 brne PFA_COMPARE_CHECKLASTCHAR 0009cc 2788 clr tosl 0009cd c002 rjmp PFA_COMPARE_DONE PFA_COMPARE_CHECKLASTCHAR: PFA_COMPARE_NOTEQUAL: 0009ce ef8f ser tosl 0009cf c000 rjmp PFA_COMPARE_DONE PFA_COMPARE_DONE: 0009d0 2f98 mov tosh, tosl 0009d1 91af pop xl 0009d2 91bf pop xh 0009d3 940c 3804 jmp_ DO_NEXT .include "words/nfa2lfa.asm" ; System ; get the link field address from the name field address VE_NFA2LFA: 0009d5 ff07 .dw $ff07 0009d6 666e 0009d7 3e61 0009d8 666c 0009d9 0061 .db "nfa>lfa",0 0009da 09ad .dw VE_HEAD .set VE_HEAD = VE_NFA2LFA XT_NFA2LFA: 0009db 3800 .dw DO_COLON PFA_NFA2LFA: 0009dc 06ba .dw XT_NAME2STRING 0009dd 3a2e .dw XT_1PLUS 0009de 3a03 .dw XT_2SLASH 0009df 399c .dw XT_PLUS 0009e0 381f .dw XT_EXIT .elif AMFORTH_NRWW_SIZE > 2000 .else .endif .include "dict_appl.inc" ; they may be moved to the core dictionary if needed .include "dict/compiler2.inc" ; additional words for the compiler ; included almost independently from each other ; on a include-per-use basis ; .if DICT_COMPILER2 == 0 .set DICT_COMPILER2 = 1 .include "words/set-current.asm" ; Search Order ; set current word list to the given word list wid VE_SET_CURRENT: 0009e1 ff0b .dw $ff0b 0009e2 6573 0009e3 2d74 0009e4 7563 0009e5 7272 0009e6 6e65 0009e7 0074 .db "set-current",0 0009e8 09d5 .dw VE_HEAD .set VE_HEAD = VE_SET_CURRENT XT_SET_CURRENT: 0009e9 3800 .dw DO_COLON PFA_SET_CURRENT: 0009ea 383c .dw XT_DOLITERAL 0009eb 0046 .dw CFG_CURRENT 0009ec 3b3a .dw XT_STOREE 0009ed 381f .dw XT_EXIT .include "words/wordlist.asm" ; Search Order ; create a new, empty wordlist VE_WORDLIST: 0009ee ff08 .dw $ff08 0009ef 6f77 0009f0 6472 0009f1 696c 0009f2 7473 .db "wordlist" 0009f3 09e1 .dw VE_HEAD .set VE_HEAD = VE_WORDLIST XT_WORDLIST: 0009f4 3800 .dw DO_COLON PFA_WORDLIST: 0009f5 3f1a .dw XT_EHERE 0009f6 3953 .dw XT_ZERO 0009f7 38ce .dw XT_OVER 0009f8 3b3a .dw XT_STOREE 0009f9 38b0 .dw XT_DUP 0009fa 3c8f .dw XT_CELLPLUS 0009fb 0173 .dw XT_DOTO 0009fc 3f1b .dw PFA_EHERE 0009fd 381f .dw XT_EXIT .include "words/forth-wordlist.asm" ; Search Order ; get the system default word list VE_FORTHWORDLIST: 0009fe ff0e .dw $ff0e 0009ff 6f66 000a00 7472 000a01 2d68 000a02 6f77 000a03 6472 000a04 696c 000a05 7473 .db "forth-wordlist" 000a06 09ee .dw VE_HEAD .set VE_HEAD = VE_FORTHWORDLIST XT_FORTHWORDLIST: 000a07 3847 .dw PFA_DOVARIABLE PFA_FORTHWORDLIST: 000a08 0048 .dw CFG_FORTHWORDLIST .include "words/set-order.asm" ; Search Order ; replace the search order list .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SET_ORDER: 000a09 ff09 .dw $ff09 000a0a 6573 000a0b 2d74 000a0c 726f 000a0d 6564 000a0e 0072 .db "set-order",0 000a0f 09fe .dw VE_HEAD .set VE_HEAD = VE_SET_ORDER XT_SET_ORDER: 000a10 3800 .dw DO_COLON PFA_SET_ORDER: .endif 000a11 383c .dw XT_DOLITERAL 000a12 004a .dw CFG_ORDERLISTLEN 000a13 094e .dw XT_SET_STACK 000a14 381f .dw XT_EXIT .include "words/set-recognizer.asm" ; Interpreter ; replace the recognizer list .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SET_RECOGNIZERS: 000a15 ff0f .dw $ff0f 000a16 6573 000a17 2d74 000a18 6572 000a19 6f63 000a1a 6e67 000a1b 7a69 000a1c 7265 000a1d 0073 .db "set-recognizers",0 000a1e 0a09 .dw VE_HEAD .set VE_HEAD = VE_SET_RECOGNIZERS XT_SET_RECOGNIZERS: 000a1f 3800 .dw DO_COLON PFA_SET_RECOGNIZERS: .endif 000a20 383c .dw XT_DOLITERAL 000a21 005c .dw CFG_RECOGNIZERLISTLEN 000a22 094e .dw XT_SET_STACK 000a23 381f .dw XT_EXIT .include "words/get-recognizer.asm" ; Interpreter ; Get the current recognizer list .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_GET_RECOGNIZERS: 000a24 ff0f .dw $ff0f 000a25 6567 000a26 2d74 000a27 6572 000a28 6f63 000a29 6e67 000a2a 7a69 000a2b 7265 000a2c 0073 .db "get-recognizers",0 000a2d 0a15 .dw VE_HEAD .set VE_HEAD = VE_GET_RECOGNIZERS XT_GET_RECOGNIZERS: 000a2e 3800 .dw DO_COLON PFA_GET_RECOGNIZERS: .endif 000a2f 383c .dw XT_DOLITERAL 000a30 005c .dw CFG_RECOGNIZERLISTLEN 000a31 092d .dw XT_GET_STACK 000a32 381f .dw XT_EXIT .include "words/code.asm" ; Compiler ; create named entry in the dictionary, XT is the data field VE_CODE: 000a33 ff04 .dw $ff04 000a34 6f63 000a35 6564 .db "code" 000a36 0a24 .dw VE_HEAD .set VE_HEAD = VE_CODE XT_CODE: 000a37 3800 .dw DO_COLON PFA_CODE: 000a38 06fe .dw XT_DOCREATE 000a39 085e .dw XT_REVEAL 000a3a 3f11 .dw XT_DP 000a3b 0185 .dw XT_ICELLPLUS 000a3c 072c .dw XT_COMMA 000a3d 381f .dw XT_EXIT .include "words/end-code.asm" ; Compiler ; finish a code definition VE_ENDCODE: 000a3e ff08 .dw $ff08 000a3f 6e65 000a40 2d64 000a41 6f63 000a42 6564 .db "end-code" 000a43 0a33 .dw VE_HEAD .set VE_HEAD = VE_ENDCODE XT_ENDCODE: 000a44 3800 .dw DO_COLON PFA_ENDCODE: 000a45 0721 .dw XT_COMPILE 000a46 940c .dw $940c 000a47 0721 .dw XT_COMPILE 000a48 3804 .dw DO_NEXT 000a49 381f .dw XT_EXIT .include "words/marker.asm" ; System Value ; The eeprom address until which MARKER saves and restores the eeprom data. VE_MARKER: 000a4a ff08 .dw $ff08 000a4b 6d28 000a4c 7261 000a4d 656b 000a4e 2972 .db "(marker)" 000a4f 0a3e .dw VE_HEAD .set VE_HEAD = VE_MARKER XT_MARKER: 000a50 386e .dw PFA_DOVALUE1 PFA_MARKER: 000a51 0068 .dw EE_MARKER 000a52 3d9f .dw XT_EDEFERFETCH 000a53 3da9 .dw XT_EDEFERSTORE .include "words/postpone.asm" ; Compiler ; Append the compilation semantics of "name" to the dictionary .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_POSTPONE: 000a54 0008 .dw $0008 000a55 6f70 000a56 7473 000a57 6f70 000a58 656e .db "postpone" 000a59 0a4a .dw VE_HEAD .set VE_HEAD = VE_POSTPONE XT_POSTPONE: 000a5a 3800 .dw DO_COLON PFA_POSTPONE: .endif 000a5b 0580 .dw XT_PARSENAME 000a5c 05c3 .dw XT_FORTHRECOGNIZER 000a5d 05ce .dw XT_RECOGNIZE 000a5e 38b0 .dw XT_DUP 000a5f 38fe .dw XT_TO_R 000a60 0185 .dw XT_ICELLPLUS 000a61 0185 .dw XT_ICELLPLUS 000a62 3bca .dw XT_FETCHI 000a63 3829 .dw XT_EXECUTE 000a64 38f5 .dw XT_R_FROM 000a65 0185 .dw XT_ICELLPLUS 000a66 3bca .dw XT_FETCHI 000a67 072c .dw XT_COMMA 000a68 381f .dw XT_EXIT .endif .include "words/applturnkey.asm" ; R( -- ) ; application specific turnkey action VE_APPLTURNKEY: 000a69 ff0b .dw $ff0b 000a6a 7061 000a6b 6c70 000a6c 7574 000a6d 6e72 000a6e 656b 000a6f 0079 .db "applturnkey",0 000a70 0a54 .dw VE_HEAD .set VE_HEAD = VE_APPLTURNKEY XT_APPLTURNKEY: 000a71 3800 .dw DO_COLON PFA_APPLTURNKEY: 000a72 00c7 .dw XT_USART .if WANT_INTERRUPTS == 1 000a73 3c96 .dw XT_INTON .endif 000a74 013e .dw XT_DOT_VER 000a75 3fad .dw XT_SPACE 000a76 0395 .dw XT_DOSLITERAL 000a77 000a .dw 10 000a78 6f46 000a79 7472 000a7a 6468 000a7b 6975 000a7c 6f6e .db "Forthduino" 000a7d 03c8 .dw XT_ITYPE 000a7e 381f .dw XT_EXIT .set DPSTART = pc .if(pc>AMFORTH_RO_SEG) .endif .org AMFORTH_RO_SEG .include "amforth-interpreter.asm" DO_COLON: 003800 93bf push XH 003801 93af push XL ; PUSH IP 003802 01db movw XL, wl 003803 9611 adiw xl, 1 DO_NEXT: .if WANT_INTERRUPTS == 1 003804 14b2 cp isrflag, zerol 003805 f469 brne DO_INTERRUPT .endif 003806 01fd movw zl, XL ; READ IP 003807 0fee 003808 1fff 003809 9165 00380a 9175 readflashcell wl, wh 00380b 9611 adiw XL, 1 ; INC IP DO_EXECUTE: 00380c 01fb movw zl, wl 00380d 0fee 00380e 1fff 00380f 9105 003810 9115 readflashcell temp0,temp1 003811 01f8 movw zl, temp0 003812 9409 ijmp .if WANT_INTERRUPTS == 1 DO_INTERRUPT: ; here we deal with interrupts the forth way 003813 939a 003814 938a savetos 003815 2d8b mov tosl, isrflag 003816 2799 clr tosh 003817 24bb clr isrflag 003818 eb6f ldi wl, LOW(XT_ISREXEC) 003819 e37c ldi wh, HIGH(XT_ISREXEC) 00381a cff1 rjmp DO_EXECUTE .include "dict/nrww.inc" ; section together with the forth inner interpreter .include "words/exit.asm" ; Compiler ; end of current colon word VE_EXIT: 00381b ff04 .dw $ff04 00381c 7865 00381d 7469 .db "exit" 00381e 0a69 .dw VE_HEAD .set VE_HEAD = VE_EXIT XT_EXIT: 00381f 3820 .dw PFA_EXIT PFA_EXIT: 003820 91af pop XL 003821 91bf pop XH 003822 cfe1 jmp_ DO_NEXT .include "words/execute.asm" ; System ; execute XT VE_EXECUTE: 003823 ff07 .dw $ff07 003824 7865 003825 6365 003826 7475 003827 0065 .db "execute",0 003828 381b .dw VE_HEAD .set VE_HEAD = VE_EXECUTE XT_EXECUTE: 003829 382a .dw PFA_EXECUTE PFA_EXECUTE: 00382a 01bc movw wl, tosl 00382b 9189 00382c 9199 loadtos 00382d cfde jmp_ DO_EXECUTE .include "words/dobranch.asm" ; System ; runtime of branch ;VE_DOBRANCH: ; .dw $ff08 ; .db "(branch)" ; .dw VE_HEAD ; .set VE_HEAD = VE_DOBRANCH XT_DOBRANCH: 00382e 382f .dw PFA_DOBRANCH PFA_DOBRANCH: 00382f 01fd movw zl, XL 003830 0fee 003831 1fff 003832 91a5 003833 91b5 readflashcell XL,XH 003834 cfcf jmp_ DO_NEXT .include "words/docondbranch.asm" ; System ; runtime of ?branch ;VE_DOCONDBRANCH: ; .dw $ff09 ; .db "(?branch)" ; .dw VE_HEAD ; .set VE_HEAD = VE_DOCONDBRANCH XT_DOCONDBRANCH: 003835 3836 .dw PFA_DOCONDBRANCH PFA_DOCONDBRANCH: 003836 2b98 or tosh, tosl 003837 9189 003838 9199 loadtos 003839 f3a9 brbs 1, PFA_DOBRANCH ; 1 is z flag; if tos is zero (false), do the branch 00383a 9611 adiw XL, 1 00383b cfc8 jmp_ DO_NEXT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .include "words/doliteral.asm" ; System ; runtime of literal ;VE_DOLITERAL: ; .dw $ff09 ; .db "(literal)" ; .dw VE_HEAD ; .set VE_HEAD = VE_DOLITERAL XT_DOLITERAL: 00383c 383d .dw PFA_DOLITERAL PFA_DOLITERAL: 00383d 939a 00383e 938a savetos 00383f 01fd movw zl, xl 003840 0fee 003841 1fff 003842 9185 003843 9195 readflashcell tosl,tosh 003844 9611 adiw xl, 1 003845 cfbe jmp_ DO_NEXT .include "words/dovariable.asm" ; System ; puts content of parameter field (1 cell) to TOS ;VE_DOVARIABLE: ; .dw $ff0a ; .db "(variable)" ; .dw VE_HEAD ; .set VE_HEAD = VE_DOVARIABLE XT_DOVARIABLE: 003846 3847 .dw PFA_DOVARIABLE PFA_DOVARIABLE: 003847 939a 003848 938a savetos 003849 01fb movw zl, wl 00384a 9631 adiw zl,1 00384b 0fee 00384c 1fff 00384d 9185 00384e 9195 readflashcell tosl,tosh 00384f cfb4 jmp_ DO_NEXT .include "words/doconstant.asm" ; System ; place data field address on TOS ;VE_DOCONSTANT: ; .dw $ff0a ; .db "(constant)" ; .dw VE_HEAD ; .set VE_HEAD = VE_DOCONSTANT XT_DOCONSTANT: 003850 3851 .dw PFA_DOCONSTANT PFA_DOCONSTANT: 003851 939a 003852 938a savetos 003853 01cb movw tosl, wl 003854 9601 adiw tosl, 1 003855 cfae jmp_ DO_NEXT .include "words/douser.asm" ; System ; runtime part of user ;VE_DOUSER: ; .dw $ff06 ; .db "(user)" ; .dw VE_HEAD ; .set VE_HEAD = VE_DOUSER XT_DOUSER: 003856 3857 .dw PFA_DOUSER PFA_DOUSER: 003857 939a 003858 938a savetos 003859 01fb movw zl, wl 00385a 9631 adiw zl, 1 00385b 0fee 00385c 1fff 00385d 9185 00385e 9195 readflashcell tosl,tosh 00385f 0d84 add tosl, upl 003860 1d95 adc tosh, uph 003861 cfa2 jmp_ DO_NEXT .include "words/do-value.asm" ; System ; runtime of value VE_DOVALUE: 003862 ff07 .dw $ff07 003863 7628 003864 6c61 003865 6575 003866 0029 .db "(value)", 0 003867 3823 .dw VE_HEAD .set VE_HEAD = VE_DOVALUE XT_DOVALUE: 003868 3800 .dw DO_COLON PFA_DOVALUE: 003869 06fe .dw XT_DOCREATE 00386a 085e .dw XT_REVEAL 00386b 0721 .dw XT_COMPILE 00386c 386e .dw PFA_DOVALUE1 00386d 381f .dw XT_EXIT PFA_DOVALUE1: 00386e 940e 0877 call_ DO_DODOES 003870 38b0 .dw XT_DUP 003871 0185 .dw XT_ICELLPLUS 003872 3bca .dw XT_FETCHI 003873 3829 .dw XT_EXECUTE 003874 381f .dw XT_EXIT ; : (value) dup icell+ @i execute ; .include "words/fetch.asm" ; Memory ; read 1 cell from RAM address VE_FETCH: 003875 ff01 .dw $ff01 003876 0040 .db "@",0 003877 3862 .dw VE_HEAD .set VE_HEAD = VE_FETCH XT_FETCH: 003878 3879 .dw PFA_FETCH PFA_FETCH: .if WANT_UNIFIED == 1 .endif PFA_FETCHRAM: 003879 01fc movw zl, tosl ; low byte is read before the high byte 00387a 9181 ld tosl, z+ 00387b 9191 ld tosh, z+ 00387c cf87 jmp_ DO_NEXT .if WANT_UNIFIED == 1 .endif .include "words/store.asm" ; Memory ; write n to RAM memory at addr, low byte first VE_STORE: 00387d ff01 .dw $ff01 00387e 0021 .db "!",0 00387f 3875 .dw VE_HEAD .set VE_HEAD = VE_STORE XT_STORE: 003880 3881 .dw PFA_STORE PFA_STORE: .if WANT_UNIFIED == 1 .endif PFA_STORERAM: 003881 01fc movw zl, tosl 003882 9189 003883 9199 loadtos ; the high byte is written before the low byte 003884 8391 std Z+1, tosh 003885 8380 std Z+0, tosl 003886 9189 003887 9199 loadtos 003888 cf7b jmp_ DO_NEXT .if WANT_UNIFIED == 1 .endif .include "words/cstore.asm" ; Memory ; store a single byte to RAM address VE_CSTORE: 003889 ff02 .dw $ff02 00388a 2163 .db "c!" 00388b 387d .dw VE_HEAD .set VE_HEAD = VE_CSTORE XT_CSTORE: 00388c 388d .dw PFA_CSTORE PFA_CSTORE: 00388d 01fc movw zl, tosl 00388e 9189 00388f 9199 loadtos 003890 8380 st Z, tosl 003891 9189 003892 9199 loadtos 003893 cf70 jmp_ DO_NEXT .include "words/cfetch.asm" ; Memory ; fetch a single byte from memory mapped locations VE_CFETCH: 003894 ff02 .dw $ff02 003895 4063 .db "c@" 003896 3889 .dw VE_HEAD .set VE_HEAD = VE_CFETCH XT_CFETCH: 003897 3898 .dw PFA_CFETCH PFA_CFETCH: 003898 01fc movw zl, tosl 003899 2799 clr tosh 00389a 8180 ld tosl, Z 00389b cf68 jmp_ DO_NEXT .include "words/fetch-u.asm" ; Memory ; read 1 cell from USER area VE_FETCHU: 00389c ff02 .dw $ff02 00389d 7540 .db "@u" 00389e 3894 .dw VE_HEAD .set VE_HEAD = VE_FETCHU XT_FETCHU: 00389f 3800 .dw DO_COLON PFA_FETCHU: 0038a0 3b01 .dw XT_UP_FETCH 0038a1 399c .dw XT_PLUS 0038a2 3878 .dw XT_FETCH 0038a3 381f .dw XT_EXIT .include "words/store-u.asm" ; Memory ; write n to USER area at offset VE_STOREU: 0038a4 ff02 .dw $ff02 0038a5 7521 .db "!u" 0038a6 389c .dw VE_HEAD .set VE_HEAD = VE_STOREU XT_STOREU: 0038a7 3800 .dw DO_COLON PFA_STOREU: 0038a8 3b01 .dw XT_UP_FETCH 0038a9 399c .dw XT_PLUS 0038aa 3880 .dw XT_STORE 0038ab 381f .dw XT_EXIT ;;;;;;;;;;;;;;;;;;;;;;;;; .include "words/dup.asm" ; Stack ; duplicate TOS VE_DUP: 0038ac ff03 .dw $ff03 0038ad 7564 0038ae 0070 .db "dup",0 0038af 38a4 .dw VE_HEAD .set VE_HEAD = VE_DUP XT_DUP: 0038b0 38b1 .dw PFA_DUP PFA_DUP: 0038b1 939a 0038b2 938a savetos 0038b3 cf50 jmp_ DO_NEXT .include "words/qdup.asm" ; Stack ; duplicate TOS if non-zero VE_QDUP: 0038b4 ff04 .dw $ff04 0038b5 643f 0038b6 7075 .db "?dup" 0038b7 38ac .dw VE_HEAD .set VE_HEAD = VE_QDUP XT_QDUP: 0038b8 38b9 .dw PFA_QDUP PFA_QDUP: 0038b9 2f08 mov temp0, tosl 0038ba 2b09 or temp0, tosh 0038bb f011 breq PFA_QDUP1 0038bc 939a 0038bd 938a savetos PFA_QDUP1: 0038be cf45 jmp_ DO_NEXT .include "words/swap.asm" ; Stack ; swaps the two top level stack cells VE_SWAP: 0038bf ff04 .dw $ff04 0038c0 7773 0038c1 7061 .db "swap" 0038c2 38b4 .dw VE_HEAD .set VE_HEAD = VE_SWAP XT_SWAP: 0038c3 38c4 .dw PFA_SWAP PFA_SWAP: 0038c4 018c movw temp0, tosl 0038c5 9189 0038c6 9199 loadtos 0038c7 931a st -Y, temp1 0038c8 930a st -Y, temp0 0038c9 cf3a jmp_ DO_NEXT .include "words/over.asm" ; Stack ; Place a copy of x1 on top of the stack VE_OVER: 0038ca ff04 .dw $ff04 0038cb 766f 0038cc 7265 .db "over" 0038cd 38bf .dw VE_HEAD .set VE_HEAD = VE_OVER XT_OVER: 0038ce 38cf .dw PFA_OVER PFA_OVER: 0038cf 939a 0038d0 938a savetos 0038d1 818a ldd tosl, Y+2 0038d2 819b ldd tosh, Y+3 0038d3 cf30 jmp_ DO_NEXT .include "words/drop.asm" ; Stack ; drop TOS VE_DROP: 0038d4 ff04 .dw $ff04 0038d5 7264 0038d6 706f .db "drop" 0038d7 38ca .dw VE_HEAD .set VE_HEAD = VE_DROP XT_DROP: 0038d8 38d9 .dw PFA_DROP PFA_DROP: 0038d9 9189 0038da 9199 loadtos 0038db cf28 jmp_ DO_NEXT .include "words/rot.asm" ; Stack ; rotate the three top level cells VE_ROT: 0038dc ff03 .dw $ff03 0038dd 6f72 0038de 0074 .db "rot",0 0038df 38d4 .dw VE_HEAD .set VE_HEAD = VE_ROT XT_ROT: 0038e0 38e1 .dw PFA_ROT PFA_ROT: 0038e1 018c movw temp0, tosl 0038e2 9129 ld temp2, Y+ 0038e3 9139 ld temp3, Y+ 0038e4 9189 0038e5 9199 loadtos 0038e6 933a st -Y, temp3 0038e7 932a st -Y, temp2 0038e8 931a st -Y, temp1 0038e9 930a st -Y, temp0 0038ea cf19 jmp_ DO_NEXT .include "words/nip.asm" ; Stack ; Remove Second of Stack VE_NIP: 0038eb ff03 .dw $ff03 0038ec 696e 0038ed 0070 .db "nip",0 0038ee 38dc .dw VE_HEAD .set VE_HEAD = VE_NIP XT_NIP: 0038ef 38f0 .dw PFA_NIP PFA_NIP: 0038f0 9622 adiw yl, 2 0038f1 cf12 jmp_ DO_NEXT ;;;;;;;;;;;;;;;;;;;;;;;;; .include "words/r_from.asm" ; Stack ; move TOR to TOS VE_R_FROM: 0038f2 ff02 .dw $ff02 0038f3 3e72 .db "r>" 0038f4 38eb .dw VE_HEAD .set VE_HEAD = VE_R_FROM XT_R_FROM: 0038f5 38f6 .dw PFA_R_FROM PFA_R_FROM: 0038f6 939a 0038f7 938a savetos 0038f8 918f pop tosl 0038f9 919f pop tosh 0038fa cf09 jmp_ DO_NEXT .include "words/to_r.asm" ; Stack ; move TOS to TOR VE_TO_R: 0038fb ff02 .dw $ff02 0038fc 723e .db ">r" 0038fd 38f2 .dw VE_HEAD .set VE_HEAD = VE_TO_R XT_TO_R: 0038fe 38ff .dw PFA_TO_R PFA_TO_R: 0038ff 939f push tosh 003900 938f push tosl 003901 9189 003902 9199 loadtos 003903 cf00 jmp_ DO_NEXT .include "words/r_fetch.asm" ; Stack ; fetch content of TOR VE_R_FETCH: 003904 ff02 .dw $ff02 003905 4072 .db "r@" 003906 38fb .dw VE_HEAD .set VE_HEAD = VE_R_FETCH XT_R_FETCH: 003907 3908 .dw PFA_R_FETCH PFA_R_FETCH: 003908 939a 003909 938a savetos 00390a 918f pop tosl 00390b 919f pop tosh 00390c 939f push tosh 00390d 938f push tosl 00390e cef5 jmp_ DO_NEXT .include "words/not-equal.asm" ; Compare ; true if n1 is not equal to n2 .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_NOTEQUAL: 00390f ff02 .dw $ff02 003910 3e3c .db "<>" 003911 3904 .dw VE_HEAD .set VE_HEAD = VE_NOTEQUAL XT_NOTEQUAL: 003912 3800 .dw DO_COLON PFA_NOTEQUAL: .endif 003913 3fde 003914 3919 003915 381f .DW XT_EQUAL,XT_ZEROEQUAL,XT_EXIT .include "words/equalzero.asm" ; Compare ; compare with 0 (zero) VE_ZEROEQUAL: 003916 ff02 .dw $ff02 003917 3d30 .db "0=" 003918 390f .dw VE_HEAD .set VE_HEAD = VE_ZEROEQUAL XT_ZEROEQUAL: 003919 391a .dw PFA_ZEROEQUAL PFA_ZEROEQUAL: 00391a 2b98 or tosh, tosl 00391b f5d1 brne PFA_ZERO1 00391c c030 rjmp PFA_TRUE1 .include "words/lesszero.asm" ; Compare ; compare with zero VE_ZEROLESS: 00391d ff02 .dw $ff02 00391e 3c30 .db "0<" 00391f 3916 .dw VE_HEAD .set VE_HEAD = VE_ZEROLESS XT_ZEROLESS: 003920 3921 .dw PFA_ZEROLESS PFA_ZEROLESS: 003921 fd97 sbrc tosh,7 003922 c02a rjmp PFA_TRUE1 003923 c032 rjmp PFA_ZERO1 .include "words/greaterzero.asm" ; Compare ; true if n1 is greater than 0 VE_GREATERZERO: 003924 ff02 .dw $ff02 003925 3e30 .db "0>" 003926 391d .dw VE_HEAD .set VE_HEAD = VE_GREATERZERO XT_GREATERZERO: 003927 3928 .dw PFA_GREATERZERO PFA_GREATERZERO: 003928 1582 cp tosl, zerol 003929 0593 cpc tosh, zeroh 00392a f15c brlt PFA_ZERO1 00392b f151 brbs 1, PFA_ZERO1 00392c c020 rjmp PFA_TRUE1 .include "words/d-greaterzero.asm" ; Compare ; compares if a double double cell number is greater 0 VE_DGREATERZERO: 00392d ff03 .dw $ff03 00392e 3064 00392f 003e .db "d0>",0 003930 3924 .dw VE_HEAD .set VE_HEAD = VE_DGREATERZERO XT_DGREATERZERO: 003931 3932 .dw PFA_DGREATERZERO PFA_DGREATERZERO: 003932 1582 cp tosl, zerol 003933 0593 cpc tosh, zeroh 003934 9189 003935 9199 loadtos 003936 0582 cpc tosl, zerol 003937 0593 cpc tosh, zeroh 003938 f0ec brlt PFA_ZERO1 003939 f0e1 brbs 1, PFA_ZERO1 00393a c012 rjmp PFA_TRUE1 .include "words/d-lesszero.asm" ; Compare ; compares if a double double cell number is less than 0 VE_DXT_ZEROLESS: 00393b ff03 .dw $ff03 00393c 3064 00393d 003c .db "d0<",0 00393e 392d .dw VE_HEAD .set VE_HEAD = VE_DXT_ZEROLESS XT_DXT_ZEROLESS: 00393f 3940 .dw PFA_DXT_ZEROLESS PFA_DXT_ZEROLESS: 003940 9622 adiw Y,2 003941 fd97 sbrc tosh,7 003942 940c 394d jmp PFA_TRUE1 003944 940c 3956 jmp PFA_ZERO1 .include "words/true.asm" ; Arithmetics ; leaves the value -1 (true) on TOS VE_TRUE: 003946 ff04 .dw $ff04 003947 7274 003948 6575 .db "true" 003949 393b .dw VE_HEAD .set VE_HEAD = VE_TRUE XT_TRUE: 00394a 394b .dw PFA_TRUE PFA_TRUE: 00394b 939a 00394c 938a savetos PFA_TRUE1: 00394d ef8f ser tosl 00394e ef9f ser tosh 00394f ceb4 jmp_ DO_NEXT .include "words/zero.asm" ; Arithmetics ; place a value 0 on TOS VE_ZERO: 003950 ff01 .dw $ff01 003951 0030 .db "0",0 003952 3946 .dw VE_HEAD .set VE_HEAD = VE_ZERO XT_ZERO: 003953 3954 .dw PFA_ZERO PFA_ZERO: 003954 939a 003955 938a savetos PFA_ZERO1: 003956 01c1 movw tosl, zerol 003957 ceac jmp_ DO_NEXT .include "words/uless.asm" ; Compare ; true if u1 < u2 (unsigned) VE_ULESS: 003958 ff02 .dw $ff02 003959 3c75 .db "u<" 00395a 3950 .dw VE_HEAD .set VE_HEAD = VE_ULESS XT_ULESS: 00395b 395c .dw PFA_ULESS PFA_ULESS: 00395c 9129 ld temp2, Y+ 00395d 9139 ld temp3, Y+ 00395e 1782 cp tosl, temp2 00395f 0793 cpc tosh, temp3 003960 f3a8 brlo PFA_ZERO1 003961 f3a1 brbs 1, PFA_ZERO1 003962 cfea jmp_ PFA_TRUE1 .include "words/u-greater.asm" ; Compare ; true if u1 > u2 (unsigned) .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_UGREATER: 003963 ff02 .dw $ff02 003964 3e75 .db "u>" 003965 3958 .dw VE_HEAD .set VE_HEAD = VE_UGREATER XT_UGREATER: 003966 3800 .dw DO_COLON PFA_UGREATER: .endif 003967 38c3 .DW XT_SWAP 003968 395b .dw XT_ULESS 003969 381f .dw XT_EXIT .include "words/less.asm" ; Compare ; true if n1 is less than n2 VE_LESS: 00396a ff01 .dw $ff01 00396b 003c .db "<",0 00396c 3963 .dw VE_HEAD .set VE_HEAD = VE_LESS XT_LESS: 00396d 396e .dw PFA_LESS PFA_LESS: 00396e 9129 ld temp2, Y+ 00396f 9139 ld temp3, Y+ 003970 1728 cp temp2, tosl 003971 0739 cpc temp3, tosh PFA_LESSDONE: 003972 f71c brge PFA_ZERO1 003973 cfd9 rjmp PFA_TRUE1 .include "words/greater.asm" ; Compare ; flag is true if n1 is greater than n2 VE_GREATER: 003974 ff01 .dw $ff01 003975 003e .db ">",0 003976 396a .dw VE_HEAD .set VE_HEAD = VE_GREATER XT_GREATER: 003977 3978 .dw PFA_GREATER PFA_GREATER: 003978 9129 ld temp2, Y+ 003979 9139 ld temp3, Y+ 00397a 1728 cp temp2, tosl 00397b 0739 cpc temp3, tosh PFA_GREATERDONE: 00397c f2cc brlt PFA_ZERO1 00397d f2c1 brbs 1, PFA_ZERO1 00397e cfce rjmp PFA_TRUE1 .include "words/log2.asm" ; Arithmetics ; logarithm to base 2 or highest set bitnumber VE_LOG2: 00397f ff04 .dw $ff04 003980 6f6c 003981 3267 .db "log2" 003982 3974 .dw VE_HEAD .set VE_HEAD = VE_LOG2 XT_LOG2: 003983 3984 .dw PFA_LOG2 PFA_LOG2: 003984 01fc movw zl, tosl 003985 2799 clr tosh 003986 e180 ldi tosl, 16 PFA_LOG2_1: 003987 958a dec tosl 003988 f022 brmi PFA_LOG2_2 ; wrong data 003989 0fee lsl zl 00398a 1fff rol zh 00398b f7d8 brcc PFA_LOG2_1 00398c ce77 jmp_ DO_NEXT PFA_LOG2_2: 00398d 959a dec tosh 00398e ce75 jmp_ DO_NEXT .include "words/minus.asm" ; Arithmetics ; subtract n2 from n1 VE_MINUS: 00398f ff01 .dw $ff01 003990 002d .db "-",0 003991 397f .dw VE_HEAD .set VE_HEAD = VE_MINUS XT_MINUS: 003992 3993 .dw PFA_MINUS PFA_MINUS: 003993 9109 ld temp0, Y+ 003994 9119 ld temp1, Y+ 003995 1b08 sub temp0, tosl 003996 0b19 sbc temp1, tosh 003997 01c8 movw tosl, temp0 003998 ce6b jmp_ DO_NEXT .include "words/plus.asm" ; Arithmetics ; add n1 and n2 VE_PLUS: 003999 ff01 .dw $ff01 00399a 002b .db "+",0 00399b 398f .dw VE_HEAD .set VE_HEAD = VE_PLUS XT_PLUS: 00399c 399d .dw PFA_PLUS PFA_PLUS: 00399d 9109 ld temp0, Y+ 00399e 9119 ld temp1, Y+ 00399f 0f80 add tosl, temp0 0039a0 1f91 adc tosh, temp1 0039a1 ce62 jmp_ DO_NEXT .include "words/mstar.asm" ; Arithmetics ; multiply 2 cells to a double cell VE_MSTAR: 0039a2 ff02 .dw $ff02 0039a3 2a6d .db "m*" 0039a4 3999 .dw VE_HEAD .set VE_HEAD = VE_MSTAR XT_MSTAR: 0039a5 39a6 .dw PFA_MSTAR PFA_MSTAR: 0039a6 018c movw temp0, tosl 0039a7 9189 0039a8 9199 loadtos 0039a9 019c movw temp2, tosl ; high cell ah*bh 0039aa 0231 muls temp3, temp1 0039ab 0170 movw temp4, r0 ; low cell al*bl 0039ac 9f20 mul temp2, temp0 0039ad 01c0 movw tosl, r0 ; signed ah*bl 0039ae 0330 mulsu temp3, temp0 0039af 08f3 sbc temp5, zeroh 0039b0 0d90 add tosh, r0 0039b1 1ce1 adc temp4, r1 0039b2 1cf3 adc temp5, zeroh ; signed al*bh 0039b3 0312 mulsu temp1, temp2 0039b4 08f3 sbc temp5, zeroh 0039b5 0d90 add tosh, r0 0039b6 1ce1 adc temp4, r1 0039b7 1cf3 adc temp5, zeroh 0039b8 939a 0039b9 938a savetos 0039ba 01c7 movw tosl, temp4 0039bb ce48 jmp_ DO_NEXT .include "words/umslashmod.asm" ; Arithmetics ; unsigned division ud / u2 with remainder VE_UMSLASHMOD: 0039bc ff06 .dw $ff06 0039bd 6d75 0039be 6d2f 0039bf 646f .db "um/mod" 0039c0 39a2 .dw VE_HEAD .set VE_HEAD = VE_UMSLASHMOD XT_UMSLASHMOD: 0039c1 39c2 .dw PFA_UMSLASHMOD PFA_UMSLASHMOD: 0039c2 017c movw temp4, tosl 0039c3 9129 ld temp2, Y+ 0039c4 9139 ld temp3, Y+ 0039c5 9109 ld temp0, Y+ 0039c6 9119 ld temp1, Y+ ;; unsigned 32/16 -> 16r16 divide PFA_UMSLASHMODmod: ; set loop counter 0039c7 e140 ldi temp6,$10 PFA_UMSLASHMODmod_loop: ; shift left, saving high bit 0039c8 2755 clr temp7 0039c9 0f00 lsl temp0 0039ca 1f11 rol temp1 0039cb 1f22 rol temp2 0039cc 1f33 rol temp3 0039cd 1f55 rol temp7 ; try subtracting divisor 0039ce 152e cp temp2, temp4 0039cf 053f cpc temp3, temp5 0039d0 0552 cpc temp7,zerol 0039d1 f018 brcs PFA_UMSLASHMODmod_loop_control PFA_UMSLASHMODmod_subtract: ; dividend is large enough ; do the subtraction for real ; and set lowest bit 0039d2 9503 inc temp0 0039d3 192e sub temp2, temp4 0039d4 093f sbc temp3, temp5 PFA_UMSLASHMODmod_loop_control: 0039d5 954a dec temp6 0039d6 f789 brne PFA_UMSLASHMODmod_loop PFA_UMSLASHMODmod_done: ; put remainder on stack 0039d7 933a st -Y,temp3 0039d8 932a st -Y,temp2 ; put quotient on stack 0039d9 01c8 movw tosl, temp0 0039da ce29 jmp_ DO_NEXT .include "words/umstar.asm" ; Arithmetics ; multiply 2 unsigned cells to a double cell VE_UMSTAR: 0039db ff03 .dw $ff03 0039dc 6d75 0039dd 002a .db "um*",0 0039de 39bc .dw VE_HEAD .set VE_HEAD = VE_UMSTAR XT_UMSTAR: 0039df 39e0 .dw PFA_UMSTAR PFA_UMSTAR: 0039e0 018c movw temp0, tosl 0039e1 9189 0039e2 9199 loadtos ; result: (temp3*temp1)* 65536 + (temp3*temp0 + temp1*temp2) * 256 + (temp0 * temp2) ; low bytes 0039e3 9f80 mul tosl,temp0 0039e4 01f0 movw zl, r0 0039e5 2722 clr temp2 0039e6 2733 clr temp3 ; middle bytes 0039e7 9f90 mul tosh, temp0 0039e8 0df0 add zh, r0 0039e9 1d21 adc temp2, r1 0039ea 1d33 adc temp3, zeroh 0039eb 9f81 mul tosl, temp1 0039ec 0df0 add zh, r0 0039ed 1d21 adc temp2, r1 0039ee 1d33 adc temp3, zeroh 0039ef 9f91 mul tosh, temp1 0039f0 0d20 add temp2, r0 0039f1 1d31 adc temp3, r1 0039f2 01cf movw tosl, zl 0039f3 939a 0039f4 938a savetos 0039f5 01c9 movw tosl, temp2 0039f6 ce0d jmp_ DO_NEXT .include "words/invert.asm" ; Arithmetics ; 1-complement of TOS VE_INVERT: 0039f7 ff06 .dw $ff06 0039f8 6e69 0039f9 6576 0039fa 7472 .db "invert" 0039fb 39db .dw VE_HEAD .set VE_HEAD = VE_INVERT XT_INVERT: 0039fc 39fd .dw PFA_INVERT PFA_INVERT: 0039fd 9580 com tosl 0039fe 9590 com tosh 0039ff ce04 jmp_ DO_NEXT .include "words/2slash.asm" ; Arithmetics ; arithmetic shift right VE_2SLASH: 003a00 ff02 .dw $ff02 003a01 2f32 .db "2/" 003a02 39f7 .dw VE_HEAD .set VE_HEAD = VE_2SLASH XT_2SLASH: 003a03 3a04 .dw PFA_2SLASH PFA_2SLASH: 003a04 9595 asr tosh 003a05 9587 ror tosl 003a06 cdfd jmp_ DO_NEXT .include "words/2star.asm" ; Arithmetics ; arithmetic shift left, filling with zero VE_2STAR: 003a07 ff02 .dw $ff02 003a08 2a32 .db "2*" 003a09 3a00 .dw VE_HEAD .set VE_HEAD = VE_2STAR XT_2STAR: 003a0a 3a0b .dw PFA_2STAR PFA_2STAR: 003a0b 0f88 lsl tosl 003a0c 1f99 rol tosh 003a0d cdf6 jmp_ DO_NEXT .include "words/and.asm" ; Logic ; bitwise and VE_AND: 003a0e ff03 .dw $ff03 003a0f 6e61 003a10 0064 .db "and",0 003a11 3a07 .dw VE_HEAD .set VE_HEAD = VE_AND XT_AND: 003a12 3a13 .dw PFA_AND PFA_AND: 003a13 9109 ld temp0, Y+ 003a14 9119 ld temp1, Y+ 003a15 2380 and tosl, temp0 003a16 2391 and tosh, temp1 003a17 cdec jmp_ DO_NEXT .include "words/or.asm" ; Logic ; logical or VE_OR: 003a18 ff02 .dw $ff02 003a19 726f .db "or" 003a1a 3a0e .dw VE_HEAD .set VE_HEAD = VE_OR XT_OR: 003a1b 3a1c .dw PFA_OR PFA_OR: 003a1c 9109 ld temp0, Y+ 003a1d 9119 ld temp1, Y+ 003a1e 2b80 or tosl, temp0 003a1f 2b91 or tosh, temp1 003a20 cde3 jmp_ DO_NEXT .include "words/xor.asm" ; Logic ; exclusive or VE_XOR: 003a21 ff03 .dw $ff03 003a22 6f78 003a23 0072 .db "xor",0 003a24 3a18 .dw VE_HEAD .set VE_HEAD = VE_XOR XT_XOR: 003a25 3a26 .dw PFA_XOR PFA_XOR: 003a26 9109 ld temp0, Y+ 003a27 9119 ld temp1, Y+ 003a28 2780 eor tosl, temp0 003a29 2791 eor tosh, temp1 003a2a cdd9 jmp_ DO_NEXT .include "words/1plus.asm" ; Arithmetics ; optimized increment VE_1PLUS: 003a2b ff02 .dw $ff02 003a2c 2b31 .db "1+" 003a2d 3a21 .dw VE_HEAD .set VE_HEAD = VE_1PLUS XT_1PLUS: 003a2e 3a2f .dw PFA_1PLUS PFA_1PLUS: 003a2f 9601 adiw tosl,1 003a30 cdd3 jmp_ DO_NEXT .include "words/1minus.asm" ; Arithmetics ; optimized decrement VE_1MINUS: 003a31 ff02 .dw $ff02 003a32 2d31 .db "1-" 003a33 3a2b .dw VE_HEAD .set VE_HEAD = VE_1MINUS XT_1MINUS: 003a34 3a35 .dw PFA_1MINUS PFA_1MINUS: 003a35 9701 sbiw tosl, 1 003a36 cdcd jmp_ DO_NEXT .include "words/q-negate.asm" ; 0< IF NEGATE THEN ; ...a common factor .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_QNEGATE: 003a37 ff07 .dw $ff07 003a38 6e3f 003a39 6765 003a3a 7461 ../../common\words/q-negate.asm(11): warning: .cseg .db misalignment - padding zero byte 003a3b 0065 .db "?negate" 003a3c 3a31 .dw VE_HEAD .set VE_HEAD = VE_QNEGATE XT_QNEGATE: 003a3d 3800 .dw DO_COLON PFA_QNEGATE: .endif 003a3e 3920 003a3f 3835 .DW XT_ZEROLESS,XT_DOCONDBRANCH 003a40 3a42 DEST(QNEG1) 003a41 3e26 .DW XT_NEGATE 003a42 381f QNEG1: .DW XT_EXIT .include "words/lshift.asm" ; Arithmetics ; logically shift n1 left n2 times VE_LSHIFT: 003a43 ff06 .dw $ff06 003a44 736c 003a45 6968 003a46 7466 .db "lshift" 003a47 3a37 .dw VE_HEAD .set VE_HEAD = VE_LSHIFT XT_LSHIFT: 003a48 3a49 .dw PFA_LSHIFT PFA_LSHIFT: 003a49 01fc movw zl, tosl 003a4a 9189 003a4b 9199 loadtos PFA_LSHIFT1: 003a4c 9731 sbiw zl, 1 003a4d f01a brmi PFA_LSHIFT2 003a4e 0f88 lsl tosl 003a4f 1f99 rol tosh 003a50 cffb rjmp PFA_LSHIFT1 PFA_LSHIFT2: 003a51 cdb2 jmp_ DO_NEXT .include "words/rshift.asm" ; Arithmetics ; shift n1 n2-times logically right VE_RSHIFT: 003a52 ff06 .dw $ff06 003a53 7372 003a54 6968 003a55 7466 .db "rshift" 003a56 3a43 .dw VE_HEAD .set VE_HEAD = VE_RSHIFT XT_RSHIFT: 003a57 3a58 .dw PFA_RSHIFT PFA_RSHIFT: 003a58 01fc movw zl, tosl 003a59 9189 003a5a 9199 loadtos PFA_RSHIFT1: 003a5b 9731 sbiw zl, 1 003a5c f01a brmi PFA_RSHIFT2 003a5d 9596 lsr tosh 003a5e 9587 ror tosl 003a5f cffb rjmp PFA_RSHIFT1 PFA_RSHIFT2: 003a60 cda3 jmp_ DO_NEXT .include "words/plusstore.asm" ; Arithmetics ; add n to content of RAM address a-addr VE_PLUSSTORE: 003a61 ff02 .dw $ff02 003a62 212b .db "+!" 003a63 3a52 .dw VE_HEAD .set VE_HEAD = VE_PLUSSTORE XT_PLUSSTORE: 003a64 3a65 .dw PFA_PLUSSTORE PFA_PLUSSTORE: 003a65 01fc movw zl, tosl 003a66 9189 003a67 9199 loadtos 003a68 8120 ldd temp2, Z+0 003a69 8131 ldd temp3, Z+1 003a6a 0f82 add tosl, temp2 003a6b 1f93 adc tosh, temp3 003a6c 8380 std Z+0, tosl 003a6d 8391 std Z+1, tosh 003a6e 9189 003a6f 9199 loadtos 003a70 cd93 jmp_ DO_NEXT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .include "words/rpfetch.asm" ; Stack ; current return stack pointer address VE_RP_FETCH: 003a71 ff03 .dw $ff03 003a72 7072 003a73 0040 .db "rp@",0 003a74 3a61 .dw VE_HEAD .set VE_HEAD = VE_RP_FETCH XT_RP_FETCH: 003a75 3a76 .dw PFA_RP_FETCH PFA_RP_FETCH: 003a76 939a 003a77 938a savetos 003a78 b78d in tosl, SPL 003a79 b79e in tosh, SPH 003a7a cd89 jmp_ DO_NEXT .include "words/rpstore.asm" ; Stack ; set return stack pointer VE_RP_STORE: 003a7b ff03 .dw $ff03 003a7c 7072 003a7d 0021 .db "rp!",0 003a7e 3a71 .dw VE_HEAD .set VE_HEAD = VE_RP_STORE XT_RP_STORE: 003a7f 3a80 .dw PFA_RP_STORE PFA_RP_STORE: 003a80 b72f in temp2, SREG 003a81 94f8 cli 003a82 bf8d out SPL, tosl 003a83 bf9e out SPH, tosh 003a84 bf2f out SREG, temp2 003a85 9189 003a86 9199 loadtos 003a87 cd7c jmp_ DO_NEXT .include "words/spfetch.asm" ; Stack ; current data stack pointer VE_SP_FETCH: 003a88 ff03 .dw $ff03 003a89 7073 003a8a 0040 .db "sp@",0 003a8b 3a7b .dw VE_HEAD .set VE_HEAD = VE_SP_FETCH XT_SP_FETCH: 003a8c 3a8d .dw PFA_SP_FETCH PFA_SP_FETCH: 003a8d 939a 003a8e 938a savetos 003a8f 01ce movw tosl, yl 003a90 cd73 jmp_ DO_NEXT .include "words/spstore.asm" ; Stack ; set data stack pointer to addr VE_SP_STORE: 003a91 ff03 .dw $ff03 003a92 7073 003a93 0021 .db "sp!",0 003a94 3a88 .dw VE_HEAD .set VE_HEAD = VE_SP_STORE XT_SP_STORE: 003a95 3a96 .dw PFA_SP_STORE PFA_SP_STORE: 003a96 01ec movw yl, tosl 003a97 9189 003a98 9199 loadtos 003a99 cd6a jmp_ DO_NEXT .include "words/dodo.asm" ; System ; runtime of do ;VE_DODO: ; .dw $ff04 ; .db "(do)" ; .dw VE_HEAD ; .set VE_HEAD = VE_DODO XT_DODO: 003a9a 3a9b .dw PFA_DODO PFA_DODO: 003a9b 9129 ld temp2, Y+ 003a9c 9139 ld temp3, Y+ ; limit PFA_DODO1: 003a9d e8e0 ldi zl, $80 003a9e 0f3e add temp3, zl 003a9f 1b82 sub tosl, temp2 003aa0 0b93 sbc tosh, temp3 003aa1 933f push temp3 003aa2 932f push temp2 ; limit ( --> limit + $8000) 003aa3 939f push tosh 003aa4 938f push tosl ; start -> index ( --> index - (limit - $8000) 003aa5 9189 003aa6 9199 loadtos 003aa7 cd5c jmp_ DO_NEXT .include "words/i.asm" ; Compiler ; current loop counter VE_I: 003aa8 ff01 .dw $FF01 003aa9 0069 .db "i",0 003aaa 3a91 .dw VE_HEAD .set VE_HEAD = VE_I XT_I: 003aab 3aac .dw PFA_I PFA_I: 003aac 939a 003aad 938a savetos 003aae 918f pop tosl 003aaf 919f pop tosh ; index 003ab0 91ef pop zl 003ab1 91ff pop zh ; limit 003ab2 93ff push zh 003ab3 93ef push zl 003ab4 939f push tosh 003ab5 938f push tosl 003ab6 0f8e add tosl, zl 003ab7 1f9f adc tosh, zh 003ab8 cd4b jmp_ DO_NEXT .include "words/doplusloop.asm" ; System ; runtime of +loop ;VE_DOPLUSLOOP: ; .dw $ff07 ; .db "(+loop)" ; .dw VE_HEAD ; .set VE_HEAD = VE_DOPLUSLOOP XT_DOPLUSLOOP: 003ab9 3aba .dw PFA_DOPLUSLOOP PFA_DOPLUSLOOP: 003aba 91ef pop zl 003abb 91ff pop zh 003abc 0fe8 add zl, tosl 003abd 1ff9 adc zh, tosh 003abe 9189 003abf 9199 loadtos 003ac0 f01b brvs PFA_DOPLUSLOOP_LEAVE ; next cycle PFA_DOPLUSLOOP_NEXT: ; next iteration 003ac1 93ff push zh 003ac2 93ef push zl 003ac3 cd6b rjmp PFA_DOBRANCH ; read next cell from dictionary and jump to its destination PFA_DOPLUSLOOP_LEAVE: 003ac4 910f pop temp0 003ac5 911f pop temp1 ; remove limit 003ac6 9611 adiw xl, 1 ; skip branch-back address 003ac7 cd3c jmp_ DO_NEXT .include "words/doloop.asm" ; System ; runtime of loop ;VE_DOLOOP: ; .dw $ff06 ; .db "(loop)" ; .dw VE_HEAD ; .set VE_HEAD = VE_DOLOOP XT_DOLOOP: 003ac8 3ac9 .dw PFA_DOLOOP PFA_DOLOOP: 003ac9 91ef pop zl 003aca 91ff pop zh 003acb 9631 adiw zl,1 003acc f3bb brvs PFA_DOPLUSLOOP_LEAVE 003acd cff3 jmp_ PFA_DOPLUSLOOP_NEXT .include "words/unloop.asm" ; Compiler ; remove loop-sys, exit the loop and continue execution after it VE_UNLOOP: 003ace ff06 .dw $ff06 003acf 6e75 003ad0 6f6c 003ad1 706f .db "unloop" 003ad2 3aa8 .dw VE_HEAD .set VE_HEAD = VE_UNLOOP XT_UNLOOP: 003ad3 3ad4 .dw PFA_UNLOOP PFA_UNLOOP: 003ad4 911f pop temp1 003ad5 910f pop temp0 003ad6 911f pop temp1 003ad7 910f pop temp0 003ad8 cd2b jmp_ DO_NEXT ;;;;;;;;;;;;;;;;;;;;;;;;;;; .include "words/cmove_g.asm" ; Memory ; copy data in RAM from higher to lower addresses. VE_CMOVE_G: 003ad9 ff06 .dw $ff06 003ada 6d63 003adb 766f 003adc 3e65 .db "cmove>" 003add 3ace .dw VE_HEAD .set VE_HEAD = VE_CMOVE_G XT_CMOVE_G: 003ade 3adf .dw PFA_CMOVE_G PFA_CMOVE_G: 003adf 93bf push xh 003ae0 93af push xl 003ae1 91e9 ld zl, Y+ 003ae2 91f9 ld zh, Y+ ; addr-to 003ae3 91a9 ld xl, Y+ 003ae4 91b9 ld xh, Y+ ; addr-from 003ae5 2f09 mov temp0, tosh 003ae6 2b08 or temp0, tosl 003ae7 f041 brbs 1, PFA_CMOVE_G1 003ae8 0fe8 add zl, tosl 003ae9 1ff9 adc zh, tosh 003aea 0fa8 add xl, tosl 003aeb 1fb9 adc xh, tosh PFA_CMOVE_G2: 003aec 911e ld temp1, -X 003aed 9312 st -Z, temp1 003aee 9701 sbiw tosl, 1 003aef f7e1 brbc 1, PFA_CMOVE_G2 PFA_CMOVE_G1: 003af0 91af pop xl 003af1 91bf pop xh 003af2 9189 003af3 9199 loadtos 003af4 cd0f jmp_ DO_NEXT .include "words/byteswap.asm" ; Arithmetics ; exchange the bytes of the TOS VE_BYTESWAP: 003af5 ff02 .dw $ff02 003af6 3c3e .db "><" 003af7 3ad9 .dw VE_HEAD .set VE_HEAD = VE_BYTESWAP XT_BYTESWAP: 003af8 3af9 .dw PFA_BYTESWAP PFA_BYTESWAP: 003af9 2f09 mov temp0, tosh 003afa 2f98 mov tosh, tosl 003afb 2f80 mov tosl, temp0 003afc cd07 jmp_ DO_NEXT .include "words/up.asm" ; System Variable ; get user area pointer VE_UP_FETCH: 003afd ff03 .dw $ff03 003afe 7075 003aff 0040 .db "up@",0 003b00 3af5 .dw VE_HEAD .set VE_HEAD = VE_UP_FETCH XT_UP_FETCH: 003b01 3b02 .dw PFA_UP_FETCH PFA_UP_FETCH: 003b02 939a 003b03 938a savetos 003b04 01c2 movw tosl, upl 003b05 ccfe jmp_ DO_NEXT ; ( addr -- ) ; System Variable ; set user area pointer VE_UP_STORE: 003b06 ff03 .dw $ff03 003b07 7075 003b08 0021 .db "up!",0 003b09 3afd .dw VE_HEAD .set VE_HEAD = VE_UP_STORE XT_UP_STORE: 003b0a 3b0b .dw PFA_UP_STORE PFA_UP_STORE: 003b0b 012c movw upl, tosl 003b0c 9189 003b0d 9199 loadtos 003b0e ccf5 jmp_ DO_NEXT .include "words/1ms.asm" ; Time ; busy waits (almost) exactly 1 millisecond VE_1MS: 003b0f ff03 .dw $ff03 003b10 6d31 003b11 0073 .db "1ms",0 003b12 3b06 .dw VE_HEAD .set VE_HEAD = VE_1MS XT_1MS: 003b13 3b14 .dw PFA_1MS PFA_1MS: 003b14 eae0 003b15 e0ff 003b16 9731 003b17 f7f1 delay 1000 003b18 cceb jmp_ DO_NEXT .include "words/2to_r.asm" ; Stack ; move DTOS to TOR VE_2TO_R: 003b19 ff03 .dw $ff03 003b1a 3e32 003b1b 0072 .db "2>r",0 003b1c 3b0f .dw VE_HEAD .set VE_HEAD = VE_2TO_R XT_2TO_R: 003b1d 3b1e .dw PFA_2TO_R PFA_2TO_R: 003b1e 01fc movw zl, tosl 003b1f 9189 003b20 9199 loadtos 003b21 939f push tosh 003b22 938f push tosl 003b23 93ff push zh 003b24 93ef push zl 003b25 9189 003b26 9199 loadtos 003b27 ccdc jmp_ DO_NEXT .include "words/2r_from.asm" ; Stack ; move DTOR to TOS VE_2R_FROM: 003b28 ff03 .dw $ff03 003b29 7232 003b2a 003e .db "2r>",0 003b2b 3b19 .dw VE_HEAD .set VE_HEAD = VE_2R_FROM XT_2R_FROM: 003b2c 3b2d .dw PFA_2R_FROM PFA_2R_FROM: 003b2d 939a 003b2e 938a savetos 003b2f 91ef pop zl 003b30 91ff pop zh 003b31 918f pop tosl 003b32 919f pop tosh 003b33 939a 003b34 938a savetos 003b35 01cf movw tosl, zl 003b36 cccd jmp_ DO_NEXT .include "words/store-e.asm" ; Memory ; write n (2bytes) to eeprom address VE_STOREE: 003b37 ff02 .dw $ff02 003b38 6521 .db "!e" 003b39 3b28 .dw VE_HEAD .set VE_HEAD = VE_STOREE XT_STOREE: 003b3a 3b3b .dw PFA_STOREE PFA_STOREE: .if WANT_UNIFIED == 1 .endif PFA_STOREE0: 003b3b 01fc movw zl, tosl 003b3c 9189 003b3d 9199 loadtos 003b3e b72f in_ temp2, SREG 003b3f 94f8 cli 003b40 d028 rcall PFA_FETCHE2 003b41 b500 in_ temp0, EEDR 003b42 1708 cp temp0,tosl 003b43 f009 breq PFA_STOREE3 003b44 d00b rcall PFA_STOREE1 PFA_STOREE3: 003b45 9631 adiw zl,1 003b46 d022 rcall PFA_FETCHE2 003b47 b500 in_ temp0, EEDR 003b48 1709 cp temp0,tosh 003b49 f011 breq PFA_STOREE4 003b4a 2f89 mov tosl, tosh 003b4b d004 rcall PFA_STOREE1 PFA_STOREE4: 003b4c bf2f out_ SREG, temp2 003b4d 9189 003b4e 9199 loadtos 003b4f ccb4 jmp_ DO_NEXT PFA_STOREE1: 003b50 99f9 sbic EECR, EEPE 003b51 cffe rjmp PFA_STOREE1 PFA_STOREE2: ; estore_wait_low_spm: 003b52 b707 in_ temp0, SPMCSR 003b53 fd00 sbrc temp0,SPMEN 003b54 cffd rjmp PFA_STOREE2 003b55 bdf2 out_ EEARH,zh 003b56 bde1 out_ EEARL,zl 003b57 bd80 out_ EEDR, tosl 003b58 9afa sbi EECR,EEMPE 003b59 9af9 sbi EECR,EEPE 003b5a 9508 ret .if WANT_UNIFIED == 1 .endif .include "words/fetch-e.asm" ; Memory ; read 1 cell from eeprom VE_FETCHE: 003b5b ff02 .dw $ff02 003b5c 6540 .db "@e" 003b5d 3b37 .dw VE_HEAD .set VE_HEAD = VE_FETCHE XT_FETCHE: 003b5e 3b5f .dw PFA_FETCHE PFA_FETCHE: .if WANT_UNIFIED == 1 .endif PFA_FETCHE1: 003b5f b72f in_ temp2, SREG 003b60 94f8 cli 003b61 01fc movw zl, tosl 003b62 d006 rcall PFA_FETCHE2 003b63 b580 in_ tosl, EEDR 003b64 9631 adiw zl,1 003b65 d003 rcall PFA_FETCHE2 003b66 b590 in_ tosh, EEDR 003b67 bf2f out_ SREG, temp2 003b68 cc9b jmp_ DO_NEXT PFA_FETCHE2: 003b69 99f9 sbic EECR, EEPE 003b6a cffe rjmp PFA_FETCHE2 003b6b bdf2 out_ EEARH,zh 003b6c bde1 out_ EEARL,zl 003b6d 9af8 sbi EECR,EERE 003b6e 9508 ret .if WANT_UNIFIED == 1 .endif .include "words/store-i.asm" ; System Value ; Deferred action to write a single 16bit cell to flash VE_STOREI: 003b6f ff02 .dw $ff02 003b70 6921 .db "!i" 003b71 3b5b .dw VE_HEAD .set VE_HEAD = VE_STOREI XT_STOREI: 003b72 3dfe .dw PFA_DODEFER1 PFA_STOREI: 003b73 0066 .dw EE_STOREI 003b74 3d9f .dw XT_EDEFERFETCH 003b75 3da9 .dw XT_EDEFERSTORE .if FLASHEND > $10000 .else .include "words/store-i_nrww.asm" ; Memory ; writes n to flash memory using assembly code (code to be placed in boot loader section) VE_DO_STOREI_NRWW: 003b76 ff09 .dw $ff09 003b77 2128 003b78 2d69 003b79 726e 003b7a 7777 003b7b 0029 .db "(!i-nrww)",0 003b7c 3b6f .dw VE_HEAD .set VE_HEAD = VE_DO_STOREI_NRWW XT_DO_STOREI: 003b7d 3b7e .dw PFA_DO_STOREI_NRWW PFA_DO_STOREI_NRWW: ; store status register 003b7e b71f in temp1,SREG 003b7f 931f push temp1 003b80 94f8 cli 003b81 019c movw temp2, tosl ; save the (word) address 003b82 9189 003b83 9199 loadtos ; get the new value for the flash cell 003b84 93af push xl 003b85 93bf push xh 003b86 93cf push yl 003b87 93df push yh 003b88 d009 rcall DO_STOREI_atmega 003b89 91df pop yh 003b8a 91cf pop yl 003b8b 91bf pop xh 003b8c 91af pop xl ; finally clear the stack 003b8d 9189 003b8e 9199 loadtos 003b8f 911f pop temp1 ; restore status register (and interrupt enable flag) 003b90 bf1f out SREG,temp1 003b91 cc72 jmp_ DO_NEXT ; DO_STOREI_atmega: ; write data to temp page buffer ; use the values in tosl/tosh at the ; appropiate place 003b92 d010 rcall pageload ; erase page if needed ; it is needed if a bit goes from 0 to 1 003b93 94e0 com temp4 003b94 94f0 com temp5 003b95 218e and tosl, temp4 003b96 219f and tosh, temp5 003b97 2b98 or tosh, tosl 003b98 f019 breq DO_STOREI_writepage 003b99 01f9 movw zl, temp2 003b9a e002 ldi temp0,(1<8000 .elif AMFORTH_NRWW_SIZE>4000 .include "dict/core_4k.inc" ; in a short distance to DO_NEXT .include "words/n_to_r.asm" ; Stack ; move n items from data stack to return stack VE_N_TO_R: 003bd1 ff03 .dw $ff03 003bd2 3e6e 003bd3 0072 .db "n>r",0 003bd4 3bc7 .dw VE_HEAD .set VE_HEAD = VE_N_TO_R XT_N_TO_R: 003bd5 3bd6 .dw PFA_N_TO_R PFA_N_TO_R: 003bd6 01fc movw zl, tosl 003bd7 2f08 mov temp0, tosl PFA_N_TO_R1: 003bd8 9189 003bd9 9199 loadtos 003bda 939f push tosh 003bdb 938f push tosl 003bdc 950a dec temp0 003bdd f7d1 brne PFA_N_TO_R1 003bde 93ef push zl 003bdf 93ff push zh 003be0 9189 003be1 9199 loadtos 003be2 cc21 jmp_ DO_NEXT .include "words/n_r_from.asm" ; Stack ; move n items from return stack to data stack VE_N_R_FROM: 003be3 ff03 .dw $ff03 003be4 726e 003be5 003e .db "nr>",0 003be6 3bd1 .dw VE_HEAD .set VE_HEAD = VE_N_R_FROM XT_N_R_FROM: 003be7 3be8 .dw PFA_N_R_FROM PFA_N_R_FROM: 003be8 939a 003be9 938a savetos 003bea 91ff pop zh 003beb 91ef pop zl 003bec 2f0e mov temp0, zl PFA_N_R_FROM1: 003bed 918f pop tosl 003bee 919f pop tosh 003bef 939a 003bf0 938a savetos 003bf1 950a dec temp0 003bf2 f7d1 brne PFA_N_R_FROM1 003bf3 01cf movw tosl, zl 003bf4 cc0f jmp_ DO_NEXT .include "words/d-2star.asm" ; Arithmetics ; shift a double cell left VE_D2STAR: 003bf5 ff03 .dw $ff03 003bf6 3264 003bf7 002a .db "d2*",0 003bf8 3be3 .dw VE_HEAD .set VE_HEAD = VE_D2STAR XT_D2STAR: 003bf9 3bfa .dw PFA_D2STAR PFA_D2STAR: 003bfa 9109 ld temp0, Y+ 003bfb 9119 ld temp1, Y+ 003bfc 0f00 lsl temp0 003bfd 1f11 rol temp1 003bfe 1f88 rol tosl 003bff 1f99 rol tosh 003c00 931a st -Y, temp1 003c01 930a st -Y, temp0 003c02 cc01 jmp_ DO_NEXT .include "words/d-2slash.asm" ; Arithmetics ; shift a double cell value right VE_D2SLASH: 003c03 ff03 .dw $ff03 003c04 3264 003c05 002f .db "d2/",0 003c06 3bf5 .dw VE_HEAD .set VE_HEAD = VE_D2SLASH XT_D2SLASH: 003c07 3c08 .dw PFA_D2SLASH PFA_D2SLASH: 003c08 9109 ld temp0, Y+ 003c09 9119 ld temp1, Y+ 003c0a 9595 asr tosh 003c0b 9587 ror tosl 003c0c 9517 ror temp1 003c0d 9507 ror temp0 003c0e 931a st -Y, temp1 003c0f 930a st -Y, temp0 003c10 cbf3 jmp_ DO_NEXT .include "words/d-plus.asm" ; Arithmetics ; add 2 double cell values VE_DPLUS: 003c11 ff02 .dw $ff02 003c12 2b64 .db "d+" 003c13 3c03 .dw VE_HEAD .set VE_HEAD = VE_DPLUS XT_DPLUS: 003c14 3c15 .dw PFA_DPLUS PFA_DPLUS: 003c15 9129 ld temp2, Y+ 003c16 9139 ld temp3, Y+ 003c17 90e9 ld temp4, Y+ 003c18 90f9 ld temp5, Y+ 003c19 9149 ld temp6, Y+ 003c1a 9159 ld temp7, Y+ 003c1b 0f24 add temp2, temp6 003c1c 1f35 adc temp3, temp7 003c1d 1d8e adc tosl, temp4 003c1e 1d9f adc tosh, temp5 003c1f 933a st -Y, temp3 003c20 932a st -Y, temp2 003c21 cbe2 jmp_ DO_NEXT .include "words/d-minus.asm" ; Arithmetics ; subtract d2 from d1 VE_DMINUS: 003c22 ff02 .dw $ff02 003c23 2d64 .db "d-" 003c24 3c11 .dw VE_HEAD .set VE_HEAD = VE_DMINUS XT_DMINUS: 003c25 3c26 .dw PFA_DMINUS PFA_DMINUS: 003c26 9129 ld temp2, Y+ 003c27 9139 ld temp3, Y+ 003c28 90e9 ld temp4, Y+ 003c29 90f9 ld temp5, Y+ 003c2a 9149 ld temp6, Y+ 003c2b 9159 ld temp7, Y+ 003c2c 1b42 sub temp6, temp2 003c2d 0b53 sbc temp7, temp3 003c2e 0ae8 sbc temp4, tosl 003c2f 0af9 sbc temp5, tosh 003c30 935a st -Y, temp7 003c31 934a st -Y, temp6 003c32 01c7 movw tosl, temp4 003c33 cbd0 jmp_ DO_NEXT .include "words/d-invert.asm" ; Arithmetics ; invert all bits in the double cell value VE_DINVERT: 003c34 ff07 .dw $ff07 003c35 6964 003c36 766e 003c37 7265 003c38 0074 .db "dinvert",0 003c39 3c22 .dw VE_HEAD .set VE_HEAD = VE_DINVERT XT_DINVERT: 003c3a 3c3b .dw PFA_DINVERT PFA_DINVERT: 003c3b 9109 ld temp0, Y+ 003c3c 9119 ld temp1, Y+ 003c3d 9580 com tosl 003c3e 9590 com tosh 003c3f 9500 com temp0 003c40 9510 com temp1 003c41 931a st -Y, temp1 003c42 930a st -Y, temp0 003c43 cbc0 jmp_ DO_NEXT .include "words/slashmod.asm" ; Arithmetics ; signed division n1/n2 with remainder and quotient VE_SLASHMOD: 003c44 ff04 .dw $ff04 003c45 6d2f 003c46 646f .db "/mod" 003c47 3c34 .dw VE_HEAD .set VE_HEAD = VE_SLASHMOD XT_SLASHMOD: 003c48 3c49 .dw PFA_SLASHMOD PFA_SLASHMOD: 003c49 019c movw temp2, tosl 003c4a 9109 ld temp0, Y+ 003c4b 9119 ld temp1, Y+ 003c4c 2f41 mov temp6,temp1 ;move dividend High to sign register 003c4d 2743 eor temp6,temp3 ;xor divisor High with sign register 003c4e ff17 sbrs temp1,7 ;if MSB in dividend set 003c4f c004 rjmp PFA_SLASHMOD_1 003c50 9510 com temp1 ; change sign of dividend 003c51 9500 com temp0 003c52 5f0f subi temp0,low(-1) 003c53 4f1f sbci temp1,high(-1) PFA_SLASHMOD_1: 003c54 ff37 sbrs temp3,7 ;if MSB in divisor set 003c55 c004 rjmp PFA_SLASHMOD_2 003c56 9530 com temp3 ; change sign of divisor 003c57 9520 com temp2 003c58 5f2f subi temp2,low(-1) 003c59 4f3f sbci temp3,high(-1) 003c5a 24ee PFA_SLASHMOD_2: clr temp4 ;clear remainder Low byte 003c5b 18ff sub temp5,temp5;clear remainder High byte and carry 003c5c e151 ldi temp7,17 ;init loop counter 003c5d 1f00 PFA_SLASHMOD_3: rol temp0 ;shift left dividend 003c5e 1f11 rol temp1 003c5f 955a dec temp7 ;decrement counter 003c60 f439 brne PFA_SLASHMOD_5 ;if done 003c61 ff47 sbrs temp6,7 ; if MSB in sign register set 003c62 c004 rjmp PFA_SLASHMOD_4 003c63 9510 com temp1 ; change sign of result 003c64 9500 com temp0 003c65 5f0f subi temp0,low(-1) 003c66 4f1f sbci temp1,high(-1) 003c67 c00b PFA_SLASHMOD_4: rjmp PFA_SLASHMODmod_done ; return 003c68 1cee PFA_SLASHMOD_5: rol temp4 ;shift dividend into remainder 003c69 1cff rol temp5 003c6a 1ae2 sub temp4,temp2 ;remainder = remainder - divisor 003c6b 0af3 sbc temp5,temp3 ; 003c6c f420 brcc PFA_SLASHMOD_6 ;if result negative 003c6d 0ee2 add temp4,temp2 ; restore remainder 003c6e 1ef3 adc temp5,temp3 003c6f 9488 clc ; clear carry to be shifted into result 003c70 cfec rjmp PFA_SLASHMOD_3 ;else 003c71 9408 PFA_SLASHMOD_6: sec ; set carry to be shifted into result 003c72 cfea rjmp PFA_SLASHMOD_3 PFA_SLASHMODmod_done: ; put remainder on stack 003c73 92fa st -Y,temp5 003c74 92ea st -Y,temp4 ; put quotient on stack 003c75 01c8 movw tosl, temp0 003c76 cb8d jmp_ DO_NEXT .include "words/abs.asm" ; DUP ?NEGATE ; .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_ABS: 003c77 ff03 .dw $ff03 003c78 6261 003c79 0073 .db "abs",0 003c7a 3c44 .dw VE_HEAD .set VE_HEAD = VE_ABS XT_ABS: 003c7b 3800 .dw DO_COLON PFA_ABS: .endif 003c7c 38b0 003c7d 3a3d 003c7e 381f .DW XT_DUP,XT_QNEGATE,XT_EXIT .include "words/pick.asm" .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_PICK: 003c7f ff04 .dw $ff04 003c80 6970 003c81 6b63 .db "pick" 003c82 3c77 .dw VE_HEAD .set VE_HEAD = VE_PICK XT_PICK: 003c83 3800 .dw DO_COLON PFA_PICK: .endif 003c84 3a2e .dw XT_1PLUS 003c85 3ec3 .dw XT_CELLS 003c86 3a8c .dw XT_SP_FETCH 003c87 399c .dw XT_PLUS 003c88 3878 .dw XT_FETCH 003c89 381f .dw XT_EXIT .include "words/cellplus.asm" ; Arithmetics ; add the size of an address-unit to a-addr1 VE_CELLPLUS: 003c8a ff05 .dw $ff05 003c8b 6563 003c8c 6c6c 003c8d 002b .db "cell+",0 003c8e 3c7f .dw VE_HEAD .set VE_HEAD = VE_CELLPLUS XT_CELLPLUS: 003c8f 3c90 .dw PFA_CELLPLUS PFA_CELLPLUS: 003c90 9602 adiw tosl, CELLSIZE 003c91 cb72 jmp_ DO_NEXT .include "dict/interrupt.inc" .if WANT_INTERRUPTS == 1 .if WANT_INTERRUPT_COUNTERS == 1 .endif .include "words/int-on.asm" ; Interrupt ; turns on all interrupts VE_INTON: 003c92 ff04 .dw $ff04 003c93 692b 003c94 746e .db "+int" 003c95 3c8a .dw VE_HEAD .set VE_HEAD = VE_INTON XT_INTON: 003c96 3c97 .dw PFA_INTON PFA_INTON: 003c97 9478 sei 003c98 cb6b jmp_ DO_NEXT .include "words/int-off.asm" ; Interrupt ; turns off all interrupts VE_INTOFF: 003c99 ff04 .dw $ff04 003c9a 692d 003c9b 746e .db "-int" 003c9c 3c92 .dw VE_HEAD .set VE_HEAD = VE_INTOFF XT_INTOFF: 003c9d 3c9e .dw PFA_INTOFF PFA_INTOFF: 003c9e 94f8 cli 003c9f cb64 jmp_ DO_NEXT .include "words/int-store.asm" ; Interrupt ; stores XT as interrupt vector i VE_INTSTORE: 003ca0 ff04 .dw $ff04 003ca1 6e69 003ca2 2174 .db "int!" 003ca3 3c99 .dw VE_HEAD .set VE_HEAD = VE_INTSTORE XT_INTSTORE: 003ca4 3800 .dw DO_COLON PFA_INTSTORE: 003ca5 383c .dw XT_DOLITERAL 003ca6 0000 .dw intvec 003ca7 399c .dw XT_PLUS 003ca8 3b3a .dw XT_STOREE 003ca9 381f .dw XT_EXIT .include "words/int-fetch.asm" ; Interrupt ; fetches XT from interrupt vector i VE_INTFETCH: 003caa ff04 .dw $ff04 003cab 6e69 003cac 4074 .db "int@" 003cad 3ca0 .dw VE_HEAD .set VE_HEAD = VE_INTFETCH XT_INTFETCH: 003cae 3800 .dw DO_COLON PFA_INTFETCH: 003caf 383c .dw XT_DOLITERAL 003cb0 0000 .dw intvec 003cb1 399c .dw XT_PLUS 003cb2 3b5e .dw XT_FETCHE 003cb3 381f .dw XT_EXIT .include "words/int-trap.asm" ; Interrupt ; trigger an interrupt VE_INTTRAP: 003cb4 ff08 .dw $ff08 003cb5 6e69 003cb6 2d74 003cb7 7274 003cb8 7061 .db "int-trap" 003cb9 3caa .dw VE_HEAD .set VE_HEAD = VE_INTTRAP XT_INTTRAP: 003cba 3cbb .dw PFA_INTTRAP PFA_INTTRAP: 003cbb 2eb8 mov isrflag, tosl 003cbc 9189 003cbd 9199 loadtos 003cbe cb45 jmp_ DO_NEXT .include "words/isr-exec.asm" ; Interrupt ; executes an interrupt service routine ;VE_ISREXEC: ; .dw $ff08 ; .db "isr-exec" ; .dw VE_HEAD ; .set VE_HEAD = VE_ISREXEC XT_ISREXEC: 003cbf 3800 .dw DO_COLON PFA_ISREXEC: 003cc0 3cae .dw XT_INTFETCH 003cc1 3829 .dw XT_EXECUTE 003cc2 3cc4 .dw XT_ISREND 003cc3 381f .dw XT_EXIT .include "words/isr-end.asm" ; Interrupt ; re-enables interrupts in an ISR ;VE_ISREND: ; .dw $ff07 ; .db "isr-end",0 ; .dw VE_HEAD ; .set VE_HEAD = VE_ISREND XT_ISREND: 003cc4 3cc5 .dw PFA_ISREND PFA_ISREND: 003cc5 d001 rcall PFA_ISREND1 ; clear the interrupt flag for the controller 003cc6 cb3d jmp_ DO_NEXT PFA_ISREND1: 003cc7 9518 reti .endif ; now the relocatable colon words .include "words/prompt-ok.asm" ; System ; send the READY prompt to the command line .if cpu_msp430==1 .endif .if cpu_avr8==1 ;VE_PROMPTOK: ; .dw $ff02 ; .db "ok" ; .dw VE_HEAD ; .set VE_HEAD = VE_PROMPTOK XT_DEFAULT_PROMPTOK: 003cc8 3800 .dw DO_COLON PFA_DEFAULT_PROMPTOK: 003cc9 0395 .dw XT_DOSLITERAL 003cca 0003 .dw 3 003ccb 6f20 003ccc 006b .db " ok",0 .endif 003ccd 03c8 .dw XT_ITYPE 003cce 381f .dw XT_EXIT ; ------------------------ .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_PROMPTOK: 003ccf ff03 .dw $FF03 003cd0 6f2e ../../common\words/prompt-ok.asm(43): warning: .cseg .db misalignment - padding zero byte 003cd1 006b .db ".ok" 003cd2 3cb4 .dw VE_HEAD .set VE_HEAD = VE_PROMPTOK XT_PROMPTOK: 003cd3 3dfe .dw PFA_DODEFER1 PFA_PROMPTOK: .endif 003cd4 001c .dw USER_P_OK 003cd5 3dc7 .dw XT_UDEFERFETCH 003cd6 3dd3 .dw XT_UDEFERSTORE .include "words/prompt-ready.asm" ; System ; process the error prompt .if cpu_msp430==1 .endif .if cpu_avr8==1 ;VE_PROMPTRDY: ; .dw $ff04 ; .db "p_er" ; .dw VE_HEAD ; .set VE_HEAD = VE_PROMPTRDY XT_DEFAULT_PROMPTREADY: 003cd7 3800 .dw DO_COLON PFA_DEFAULT_PROMPTREADY: 003cd8 0395 .dw XT_DOSLITERAL 003cd9 0002 .dw 2 003cda 203e .db "> " .endif 003cdb 3fa0 .dw XT_CR 003cdc 03c8 .dw XT_ITYPE 003cdd 381f .dw XT_EXIT ; ------------------------ .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_PROMPTREADY: 003cde ff06 .dw $FF06 003cdf 722e 003ce0 6165 003ce1 7964 .db ".ready" 003ce2 3ccf .dw VE_HEAD .set VE_HEAD = VE_PROMPTREADY XT_PROMPTREADY: 003ce3 3dfe .dw PFA_DODEFER1 PFA_PROMPTREADY: .endif 003ce4 0020 .dw USER_P_RDY 003ce5 3dc7 .dw XT_UDEFERFETCH 003ce6 3dd3 .dw XT_UDEFERSTORE .include "words/prompt-error.asm" ; System ; process the error prompt .if cpu_msp430==1 .endif .if cpu_avr8==1 ;VE_PROMPTERROR: ; .dw $ff04 ; .db "p_er" ; .dw VE_HEAD ; .set VE_HEAD = VE_PROMPTERROR XT_DEFAULT_PROMPTERROR: 003ce7 3800 .dw DO_COLON PFA_DEFAULT_PROMPTERROR: 003ce8 0395 .dw XT_DOSLITERAL 003ce9 0004 .dw 4 003cea 3f20 003ceb 203f .db " ?? " .endif 003cec 03c8 .dw XT_ITYPE 003ced 3ebc .dw XT_BASE 003cee 3878 .dw XT_FETCH 003cef 38fe .dw XT_TO_R 003cf0 3f40 .dw XT_DECIMAL 003cf1 034a .dw XT_DOT 003cf2 3ee1 .dw XT_TO_IN 003cf3 3878 .dw XT_FETCH 003cf4 034a .dw XT_DOT 003cf5 38f5 .dw XT_R_FROM 003cf6 3ebc .dw XT_BASE 003cf7 3880 .dw XT_STORE 003cf8 381f .dw XT_EXIT ; ------------------------ .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_PROMPTERROR: 003cf9 ff06 .dw $FF06 003cfa 652e 003cfb 7272 003cfc 726f .db ".error" 003cfd 3cde .dw VE_HEAD .set VE_HEAD = VE_PROMPTERROR XT_PROMPTERROR: 003cfe 3dfe .dw PFA_DODEFER1 PFA_PROMPTERROR: .endif 003cff 001e .dw USER_P_ERR 003d00 3dc7 .dw XT_UDEFERFETCH 003d01 3dd3 .dw XT_UDEFERSTORE .include "words/quit.asm" ; System ; main loop of amforth. accept - interpret in an endless loop .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_QUIT: 003d02 ff04 .dw $ff04 003d03 7571 003d04 7469 .db "quit" 003d05 3cf9 .dw VE_HEAD .set VE_HEAD = VE_QUIT XT_QUIT: 003d06 3800 .dw DO_COLON .endif PFA_QUIT: 003d07 0821 003d08 0828 003d09 3880 .dw XT_LP0,XT_LP,XT_STORE 003d0a 059a .dw XT_SP0 003d0b 3a95 .dw XT_SP_STORE 003d0c 05a7 .dw XT_RP0 003d0d 3a7f .dw XT_RP_STORE 003d0e 08b6 .dw XT_LBRACKET PFA_QUIT2: 003d0f 3eb6 .dw XT_STATE 003d10 3878 .dw XT_FETCH 003d11 3919 .dw XT_ZEROEQUAL 003d12 3835 .dw XT_DOCONDBRANCH 003d13 3d15 DEST(PFA_QUIT4) 003d14 3ce3 .dw XT_PROMPTREADY PFA_QUIT4: 003d15 04ae .dw XT_REFILL 003d16 3835 .dw XT_DOCONDBRANCH 003d17 3d27 DEST(PFA_QUIT3) 003d18 383c .dw XT_DOLITERAL 003d19 05f5 .dw XT_INTERPRET 003d1a 3d6f .dw XT_CATCH 003d1b 38b8 .dw XT_QDUP 003d1c 3835 .dw XT_DOCONDBRANCH 003d1d 3d27 DEST(PFA_QUIT3) 003d1e 38b0 .dw XT_DUP 003d1f 383c .dw XT_DOLITERAL 003d20 fffe .dw -2 003d21 396d .dw XT_LESS 003d22 3835 .dw XT_DOCONDBRANCH 003d23 3d25 DEST(PFA_QUIT5) 003d24 3cfe .dw XT_PROMPTERROR PFA_QUIT5: 003d25 382e .dw XT_DOBRANCH 003d26 3d07 DEST(PFA_QUIT) PFA_QUIT3: 003d27 3cd3 .dw XT_PROMPTOK 003d28 382e .dw XT_DOBRANCH 003d29 3d0f DEST(PFA_QUIT2) ; .dw XT_EXIT ; never reached .include "words/pause.asm" ; Multitasking ; Fetch pause vector and execute it. may make a context/task switch VE_PAUSE: 003d2a ff05 .dw $ff05 003d2b 6170 003d2c 7375 003d2d 0065 .db "pause",0 003d2e 3d02 .dw VE_HEAD .set VE_HEAD = VE_PAUSE XT_PAUSE: 003d2f 3dfe .dw PFA_DODEFER1 PFA_PAUSE: 003d30 0192 .dw ram_pause 003d31 3db3 .dw XT_RDEFERFETCH 003d32 3dbd .dw XT_RDEFERSTORE .dseg 000192 ram_pause: .byte 2 .cseg .include "words/cold.asm" ; System ; start up amforth. VE_COLD: 003d33 ff04 .dw $ff04 003d34 6f63 003d35 646c .db "cold" 003d36 3d2a .dw VE_HEAD .set VE_HEAD = VE_COLD XT_COLD: 003d37 3d38 .dw PFA_COLD PFA_COLD: 003d38 b6a4 in_ mcu_boot, MCUSR 003d39 2422 clr zerol 003d3a 2433 clr zeroh 003d3b 24bb clr isrflag 003d3c be24 out_ MCUSR, zerol ; clear RAM 003d3d e0e0 ldi zl, low(ramstart) 003d3e e0f1 ldi zh, high(ramstart) clearloop: 003d3f 9221 st Z+, zerol 003d40 30e0 cpi zl, low(sram_size+ramstart) 003d41 f7e9 brne clearloop 003d42 30f9 cpi zh, high(sram_size+ramstart) 003d43 f7d9 brne clearloop ; init first user data area ; allocate space for User Area .dseg 000194 ram_user1: .byte SYSUSERSIZE + APPUSERSIZE .cseg 003d44 e9e4 ldi zl, low(ram_user1) 003d45 e0f1 ldi zh, high(ram_user1) 003d46 012f movw upl, zl ; init return stack pointer 003d47 ef0f ldi temp0,low(rstackstart) 003d48 bf0d out_ SPL,temp0 003d49 8304 std Z+4, temp0 003d4a e018 ldi temp1,high(rstackstart) 003d4b bf1e out_ SPH,temp1 003d4c 8315 std Z+5, temp1 ; init parameter stack pointer 003d4d eacf ldi yl,low(stackstart) 003d4e 83c6 std Z+6, yl 003d4f e0d8 ldi yh,high(stackstart) 003d50 83d7 std Z+7, yh ; load Forth IP with starting word 003d51 e5a9 ldi XL, low(PFA_WARM) 003d52 e3bd ldi XH, high(PFA_WARM) ; its a far jump... 003d53 cab0 jmp_ DO_NEXT .include "words/warm.asm" ; System ; initialize amforth further. executes turnkey operation and go to quit .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_WARM: 003d54 ff04 .dw $ff04 003d55 6177 003d56 6d72 .db "warm" 003d57 3d33 .dw VE_HEAD .set VE_HEAD = VE_WARM XT_WARM: 003d58 3800 .dw DO_COLON PFA_WARM: .endif 003d59 0267 .dw XT_INIT_RAM 003d5a 383c .dw XT_DOLITERAL 003d5b 0159 .dw XT_NOOP 003d5c 383c .dw XT_DOLITERAL 003d5d 3d2f .dw XT_PAUSE 003d5e 3dde .dw XT_DEFERSTORE 003d5f 08b6 .dw XT_LBRACKET 003d60 3f5b .dw XT_TURNKEY 003d61 3d06 .dw XT_QUIT ; never returns .include "words/handler.asm" ; Exceptions ; USER variable used by catch/throw .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_HANDLER: 003d62 ff07 .dw $ff07 003d63 6168 003d64 646e 003d65 656c 003d66 0072 .db "handler",0 003d67 3d54 .dw VE_HEAD .set VE_HEAD = VE_HANDLER XT_HANDLER: 003d68 3857 .dw PFA_DOUSER PFA_HANDLER: .endif 003d69 000a .dw USER_HANDLER .include "words/catch.asm" ; Exceptions ; execute XT and check for exceptions. .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_CATCH: 003d6a ff05 .dw $ff05 003d6b 6163 003d6c 6374 003d6d 0068 .db "catch",0 003d6e 3d62 .dw VE_HEAD .set VE_HEAD = VE_CATCH XT_CATCH: 003d6f 3800 .dw DO_COLON PFA_CATCH: .endif ; sp@ >r 003d70 3a8c .dw XT_SP_FETCH 003d71 38fe .dw XT_TO_R ; handler @ >r 003d72 3d68 .dw XT_HANDLER 003d73 3878 .dw XT_FETCH 003d74 38fe .dw XT_TO_R ; rp@ handler ! 003d75 3a75 .dw XT_RP_FETCH 003d76 3d68 .dw XT_HANDLER 003d77 3880 .dw XT_STORE 003d78 3829 .dw XT_EXECUTE ; r> handler ! 003d79 38f5 .dw XT_R_FROM 003d7a 3d68 .dw XT_HANDLER 003d7b 3880 .dw XT_STORE 003d7c 38f5 .dw XT_R_FROM 003d7d 38d8 .dw XT_DROP 003d7e 3953 .dw XT_ZERO 003d7f 381f .dw XT_EXIT .include "words/throw.asm" ; Exceptions ; throw an exception .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_THROW: 003d80 ff05 .dw $ff05 003d81 6874 003d82 6f72 003d83 0077 .db "throw",0 003d84 3d6a .dw VE_HEAD .set VE_HEAD = VE_THROW XT_THROW: 003d85 3800 .dw DO_COLON PFA_THROW: .endif 003d86 38b0 .dw XT_DUP 003d87 3919 .dw XT_ZEROEQUAL 003d88 3835 .dw XT_DOCONDBRANCH 003d89 3d8c DEST(PFA_THROW1) 003d8a 38d8 .dw XT_DROP 003d8b 381f .dw XT_EXIT PFA_THROW1: 003d8c 3d68 .dw XT_HANDLER 003d8d 3878 .dw XT_FETCH 003d8e 3a7f .dw XT_RP_STORE 003d8f 38f5 .dw XT_R_FROM 003d90 3d68 .dw XT_HANDLER 003d91 3880 .dw XT_STORE 003d92 38f5 .dw XT_R_FROM 003d93 38c3 .dw XT_SWAP 003d94 38fe .dw XT_TO_R 003d95 3a95 .dw XT_SP_STORE 003d96 38d8 .dw XT_DROP 003d97 38f5 .dw XT_R_FROM 003d98 381f .dw XT_EXIT .include "words/edefer-fetch.asm" ; System ; does the real defer@ for eeprom defers VE_EDEFERFETCH: 003d99 ff07 .dw $ff07 003d9a 6445 003d9b 6665 003d9c 7265 003d9d 0040 .db "Edefer@",0 003d9e 3d80 .dw VE_HEAD .set VE_HEAD = VE_EDEFERFETCH XT_EDEFERFETCH: 003d9f 3800 .dw DO_COLON PFA_EDEFERFETCH: 003da0 3bca .dw XT_FETCHI 003da1 3b5e .dw XT_FETCHE 003da2 381f .dw XT_EXIT .include "words/edefer-store.asm" ; System ; does the real defer! for eeprom defers VE_EDEFERSTORE: 003da3 ff07 .dw $ff07 003da4 6445 003da5 6665 003da6 7265 003da7 0021 .db "Edefer!",0 003da8 3d99 .dw VE_HEAD .set VE_HEAD = VE_EDEFERSTORE XT_EDEFERSTORE: 003da9 3800 .dw DO_COLON PFA_EDEFERSTORE: 003daa 3bca .dw XT_FETCHI 003dab 3b3a .dw XT_STOREE 003dac 381f .dw XT_EXIT .include "words/rdefer-fetch.asm" ; System ; The defer@ for ram defers .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_RDEFERFETCH: 003dad ff07 .dw $ff07 003dae 6452 003daf 6665 003db0 7265 003db1 0040 .db "Rdefer@",0 003db2 3da3 .dw VE_HEAD .set VE_HEAD = VE_RDEFERFETCH XT_RDEFERFETCH: 003db3 3800 .dw DO_COLON PFA_RDEFERFETCH: .endif 003db4 3bca .dw XT_FETCHI 003db5 3878 .dw XT_FETCH 003db6 381f .dw XT_EXIT .include "words/rdefer-store.asm" ; System ; The defer! for ram defers .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_RDEFERSTORE: 003db7 ff07 .dw $ff07 003db8 6452 003db9 6665 003dba 7265 003dbb 0021 .db "Rdefer!",0 003dbc 3dad .dw VE_HEAD .set VE_HEAD = VE_RDEFERSTORE XT_RDEFERSTORE: 003dbd 3800 .dw DO_COLON PFA_RDEFERSTORE: .endif 003dbe 3bca .dw XT_FETCHI 003dbf 3880 .dw XT_STORE 003dc0 381f .dw XT_EXIT .include "words/udefer-fetch.asm" ; System ; does the real defer@ for user based defers .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_UDEFERFETCH: 003dc1 ff07 .dw $ff07 003dc2 6455 003dc3 6665 003dc4 7265 003dc5 0040 .db "Udefer@",0 003dc6 3db7 .dw VE_HEAD .set VE_HEAD = VE_UDEFERFETCH XT_UDEFERFETCH: 003dc7 3800 .dw DO_COLON PFA_UDEFERFETCH: .endif 003dc8 3bca .dw XT_FETCHI 003dc9 3b01 .dw XT_UP_FETCH 003dca 399c .dw XT_PLUS 003dcb 3878 .dw XT_FETCH 003dcc 381f .dw XT_EXIT .include "words/udefer-store.asm" ; System ; does the real defer! for user based defers .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_UDEFERSTORE: 003dcd ff07 .dw $ff07 003dce 6455 003dcf 6665 003dd0 7265 003dd1 0021 .db "Udefer!",0 003dd2 3dc1 .dw VE_HEAD .set VE_HEAD = VE_UDEFERSTORE XT_UDEFERSTORE: 003dd3 3800 .dw DO_COLON PFA_UDEFERSTORE: .endif 003dd4 3bca .dw XT_FETCHI 003dd5 3b01 .dw XT_UP_FETCH 003dd6 399c .dw XT_PLUS 003dd7 3880 .dw XT_STORE 003dd8 381f .dw XT_EXIT .include "words/defer-store.asm" ; System ; stores xt1 as the xt to be executed when xt2 is called .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DEFERSTORE: 003dd9 ff06 .dw $ff06 003dda 6564 003ddb 6566 003ddc 2172 .db "defer!" 003ddd 3dcd .dw VE_HEAD .set VE_HEAD = VE_DEFERSTORE XT_DEFERSTORE: 003dde 3800 .dw DO_COLON PFA_DEFERSTORE: .endif 003ddf 3fcf .dw XT_TO_BODY 003de0 38b0 .dw XT_DUP 003de1 0185 .dw XT_ICELLPLUS 003de2 0185 .dw XT_ICELLPLUS 003de3 3bca .dw XT_FETCHI 003de4 3829 .dw XT_EXECUTE 003de5 381f .dw XT_EXIT .include "words/defer-fetch.asm" ; System ; returns the XT associated with the given XT .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DEFERFETCH: 003de6 ff06 .dw $ff06 003de7 6564 003de8 6566 003de9 4072 .db "defer@" 003dea 3dd9 .dw VE_HEAD .set VE_HEAD = VE_DEFERFETCH XT_DEFERFETCH: 003deb 3800 .dw DO_COLON PFA_DEFERFETCH: .endif 003dec 3fcf .dw XT_TO_BODY 003ded 38b0 .dw XT_DUP 003dee 0185 .dw XT_ICELLPLUS 003def 3bca .dw XT_FETCHI 003df0 3829 .dw XT_EXECUTE 003df1 381f .dw XT_EXIT .include "words/do-defer.asm" ; System ; runtime of defer VE_DODEFER: 003df2 ff07 .dw $ff07 003df3 6428 003df4 6665 003df5 7265 003df6 0029 .db "(defer)", 0 003df7 3de6 .dw VE_HEAD .set VE_HEAD = VE_DODEFER XT_DODEFER: 003df8 3800 .dw DO_COLON PFA_DODEFER: 003df9 06fe .dw XT_DOCREATE 003dfa 085e .dw XT_REVEAL 003dfb 0721 .dw XT_COMPILE 003dfc 3dfe .dw PFA_DODEFER1 003dfd 381f .dw XT_EXIT PFA_DODEFER1: 003dfe 940e 0877 call_ DO_DODOES 003e00 38b0 .dw XT_DUP 003e01 0185 .dw XT_ICELLPLUS 003e02 3bca .dw XT_FETCHI 003e03 3829 .dw XT_EXECUTE 003e04 3829 .dw XT_EXECUTE 003e05 381f .dw XT_EXIT ; : (defer) dup i-cell+ @i execute execute ; .include "words/u-dot.asm" ; Numeric IO ; unsigned PNO with single cell numbers .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_UDOT: 003e06 ff02 .dw $ff02 003e07 2e75 .db "u." 003e08 3df2 .dw VE_HEAD .set VE_HEAD = VE_UDOT XT_UDOT: 003e09 3800 .dw DO_COLON PFA_UDOT: .endif 003e0a 3953 .dw XT_ZERO 003e0b 0352 .dw XT_UDDOT 003e0c 381f .dw XT_EXIT ; : u. ( us -- ) 0 ud. ; .include "words/u-dot-r.asm" ; Numeric IO ; unsigned PNO with single cells numbers, right aligned in width w .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_UDOTR: 003e0d ff03 .dw $ff03 003e0e 2e75 003e0f 0072 .db "u.r",0 003e10 3e06 .dw VE_HEAD .set VE_HEAD = VE_UDOTR XT_UDOTR: 003e11 3800 .dw DO_COLON PFA_UDOTR: .endif 003e12 3953 .dw XT_ZERO 003e13 38c3 .dw XT_SWAP 003e14 035b .dw XT_UDDOTR 003e15 381f .dw XT_EXIT ; : u.r ( s n -- ) 0 swap ud.r ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; .include "words/uslashmod.asm" ; Arithmetics ; unsigned division with remainder VE_USLASHMOD: 003e16 ff05 .dw $ff05 003e17 2f75 003e18 6f6d 003e19 0064 .db "u/mod",0 003e1a 3e0d .dw VE_HEAD .set VE_HEAD = VE_USLASHMOD XT_USLASHMOD: 003e1b 3800 .dw DO_COLON PFA_USLASHMOD: 003e1c 38fe .dw XT_TO_R 003e1d 3953 .dw XT_ZERO 003e1e 38f5 .dw XT_R_FROM 003e1f 39c1 .dw XT_UMSLASHMOD 003e20 381f .dw XT_EXIT .include "words/negate.asm" ; Logic ; 2-complement VE_NEGATE: 003e21 ff06 .dw $ff06 003e22 656e 003e23 6167 003e24 6574 .db "negate" 003e25 3e16 .dw VE_HEAD .set VE_HEAD = VE_NEGATE XT_NEGATE: 003e26 3800 .dw DO_COLON PFA_NEGATE: 003e27 39fc .dw XT_INVERT 003e28 3a2e .dw XT_1PLUS 003e29 381f .dw XT_EXIT .include "words/slash.asm" ; Arithmetics ; divide n1 by n2. giving the quotient .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SLASH: 003e2a ff01 .dw $ff01 003e2b 002f .db "/",0 003e2c 3e21 .dw VE_HEAD .set VE_HEAD = VE_SLASH XT_SLASH: 003e2d 3800 .dw DO_COLON PFA_SLASH: .endif 003e2e 3c48 .dw XT_SLASHMOD 003e2f 38ef .dw XT_NIP 003e30 381f .dw XT_EXIT .include "words/mod.asm" ; Arithmetics ; divide n1 by n2 giving the remainder n3 .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_MOD: 003e31 ff03 .dw $ff03 003e32 6f6d 003e33 0064 .db "mod",0 003e34 3e2a .dw VE_HEAD .set VE_HEAD = VE_MOD XT_MOD: 003e35 3800 .dw DO_COLON PFA_MOD: .endif 003e36 3c48 .dw XT_SLASHMOD 003e37 38d8 .dw XT_DROP 003e38 381f .dw XT_EXIT .include "words/min.asm" ; Compare ; compare two values leave the smaller one .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_MIN: 003e39 ff03 .dw $ff03 003e3a 696d 003e3b 006e .db "min",0 003e3c 3e31 .dw VE_HEAD .set VE_HEAD = VE_MIN XT_MIN: 003e3d 3800 .dw DO_COLON PFA_MIN: .endif 003e3e 3ec8 .dw XT_2DUP 003e3f 3977 .dw XT_GREATER 003e40 3835 .dw XT_DOCONDBRANCH 003e41 3e43 DEST(PFA_MIN1) 003e42 38c3 .dw XT_SWAP PFA_MIN1: 003e43 38d8 .dw XT_DROP 003e44 381f .dw XT_EXIT .include "words/max.asm" ; Compare ; compare two values, leave the bigger one .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_MAX: 003e45 ff03 .dw $ff03 003e46 616d 003e47 0078 .db "max",0 003e48 3e39 .dw VE_HEAD .set VE_HEAD = VE_MAX XT_MAX: 003e49 3800 .dw DO_COLON PFA_MAX: .endif 003e4a 3ec8 .dw XT_2DUP 003e4b 396d .dw XT_LESS 003e4c 3835 .dw XT_DOCONDBRANCH 003e4d 3e4f DEST(PFA_MAX1) 003e4e 38c3 .dw XT_SWAP PFA_MAX1: 003e4f 38d8 .dw XT_DROP 003e50 381f .dw XT_EXIT .include "words/within.asm" ; Compare ; check if n is within min..max .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_WITHIN: 003e51 ff06 .dw $ff06 003e52 6977 003e53 6874 003e54 6e69 .db "within" 003e55 3e45 .dw VE_HEAD .set VE_HEAD = VE_WITHIN XT_WITHIN: 003e56 3800 .dw DO_COLON PFA_WITHIN: .endif 003e57 38ce .dw XT_OVER 003e58 3992 .dw XT_MINUS 003e59 38fe .dw XT_TO_R 003e5a 3992 .dw XT_MINUS 003e5b 38f5 .dw XT_R_FROM 003e5c 395b .dw XT_ULESS 003e5d 381f .dw XT_EXIT .include "words/show-wordlist.asm" ; Tools ; prints the name of the words in a wordlist .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SHOWWORDLIST: 003e5e ff0d .dw $ff0d 003e5f 6873 003e60 776f 003e61 772d 003e62 726f 003e63 6c64 003e64 7369 003e65 0074 .db "show-wordlist",0 003e66 3e51 .dw VE_HEAD .set VE_HEAD = VE_SHOWWORDLIST XT_SHOWWORDLIST: 003e67 3800 .dw DO_COLON PFA_SHOWWORDLIST: .endif 003e68 383c .dw XT_DOLITERAL 003e69 3e6d .dw XT_SHOWWORD 003e6a 38c3 .dw XT_SWAP 003e6b 069f .dw XT_TRAVERSEWORDLIST 003e6c 381f .dw XT_EXIT .if cpu_msp430==1 .endif .if cpu_avr8==1 XT_SHOWWORD: 003e6d 3800 .dw DO_COLON PFA_SHOWWORD: .endif 003e6e 06ba .dw XT_NAME2STRING 003e6f 03c8 .dw XT_ITYPE 003e70 3fad .dw XT_SPACE ; ( -- addr n) 003e71 394a .dw XT_TRUE 003e72 381f .dw XT_EXIT .include "words/words.asm" ; Tools ; prints a list of all (visible) words in the dictionary .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_WORDS: 003e73 ff05 .dw $ff05 003e74 6f77 003e75 6472 003e76 0073 .db "words",0 003e77 3e5e .dw VE_HEAD .set VE_HEAD = VE_WORDS XT_WORDS: 003e78 3800 .dw DO_COLON PFA_WORDS: .endif 003e79 383c .dw XT_DOLITERAL 003e7a 004c .dw CFG_ORDERLISTLEN+2 003e7b 3b5e .dw XT_FETCHE 003e7c 3e67 .dw XT_SHOWWORDLIST 003e7d 381f .dw XT_EXIT .include "words/dot-quote.asm" ; Compiler ; compiles string into dictionary to be printed at runtime .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DOTSTRING: 003e7e 0002 .dw $0002 003e7f 222e .db ".",$22 003e80 3e73 .dw VE_HEAD .set VE_HEAD = VE_DOTSTRING XT_DOTSTRING: 003e81 3800 .dw DO_COLON PFA_DOTSTRING: .endif 003e82 3e89 .dw XT_SQUOTE 003e83 0721 .dw XT_COMPILE 003e84 03c8 .dw XT_ITYPE 003e85 381f .dw XT_EXIT .include "words/squote.asm" ; Compiler ; compiles a string to flash, at runtime leaves ( -- flash-addr count) on stack .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SQUOTE: 003e86 0002 .dw $0002 003e87 2273 .db "s",$22 003e88 3e7e .dw VE_HEAD .set VE_HEAD = VE_SQUOTE XT_SQUOTE: 003e89 3800 .dw DO_COLON PFA_SQUOTE: .endif 003e8a 383c .dw XT_DOLITERAL 003e8b 0022 .dw 34 ; 0x22 003e8c 0553 .dw XT_PARSE ; ( -- addr n) 003e8d 3eb6 .dw XT_STATE 003e8e 3878 .dw XT_FETCH 003e8f 3835 .dw XT_DOCONDBRANCH 003e90 3e92 DEST(PFA_SQUOTE1) 003e91 074d .dw XT_SLITERAL PFA_SQUOTE1: 003e92 381f .dw XT_EXIT .include "words/fill.asm" ; Memory ; fill u bytes memory beginning at a-addr with character c VE_FILL: 003e93 ff04 .dw $ff04 003e94 6966 003e95 6c6c .db "fill" 003e96 3e86 .dw VE_HEAD .set VE_HEAD = VE_FILL XT_FILL: 003e97 3800 .dw DO_COLON PFA_FILL: 003e98 38e0 .dw XT_ROT 003e99 38e0 .dw XT_ROT 003e9a 38b8 003e9b 3835 .dw XT_QDUP,XT_DOCONDBRANCH 003e9c 3ea4 DEST(PFA_FILL2) 003e9d 3f98 .dw XT_BOUNDS 003e9e 3a9a .dw XT_DODO PFA_FILL1: 003e9f 38b0 .dw XT_DUP 003ea0 3aab .dw XT_I 003ea1 388c .dw XT_CSTORE ; ( -- c c-addr) 003ea2 3ac8 .dw XT_DOLOOP 003ea3 3e9f .dw PFA_FILL1 PFA_FILL2: 003ea4 38d8 .dw XT_DROP 003ea5 381f .dw XT_EXIT .include "words/f_cpu.asm" ; System ; put the cpu frequency in Hz on stack .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_F_CPU: 003ea6 ff05 .dw $ff05 003ea7 5f66 003ea8 7063 003ea9 0075 .db "f_cpu",0 003eaa 3e93 .dw VE_HEAD .set VE_HEAD = VE_F_CPU XT_F_CPU: 003eab 3800 .dw DO_COLON PFA_F_CPU: .endif 003eac 383c .dw XT_DOLITERAL 003ead 2400 .dw (F_CPU % 65536) 003eae 383c .dw XT_DOLITERAL 003eaf 00f4 .dw (F_CPU / 65536) 003eb0 381f .dw XT_EXIT .include "words/state.asm" ; System Variable ; system state VE_STATE: 003eb1 ff05 .dw $ff05 003eb2 7473 003eb3 7461 003eb4 0065 .db "state",0 003eb5 3ea6 .dw VE_HEAD .set VE_HEAD = VE_STATE XT_STATE: 003eb6 3847 .dw PFA_DOVARIABLE PFA_STATE: 003eb7 01c0 .dw ram_state .dseg 0001c0 ram_state: .byte 2 .include "words/base.asm" ; Numeric IO ; location of the cell containing the number conversion radix .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_BASE: 003eb8 ff04 .dw $ff04 003eb9 6162 003eba 6573 .db "base" 003ebb 3eb1 .dw VE_HEAD .set VE_HEAD = VE_BASE XT_BASE: 003ebc 3857 .dw PFA_DOUSER PFA_BASE: .endif 003ebd 000c .dw USER_BASE .include "words/cells.asm" ; Arithmetics ; n2 is the size in address units of n1 cells VE_CELLS: 003ebe ff05 .dw $ff05 003ebf 6563 003ec0 6c6c 003ec1 0073 .db "cells",0 003ec2 3eb8 .dw VE_HEAD .set VE_HEAD = VE_CELLS XT_CELLS: 003ec3 3a0b .dw PFA_2STAR .include "words/2dup.asm" ; Stack ; Duplicate the 2 top elements .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_2DUP: 003ec4 ff04 .dw $ff04 003ec5 6432 003ec6 7075 .db "2dup" 003ec7 3ebe .dw VE_HEAD .set VE_HEAD = VE_2DUP XT_2DUP: 003ec8 3800 .dw DO_COLON PFA_2DUP: .endif 003ec9 38ce .dw XT_OVER 003eca 38ce .dw XT_OVER 003ecb 381f .dw XT_EXIT .include "words/2drop.asm" ; Stack ; Remove the 2 top elements .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_2DROP: 003ecc ff05 .dw $ff05 003ecd 6432 003ece 6f72 003ecf 0070 .db "2drop",0 003ed0 3ec4 .dw VE_HEAD .set VE_HEAD = VE_2DROP XT_2DROP: 003ed1 3800 .dw DO_COLON PFA_2DROP: .endif 003ed2 38d8 .dw XT_DROP 003ed3 38d8 .dw XT_DROP 003ed4 381f .dw XT_EXIT .include "words/tuck.asm" ; Stack ; Copy the first (top) stack item below the second stack item. .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_TUCK: 003ed5 ff04 .dw $ff04 003ed6 7574 003ed7 6b63 .db "tuck" 003ed8 3ecc .dw VE_HEAD .set VE_HEAD = VE_TUCK XT_TUCK: 003ed9 3800 .dw DO_COLON PFA_TUCK: .endif 003eda 38c3 .dw XT_SWAP 003edb 38ce .dw XT_OVER 003edc 381f .dw XT_EXIT .include "words/to-in.asm" ; System Variable ; pointer to current read position in input buffer .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_TO_IN: 003edd ff03 .dw $ff03 003ede 693e 003edf 006e .db ">in",0 003ee0 3ed5 .dw VE_HEAD .set VE_HEAD = VE_TO_IN XT_TO_IN: 003ee1 3857 .dw PFA_DOUSER PFA_TO_IN: .endif 003ee2 0018 .dw USER_TO_IN .include "words/pad.asm" ; System Variable ; Address of the temporary scratch buffer. .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_PAD: 003ee3 ff03 .dw $ff03 003ee4 6170 003ee5 0064 .db "pad",0 003ee6 3edd .dw VE_HEAD .set VE_HEAD = VE_PAD XT_PAD: 003ee7 3800 .dw DO_COLON PFA_PAD: .endif 003ee8 3f22 .dw XT_HERE 003ee9 383c .dw XT_DOLITERAL 003eea 0028 .dw 40 003eeb 399c .dw XT_PLUS 003eec 381f .dw XT_EXIT .include "words/emit.asm" ; Character IO ; fetch the emit vector and execute it. should emit a character from TOS .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_EMIT: 003eed ff04 .dw $ff04 003eee 6d65 003eef 7469 .db "emit" 003ef0 3ee3 .dw VE_HEAD .set VE_HEAD = VE_EMIT XT_EMIT: 003ef1 3dfe .dw PFA_DODEFER1 PFA_EMIT: .endif 003ef2 000e .dw USER_EMIT 003ef3 3dc7 .dw XT_UDEFERFETCH 003ef4 3dd3 .dw XT_UDEFERSTORE .include "words/emitq.asm" ; Character IO ; fetch emit? vector and execute it. should return the ready-to-send condition .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_EMITQ: 003ef5 ff05 .dw $ff05 003ef6 6d65 003ef7 7469 003ef8 003f .db "emit?",0 003ef9 3eed .dw VE_HEAD .set VE_HEAD = VE_EMITQ XT_EMITQ: 003efa 3dfe .dw PFA_DODEFER1 PFA_EMITQ: .endif 003efb 0010 .dw USER_EMITQ 003efc 3dc7 .dw XT_UDEFERFETCH 003efd 3dd3 .dw XT_UDEFERSTORE .include "words/key.asm" ; Character IO ; fetch key vector and execute it, should leave a single character on TOS .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_KEY: 003efe ff03 .dw $ff03 003eff 656b 003f00 0079 .db "key",0 003f01 3ef5 .dw VE_HEAD .set VE_HEAD = VE_KEY XT_KEY: 003f02 3dfe .dw PFA_DODEFER1 PFA_KEY: .endif 003f03 0012 .dw USER_KEY 003f04 3dc7 .dw XT_UDEFERFETCH 003f05 3dd3 .dw XT_UDEFERSTORE .include "words/keyq.asm" ; Character IO ; fetch key? vector and execute it. should turn on key sender, if it is disabled/stopped .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_KEYQ: 003f06 ff04 .dw $ff04 003f07 656b 003f08 3f79 .db "key?" 003f09 3efe .dw VE_HEAD .set VE_HEAD = VE_KEYQ XT_KEYQ: 003f0a 3dfe .dw PFA_DODEFER1 PFA_KEYQ: .endif 003f0b 0014 .dw USER_KEYQ 003f0c 3dc7 .dw XT_UDEFERFETCH 003f0d 3dd3 .dw XT_UDEFERSTORE .include "words/dp.asm" ; System Value ; address of the next free dictionary cell VE_DP: 003f0e ff02 .dw $ff02 003f0f 7064 .db "dp" 003f10 3f06 .dw VE_HEAD .set VE_HEAD = VE_DP XT_DP: 003f11 386e .dw PFA_DOVALUE1 PFA_DP: 003f12 0036 .dw CFG_DP 003f13 3d9f .dw XT_EDEFERFETCH 003f14 3da9 .dw XT_EDEFERSTORE .include "words/ehere.asm" ; System Value ; address of the next free address in eeprom VE_EHERE: 003f15 ff05 .dw $ff05 003f16 6865 003f17 7265 003f18 0065 .db "ehere",0 003f19 3f0e .dw VE_HEAD .set VE_HEAD = VE_EHERE XT_EHERE: 003f1a 386e .dw PFA_DOVALUE1 PFA_EHERE: 003f1b 003a .dw EE_EHERE 003f1c 3d9f .dw XT_EDEFERFETCH 003f1d 3da9 .dw XT_EDEFERSTORE .include "words/here.asm" ; System Value ; address of the next free data space (RAM) cell VE_HERE: 003f1e ff04 .dw $ff04 003f1f 6568 003f20 6572 .db "here" 003f21 3f15 .dw VE_HEAD .set VE_HEAD = VE_HERE XT_HERE: 003f22 386e .dw PFA_DOVALUE1 PFA_HERE: 003f23 0038 .dw EE_HERE 003f24 3d9f .dw XT_EDEFERFETCH 003f25 3da9 .dw XT_EDEFERSTORE .include "words/allot.asm" ; System ; allocate or release memory in RAM VE_ALLOT: 003f26 ff05 .dw $ff05 003f27 6c61 003f28 6f6c 003f29 0074 .db "allot",0 003f2a 3f1e .dw VE_HEAD .set VE_HEAD = VE_ALLOT XT_ALLOT: 003f2b 3800 .dw DO_COLON PFA_ALLOT: 003f2c 3f22 .dw XT_HERE 003f2d 399c .dw XT_PLUS 003f2e 0173 .dw XT_DOTO 003f2f 3f23 .dw PFA_HERE 003f30 381f .dw XT_EXIT .include "words/bin.asm" ; Numeric IO ; set base for numeric conversion to 10 .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_BIN: 003f31 ff03 .dw $ff03 003f32 6962 003f33 006e .db "bin",0 003f34 3f26 .dw VE_HEAD .set VE_HEAD = VE_BIN XT_BIN: 003f35 3800 .dw DO_COLON PFA_BIN: .endif 003f36 3fea .dw XT_TWO 003f37 3ebc .dw XT_BASE 003f38 3880 .dw XT_STORE 003f39 381f .dw XT_EXIT .include "words/decimal.asm" ; Numeric IO ; set base for numeric conversion to 10 .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_DECIMAL: 003f3a ff07 .dw $ff07 003f3b 6564 003f3c 6963 003f3d 616d 003f3e 006c .db "decimal",0 003f3f 3f31 .dw VE_HEAD .set VE_HEAD = VE_DECIMAL XT_DECIMAL: 003f40 3800 .dw DO_COLON PFA_DECIMAL: .endif 003f41 383c .dw XT_DOLITERAL 003f42 000a .dw 10 003f43 3ebc .dw XT_BASE 003f44 3880 .dw XT_STORE 003f45 381f .dw XT_EXIT .include "words/hex.asm" ; Numeric IO ; set base for numeric conversion to 10 .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_HEX: 003f46 ff03 .dw $ff03 003f47 6568 003f48 0078 .db "hex",0 003f49 3f3a .dw VE_HEAD .set VE_HEAD = VE_HEX XT_HEX: 003f4a 3800 .dw DO_COLON PFA_HEX: .endif 003f4b 383c .dw XT_DOLITERAL 003f4c 0010 .dw 16 003f4d 3ebc .dw XT_BASE 003f4e 3880 .dw XT_STORE 003f4f 381f .dw XT_EXIT .include "words/bl.asm" ; Character IO ; put ascii code of the blank to the stack .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_BL: 003f50 ff02 .dw $ff02 003f51 6c62 .db "bl" 003f52 3f46 .dw VE_HEAD .set VE_HEAD = VE_BL XT_BL: 003f53 3847 .dw PFA_DOVARIABLE PFA_BL: .endif 003f54 0020 .dw 32 .include "words/turnkey.asm" ; System Value ; Deferred action during startup/reset VE_TURNKEY: 003f55 ff07 .dw $ff07 003f56 7574 003f57 6e72 003f58 656b 003f59 0079 .db "turnkey",0 003f5a 3f50 .dw VE_HEAD .set VE_HEAD = VE_TURNKEY XT_TURNKEY: 003f5b 3dfe .dw PFA_DODEFER1 PFA_TURNKEY: 003f5c 0042 .dw CFG_TURNKEY 003f5d 3d9f .dw XT_EDEFERFETCH 003f5e 3da9 .dw XT_EDEFERSTORE .include "words/to-upper.asm" ; String ; if c is a lowercase letter convert it to uppercase .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_TOUPPER: 003f5f ff07 .dw $ff07 003f60 6f74 003f61 7075 003f62 6570 003f63 0072 .db "toupper",0 003f64 3f55 .dw VE_HEAD .set VE_HEAD = VE_TOUPPER XT_TOUPPER: 003f65 3800 .dw DO_COLON PFA_TOUPPER: .endif 003f66 38b0 .dw XT_DUP 003f67 383c .dw XT_DOLITERAL 003f68 0061 .dw 'a' 003f69 383c .dw XT_DOLITERAL 003f6a 007b .dw 'z'+1 003f6b 3e56 .dw XT_WITHIN 003f6c 3835 .dw XT_DOCONDBRANCH 003f6d 3f71 DEST(PFA_TOUPPER0) 003f6e 383c .dw XT_DOLITERAL 003f6f 00df .dw 223 ; inverse of 0x20: 0xdf 003f70 3a12 .dw XT_AND PFA_TOUPPER0: 003f71 381f .dw XT_EXIT .include "words/to-lower.asm" ; String ; if C is an uppercase letter convert it to lowercase .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_TOLOWER: 003f72 ff07 .dw $ff07 003f73 6f74 003f74 6f6c 003f75 6577 003f76 0072 .db "tolower",0 003f77 3f5f .dw VE_HEAD .set VE_HEAD = VE_TOLOWER XT_TOLOWER: 003f78 3800 .dw DO_COLON PFA_TOLOWER: .endif 003f79 38b0 .dw XT_DUP 003f7a 383c .dw XT_DOLITERAL 003f7b 0041 .dw 'A' 003f7c 383c .dw XT_DOLITERAL 003f7d 005b .dw 'Z'+1 003f7e 3e56 .dw XT_WITHIN 003f7f 3835 .dw XT_DOCONDBRANCH 003f80 3f84 DEST(PFA_TOLOWER0) 003f81 383c .dw XT_DOLITERAL 003f82 0020 .dw 32 003f83 3a1b .dw XT_OR PFA_TOLOWER0: 003f84 381f .dw XT_EXIT .include "words/q-stack.asm" ; Tools ; check data stack depth and exit to quit if underrun .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_QSTACK: 003f85 ff06 .dw $ff06 003f86 733f 003f87 6174 003f88 6b63 .db "?stack" 003f89 3f72 .dw VE_HEAD .set VE_HEAD = VE_QSTACK XT_QSTACK: 003f8a 3800 .dw DO_COLON PFA_QSTACK: .endif 003f8b 05b2 .dw XT_DEPTH 003f8c 3920 .dw XT_ZEROLESS 003f8d 3835 .dw XT_DOCONDBRANCH 003f8e 3f92 DEST(PFA_QSTACK1) 003f8f 383c .dw XT_DOLITERAL 003f90 fffc .dw -4 003f91 3d85 .dw XT_THROW PFA_QSTACK1: 003f92 381f .dw XT_EXIT .include "words/bounds.asm" ; Tools ; convert a string to an address range .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_BOUNDS: 003f93 ff06 .dw $ff06 003f94 6f62 003f95 6e75 003f96 7364 .db "bounds" 003f97 3f85 .dw VE_HEAD .set VE_HEAD = VE_BOUNDS XT_BOUNDS: 003f98 3800 .dw DO_COLON PFA_BOUNDS: .endif 003f99 38ce .dw XT_OVER 003f9a 399c .dw XT_PLUS 003f9b 38c3 .dw XT_SWAP 003f9c 381f .dw XT_EXIT .include "words/cr.asm" ; Character IO ; cause subsequent output appear at the beginning of the next line .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_CR: 003f9d ff02 .dw 0xff02 003f9e 7263 .db "cr" 003f9f 3f93 .dw VE_HEAD .set VE_HEAD = VE_CR XT_CR: 003fa0 3800 .dw DO_COLON PFA_CR: .endif 003fa1 383c .dw XT_DOLITERAL 003fa2 000d .dw 13 003fa3 3ef1 .dw XT_EMIT 003fa4 383c .dw XT_DOLITERAL 003fa5 000a .dw 10 003fa6 3ef1 .dw XT_EMIT 003fa7 381f .dw XT_EXIT .include "words/space.asm" ; Character IO ; emits a space (bl) .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SPACE: 003fa8 ff05 .dw $ff05 003fa9 7073 003faa 6361 003fab 0065 .db "space",0 003fac 3f9d .dw VE_HEAD .set VE_HEAD = VE_SPACE XT_SPACE: 003fad 3800 .dw DO_COLON PFA_SPACE: .endif 003fae 3f53 .dw XT_BL 003faf 3ef1 .dw XT_EMIT 003fb0 381f .dw XT_EXIT .include "words/spaces.asm" ; Character IO ; emits n space(s) (bl) .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_SPACES: 003fb1 ff06 .dw $ff06 003fb2 7073 003fb3 6361 003fb4 7365 .db "spaces" 003fb5 3fa8 .dw VE_HEAD .set VE_HEAD = VE_SPACES XT_SPACES: 003fb6 3800 .dw DO_COLON PFA_SPACES: .endif ;C SPACES n -- output n spaces ; BEGIN DUP 0> WHILE SPACE 1- REPEAT DROP ; 003fb7 3953 003fb8 3e49 .DW XT_ZERO, XT_MAX 003fb9 38b0 003fba 3835 SPCS1: .DW XT_DUP,XT_DOCONDBRANCH 003fbb 3fc0 DEST(SPCS2) 003fbc 3fad 003fbd 3a34 003fbe 382e .DW XT_SPACE,XT_1MINUS,XT_DOBRANCH 003fbf 3fb9 DEST(SPCS1) 003fc0 38d8 003fc1 381f SPCS2: .DW XT_DROP,XT_EXIT .include "words/s-to-d.asm" ; Conversion ; extend (signed) single cell value to double cell .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_S2D: 003fc2 ff03 .dw $ff03 003fc3 3e73 003fc4 0064 .db "s>d",0 003fc5 3fb1 .dw VE_HEAD .set VE_HEAD = VE_S2D XT_S2D: 003fc6 3800 .dw DO_COLON PFA_S2D: .endif 003fc7 38b0 .dw XT_DUP 003fc8 3920 .dw XT_ZEROLESS 003fc9 381f .dw XT_EXIT .include "words/to-body.asm" ; Core ; get body from XT VE_TO_BODY: 003fca ff05 .dw $ff05 003fcb 623e 003fcc 646f 003fcd 0079 .db ">body",0 003fce 3fc2 .dw VE_HEAD .set VE_HEAD = VE_TO_BODY XT_TO_BODY: 003fcf 3a2f .dw PFA_1PLUS .elif AMFORTH_NRWW_SIZE>2000 .else .endif ; now colon words ;;;;;;;;;;;;;;;;;;;;;;;; .include "words/2literal.asm" ; Compiler ; compile a cell pair literal in colon definitions .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_2LITERAL: 003fd0 0008 .dw $0008 003fd1 6c32 003fd2 7469 003fd3 7265 003fd4 6c61 .db "2literal" 003fd5 3fca .dw VE_HEAD .set VE_HEAD = VE_2LITERAL XT_2LITERAL: 003fd6 3800 .dw DO_COLON PFA_2LITERAL: .endif 003fd7 38c3 .dw XT_SWAP 003fd8 0742 .dw XT_LITERAL 003fd9 0742 .dw XT_LITERAL 003fda 381f .dw XT_EXIT .include "words/equal.asm" ; Compare ; compares two values for equality VE_EQUAL: 003fdb ff01 .dw $ff01 003fdc 003d .db "=",0 003fdd 3fd0 .dw VE_HEAD .set VE_HEAD = VE_EQUAL XT_EQUAL: 003fde 3800 .dw DO_COLON PFA_EQUAL: 003fdf 3992 .dw XT_MINUS 003fe0 3919 .dw XT_ZEROEQUAL 003fe1 381f .dw XT_EXIT .include "words/num-constants.asm" .endif .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_ONE: 003fe2 ff01 .dw $ff01 003fe3 0031 .db "1",0 003fe4 3fdb .dw VE_HEAD .set VE_HEAD = VE_ONE XT_ONE: 003fe5 3847 .dw PFA_DOVARIABLE PFA_ONE: .endif 003fe6 0001 .DW 1 .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_TWO: 003fe7 ff01 .dw $ff01 003fe8 0032 .db "2",0 003fe9 3fe2 .dw VE_HEAD .set VE_HEAD = VE_TWO XT_TWO: 003fea 3847 .dw PFA_DOVARIABLE PFA_TWO: .endif 003feb 0002 .DW 2 .if cpu_msp430==1 .endif .if cpu_avr8==1 VE_MINUSONE: 003fec ff02 .dw $ff02 003fed 312d .db "-1" 003fee 3fe7 .dw VE_HEAD .set VE_HEAD = VE_MINUSONE XT_MINUSONE: 003fef 3847 .dw PFA_DOVARIABLE PFA_MINUSONE: .endif 003ff0 ffff .DW -1 .include "dict_appl_core.inc" ; do not delete it! .set flashlast = pc .if (pc>FLASHEND) .endif .dseg ; define a label for the 1st free ram address HERESTART: .eseg .include "amforth-eeprom.inc" 000034 ff ff ; some configs 000036 7f 0a CFG_DP: .dw DPSTART ; Dictionary Pointer 000038 c2 01 EE_HERE: .dw HERESTART ; Memory Allocation 00003a 8e 00 EE_EHERE: .dw EHERESTART ; EEProm Memory Allocation 00003c 93 09 CFG_WLSCOPE: .dw XT_GET_CURRENT ; default wordlist scope 00003e 5c 00 CFG_FORTHRECOGNIZER: .dw CFG_RECOGNIZERLISTLEN ; Recognizer word set ; LEAVE stack is between data stack and return stack. 000040 b0 08 CFG_LP0: .dw stackstart+1 000042 71 0a CFG_TURNKEY: .dw XT_APPLTURNKEY ; TURNKEY 000044 c4 02 CFG_ENVIRONMENT:.dw VE_ENVHEAD ; environmental queries 000046 48 00 CFG_CURRENT: .dw CFG_FORTHWORDLIST ; forth-wordlist 000048 ec 3f CFG_FORTHWORDLIST:.dw VE_HEAD ; pre-defined (compiled in) wordlist CFG_ORDERLISTLEN: 00004a 01 00 .dw 1 CFG_ORDERLIST: ; list of wordlist id, exactly numwordlist entries 00004c 48 00 .dw CFG_FORTHWORDLIST ; get/set-order 00004e .byte (NUMWORDLISTS-1)*CELLSIZE ; one slot is already used CFG_RECOGNIZERLISTLEN: 00005c 02 00 .dw 2 CFG_RECOGNIZERLIST: 00005e 35 06 .dw XT_REC_FIND 000060 21 06 .dw XT_REC_NUM 000062 .byte (NUMRECOGNIZERS-2)*CELLSIZE ; two slots are already used EE_STOREI: 000066 7d 3b .dw XT_DO_STOREI ; Store a cell into flash ; MARKER saves everything up to here. Nothing beyond gets saved EE_MARKER: 000068 68 00 .dw EE_MARKER ; default user area EE_INITUSER: 00006a 00 00 .dw 0 ; USER_STATE 00006c 00 00 .dw 0 ; USER_FOLLOWER 00006e ff 08 .dw rstackstart ; USER_RP 000070 af 08 .dw stackstart ; USER_SP0 000072 af 08 .dw stackstart ; USER_SP 000074 00 00 .dw 0 ; USER_HANDLER 000076 0a 00 .dw 10 ; USER_BASE 000078 a3 00 .dw XT_TX ; USER_EMIT 00007a b1 00 .dw XT_TXQ ; USER_EMITQ 00007c 78 00 .dw XT_RX ; USER_KEY 00007e 93 00 .dw XT_RXQ ; USER_KEYQ 000080 3c 02 .dw XT_SOURCETIB ; USER_SOURCE 000082 00 00 .dw 0 ; USER_G_IN 000084 29 02 .dw XT_REFILLTIB ; USER_REFILL 000086 c8 3c .dw XT_DEFAULT_PROMPTOK 000088 e7 3c .dw XT_DEFAULT_PROMPTERROR 00008a d7 3c .dw XT_DEFAULT_PROMPTREADY ; calculate baud rate error .equ UBRR_VAL = ((F_CPU+BAUD*8)/(BAUD*16)-1) ; smart round .equ BAUD_REAL = (F_CPU/(16*(UBRR_VAL+1))) ; effective baud rate .equ BAUD_ERROR = ((BAUD_REAL*1000)/BAUD-1000) ; error in pro mille .if ((BAUD_ERROR>BAUD_MAXERROR) || (BAUD_ERROR<-BAUD_MAXERROR)) .endif EE_UBRRVAL: 00008c 19 00 .dw UBRR_VAL ; BAUDRATE ; 1st free address in EEPROM. EHERESTART: .cseg RESOURCE USE INFORMATION ------------------------ Notice: The register and instruction counts are symbol table hit counts, and hence implicitly used resources are not counted, eg, the 'lpm' instruction without operands implicitly uses r0 and z, none of which are counted. x,y,z are separate entities in the symbol table and are counted separately from r26..r31 here. .dseg memory usage only counts static data declared with .byte "ATmega328P" register use summary: r0 : 25 r1 : 5 r2 : 9 r3 : 12 r4 : 4 r5 : 1 r6 : 0 r7 : 0 r8 : 0 r9 : 0 r10: 1 r11: 6 r12: 0 r13: 0 r14: 22 r15: 20 r16: 78 r17: 57 r18: 52 r19: 37 r20: 13 r21: 11 r22: 11 r23: 3 r24: 187 r25: 133 r26: 28 r27: 17 r28: 7 r29: 4 r30: 78 r31: 40 x : 4 y : 203 z : 41 Registers used: 29 out of 35 (82.9%) "ATmega328P" instruction use summary: .lds : 0 .sts : 0 adc : 22 add : 17 adiw : 17 and : 4 andi : 3 asr : 2 bclr : 0 bld : 0 brbc : 2 brbs : 7 brcc : 2 brcs : 1 break : 0 breq : 6 brge : 1 brhc : 0 brhs : 0 brid : 0 brie : 0 brlo : 1 brlt : 3 brmi : 3 brne : 13 brpl : 0 brsh : 0 brtc : 0 brts : 0 brvc : 0 brvs : 2 bset : 0 bst : 0 call : 2 cbi : 0 cbr : 0 clc : 1 clh : 0 cli : 5 cln : 0 clr : 13 cls : 0 clt : 0 clv : 0 clz : 0 com : 14 cp : 11 cpc : 10 cpi : 2 cpse : 0 dec : 10 eor : 3 fmul : 0 fmuls : 0 fmulsu: 0 icall : 0 ijmp : 1 in : 14 inc : 3 jmp : 7 ld : 136 ldd : 4 ldi : 27 lds : 1 lpm : 16 lsl : 14 lsr : 2 mov : 15 movw : 65 mul : 5 muls : 1 mulsu : 2 neg : 0 nop : 0 or : 9 ori : 1 out : 16 pop : 45 push : 39 rcall : 38 ret : 6 reti : 1 rjmp : 103 rol : 23 ror : 5 sbc : 9 sbci : 3 sbi : 3 sbic : 3 sbis : 0 sbiw : 7 sbr : 0 sbrc : 4 sbrs : 3 sec : 1 seh : 0 sei : 1 sen : 0 ser : 3 ses : 0 set : 0 sev : 0 sez : 0 sleep : 0 spm : 2 st : 74 std : 8 sts : 1 sub : 6 subi : 3 swap : 0 tst : 0 wdr : 0 Instructions used: 70 out of 113 (61.9%) "ATmega328P" memory use summary [bytes]: Segment Begin End Code Data Used Size Use% --------------------------------------------------------------- [.cseg] 0x000000 0x007fe2 1834 11624 13458 32768 41.1% [.dseg] 0x000100 0x0001c2 0 194 194 2048 9.5% [.eseg] 0x000000 0x00008e 0 142 142 1024 13.9% Assembly complete, 0 errors, 8 warnings