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 15";
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
= {0x0100, 0x7F};
62 struct inst aio
= {0x0180, 0x7F};
63 struct inst ma
= {0x1700, 0xFF};
64 struct inst am
= {0x1F00, 0xFF};
65 emov(opWithFlags
, def
, ioa
, aio
, ma
, am
);
70 struct inst am
= {op
| 1, 0xFE};
71 struct inst ma
= {op
, 0xFE};
80 struct inst ma
= {0x1000 | combine
, 0xFF};
81 struct inst am
= {0x1800 | combine
, 0xFF};
90 struct inst ma
= {0x1200 | combine
, 0xFF};
91 struct inst am
= {0x1A00 | combine
, 0xFF};
92 struct inst m
= {0x2000 | combine
, 0xFF};
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
= {0x2A00 + (combine
<< 8), 0xFF};
116 if (mp
->m_type
== S_OR
) {
119 if (mp
->m_type
== S_XOR
) {
123 struct inst ma
= {0x1400 | combine
, 0xFF};
124 struct inst am
= {0x1C00 | combine
, 0xFF};
125 struct inst ioa
= {0x0080, 0x7F};
126 ebit(opWithFlags
, def
, ma
, am
, mp
->m_type
== S_XOR
? &ioa
: NULL
);
134 struct inst m
= {0x2800 | combine
, 0xFF};
139 struct inst m
= {0x0a00, 0xFF};
148 struct inst io
= {0x3800 | combine
, 0x7F};
149 struct inst m
= {0x4800 | combine
, 0x7F};
150 ebitn(opWithFlags
, io
, m
, /*N offset*/7);
158 struct inst m
= {0x2E00 | combine
, 0xFF};
167 struct inst io
= {0x3000 | combine
, 0x7F};
168 struct inst m
= {0x4000 | combine
, 0x7F};
169 ebitn(opWithFlags
, io
, m
, /*N offset*/7);
177 struct inst m
= {0x2200 | combine
, 0xFF};
183 struct inst k
= {0x0200, 0xFF};
207 outrwp(&e
, op
, 0xFFF, /*jump=*/1);
226 eswapc(opWithFlags
, def
, /*N offset*/7);
231 struct inst am
= {op
, 0xFF};
232 struct inst ma
= {op
| 0x100, 0xFF};
237 /* Simple instructions consisting of only one opcode and no args */
247 case S_LDSPTL
: /* undocumented */
248 case S_LDSPTH
: /* undocumented */
255 * Machine specific initialization
271 /* Set the target in case it was not automatically
272 * configured from the executable filename.
274 set_sdas_target(TARGET_ID_PDK15
);