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/TwoFetch
22 ;C 2@ a-addr -- x1 x2 fetch 2 cells ; the lower address will appear on top of stack
29 ;https://forth-standard.org/standard/core/TwoStore
30 ;C 2! x1 x2 a-addr -- store 2 cells ; the top of stack is stored at the lower adr
37 ;https://forth-standard.org/standard/core/TwoDUP
38 ;C 2DUP x1 x2 -- x1 x2 x1 x2 dup top 2 cells
40 SUB #4,PSP ; -- x1 x x x2
41 MOV TOS,2(PSP) ; -- x1 x2 x x2
42 MOV 4(PSP),0(PSP) ; -- x1 x2 x1 x2
45 ;https://forth-standard.org/standard/core/TwoDROP
46 ;C 2DROP x1 x2 -- drop 2 cells
52 ;https://forth-standard.org/standard/core/TwoSWAP
53 ;C 2SWAP x1 x2 x3 x4 -- x3 x4 x1 x2
55 MOV @PSP,W ; -- x1 x2 x3 x4 W=x3
56 MOV 4(PSP),0(PSP) ; -- x1 x2 x1 x4
57 MOV W,4(PSP) ; -- x3 x2 x1 x4
58 MOV TOS,W ; -- x3 x2 x1 x4 W=x4
59 MOV 2(PSP),TOS ; -- x3 x2 x1 x2 W=x4
60 MOV W,2(PSP) ; -- x3 x4 x1 x2
63 ;https://forth-standard.org/standard/core/TwoOVER
64 ;C 2OVER x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2
66 SUB #4,PSP ; -- x1 x2 x3 x x x4
67 MOV TOS,2(PSP) ; -- x1 x2 x3 x4 x x4
68 MOV 8(PSP),0(PSP) ; -- x1 x2 x3 x4 x1 x4
69 MOV 6(PSP),TOS ; -- x1 x2 x3 x4 x1 x2