4 * Copyright (C) 1998-2011 Alan R. Baldwin
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * This Assember Ported by
25 * John L. Hartman (JLH)
26 * jhartman at compuserve dot com
27 * noice at noicedebugger dot com
29 * Benny Kim (2011/07/21)
30 * bennykim at coreriver dot com
31 * Fixed bugs in relative address with "."
38 char *cpu
= "Padauk 14";
42 * Process machine ops.
45 machine(struct mne
*mp
)
47 a_uint op
, opWithFlags
;
50 opWithFlags
= mp
->m_valu
;
51 op
= opWithFlags
& PDK_OPCODE_MASK
;
54 /* Default instructions are only used for A -> K instructions.
55 * Although they may be (ab)used for other types.
57 struct inst def
= {op
, 0xFF};
61 struct inst ioa
= {0x0180, 0x3F};
62 struct inst aio
= {0x01C0, 0x3F};
63 struct inst ma
= {0x0B80, 0x7F};
64 struct inst am
= {0x0F80, 0x7F};
65 emov(opWithFlags
, def
, ioa
, aio
, ma
, am
);
70 struct inst am
= {op
| 1, 0x7E};
71 struct inst ma
= {op
, 0x7E};
80 struct inst ma
= {0x0800 | combine
, 0x7F};
81 struct inst am
= {0x0C00 | combine
, 0x7F};
90 struct inst ma
= {0x0900 | combine
, 0x7F};
91 struct inst am
= {0x0D00 | combine
, 0x7F};
92 struct inst m
= {0x1000 | combine
, 0x7F};
93 struct inst a
= {0x0060 + (combine
? 1 : 0), 0x00};
94 earithc(ma
, am
, m
, a
);
102 if (mp
->m_type
== S_SRC
|| mp
->m_type
== S_SLC
)
104 if (mp
->m_type
== S_SL
|| mp
->m_type
== S_SLC
)
107 struct inst a
= {0x006A + combine
, 0x00};
108 struct inst m
= {0x1500 + (combine
<< 7), 0x7F};
116 if (mp
->m_type
== S_OR
) {
119 if (mp
->m_type
== S_XOR
) {
123 struct inst ma
= {0x0A00 | combine
, 0x7F};
124 struct inst am
= {0x0E00 | combine
, 0x7F};
125 struct inst ioa
= {0x00C0, 0x3F};
126 ebit(opWithFlags
, def
, ma
, am
, mp
->m_type
== S_XOR
? &ioa
: NULL
);
134 struct inst m
= {0x1400 | combine
, 0x7F};
143 struct inst io
= {0x1C00 | combine
, 0x3F};
144 struct inst m
= {0x2400 | combine
, 0x3F};
145 ebitn(opWithFlags
, io
, m
, /*N offset*/6);
153 struct inst m
= {0x1700 | combine
, 0xFF};
154 def
.op
|= combine
<< 1;
163 struct inst io
= {0x1800 | combine
, 0x3F};
164 struct inst m
= {0x2000 | combine
, 0x3F};
165 ebitn(opWithFlags
, io
, m
, /*N offset*/6);
173 struct inst m
= {0x1100 | combine
, 0x7F};
179 struct inst k
= {0x0200, 0xFF};
198 outrwp(&e
, def
.op
, 0x7FF, /*jump=*/1);
225 eswapc(opWithFlags
, def
, /*N offset*/6);
230 struct inst am
= {op
, 0x7F};
231 struct inst ma
= {op
| 0x80, 0x7F};
236 /* Simple instructions consisting of only one opcode and no args */
246 case S_LDSPTL
: /* undocumented */
247 case S_LDSPTH
: /* undocumented */
254 * Machine specific initialization
270 /* Set the target in case it was not automatically
271 * configured from the executable filename.
273 set_sdas_target(TARGET_ID_PDK14
);