-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathitc430extras4e.asm
More file actions
106 lines (91 loc) · 3.02 KB
/
Copy pathitc430extras4e.asm
File metadata and controls
106 lines (91 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
; ----------------------------------------------------------------------
; CamelForth for the Texas Instruments MSP430
; (c) 2009,2012,2014 Bradford J. Rodriguez.
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
; Commercial inquiries should be directed to the author at
; 115 First St., #105, Collingwood, Ontario L9Y 4W3 Canada
; or via email to bj@camelforth.com
; ----------------------------------------------------------------------
; itc430extras.asm - utility words for the MSP430 family
; B. Rodriguez 27 oct 2012
; Forth words are documented as follows:
;x NAME stack -- stack description
; where x=C for ANS Forth Core words, X for ANS
; Extensions, Z for internal or private words.
; ----------------------------------------------------------------------
; REVISION HISTORY
; 10 May 18 mk - added CTOGB ;mk
; 1 mar 14 bjr - adapted from extras430.s43 for naken_asm.
; 22 dec 2013 bjr - added constants 0, 1, 2, -1
; 27 oct 2012 bjr - Created.
CODEHEADER(E_INT,4,"EINT")
EINT
NEXT
CODEHEADER(D_INT,4,"DINT")
DINT
NEXT
;Z SETB u a-addr -- set bits in memory cell
CODEHEADER(SETB,4,"SETB")
BIS @PSP+,0(TOS)
MOV @PSP+,TOS
NEXT
;Z CLRB u a-addr -- clear bits in memory cell
CODEHEADER(CLRB,4,"CLRB")
BIC @PSP+,0(TOS)
MOV @PSP+,TOS
NEXT
;Z TSTB u a-addr -- u2 test bits in memory cell
CODEHEADER( TSTB,4,"TSTB")
MOV @TOS,TOS
AND @PSP+,TOS
NEXT
;Z CSETB c c-addr -- set bits in memory byte
CODEHEADER(CSETB,5,"CSETB")
MOV @PSP+,W
BIS.B W,0(TOS)
MOV @PSP+,TOS
NEXT
;Z CCLRB c c-addr -- clear bits in memory byte
CODEHEADER(CCLRB,5,"CCLRB")
MOV @PSP+,W
BIC.B W,0(TOS)
MOV @PSP+,TOS
NEXT
;Z CTSTB c c-addr -- c2 test bits in memory byte
CODEHEADER( CTSTB,5,"CTSTB")
MOV.B @TOS,TOS
AND @PSP+,TOS
NEXT
;mk -------------------------------
;U CTOGB mask addr -- flip bit from mask in addr (byte) ;mk
CODEHEADER(CTOGB,5,"CTOGB")
XOR.B @PSP,0(TOS)
ADD #2,PSP
MOV @PSP+,TOS
NEXT
;mk \------------------------------
;Z 0 -- n constant 0
HEADER(ZERO,1,"0",DOCON)
DW 0
;Z 1 -- n constant 1
HEADER(ONE,1,"1",DOCON)
DW 1
;Z 2 -- n constant 2
HEADER(TWO,1,"2",DOCON)
DW 2
;Z -1 -- n constant -1
HEADER(MINUSONE,2,"-1",DOCON)
DW -1