1 ; -*- coding: utf-8 -*-
2 ; http://patorjk.com/software/taag/#p=display&f=Banner&t=Fast Forth
4 ; Fast Forth For Texas Instrument MSP430FRxxxx FRAM devices
5 ; Copyright (C) <2015> <J.M. THOORENS>
7 ; This program is free software: you can redistribute it and/or modify
8 ; it under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation, either version 3 of the License, or
10 ; (at your option) any later version.
12 ; This program is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ; GNU General Public License for more details.
17 ; You should have received a copy of the GNU General Public License
18 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ;https://forth-standard.org/standard/core/StoD
22 ;C S>D n -- d single -> double prec.
28 ;https://forth-standard.org/standard/core/TwoFetch
29 ;C 2@ a-addr -- x1 x2 fetch 2 cells ; the lower address will appear on top of stack
36 ;https://forth-standard.org/standard/core/TwoStore
37 ;C 2! x1 x2 a-addr -- store 2 cells ; the top of stack is stored at the lower adr
44 ;https://forth-standard.org/standard/core/TwoDUP
45 ;C 2DUP x1 x2 -- x1 x2 x1 x2 dup top 2 cells
47 SUB #4,PSP ; -- x1 x x x2
48 MOV TOS,2(PSP) ; -- x1 x2 x x2
49 MOV 4(PSP),0(PSP) ; -- x1 x2 x1 x2
52 ;https://forth-standard.org/standard/core/TwoDROP
53 ;C 2DROP x1 x2 -- drop 2 cells
59 ;https://forth-standard.org/standard/core/TwoSWAP
60 ;C 2SWAP x1 x2 x3 x4 -- x3 x4 x1 x2
62 MOV @PSP,W ; -- x1 x2 x3 x4 W=x3
63 MOV 4(PSP),0(PSP) ; -- x1 x2 x1 x4
64 MOV W,4(PSP) ; -- x3 x2 x1 x4
65 MOV TOS,W ; -- x3 x2 x1 x4 W=x4
66 MOV 2(PSP),TOS ; -- x3 x2 x1 x2 W=x4
67 MOV W,2(PSP) ; -- x3 x4 x1 x2
70 ;https://forth-standard.org/standard/core/TwoOVER
71 ;C 2OVER x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2
73 SUB #4,PSP ; -- x1 x2 x3 x x x4
74 MOV TOS,2(PSP) ; -- x1 x2 x3 x4 x x4
75 MOV 8(PSP),0(PSP) ; -- x1 x2 x3 x4 x1 x4
76 MOV 6(PSP),TOS ; -- x1 x2 x3 x4 x1 x2