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 13";
42 * Process machine ops.
45 machine(struct mne
*mp
)
47 a_uint op
, opWithFlags
;
50 /* Set the target in case it was not automatically
51 * configured from the executable filename.
53 set_sdas_target (TARGET_ID_PDK13
);
55 opWithFlags
= mp
->m_valu
;
56 op
= opWithFlags
& PDK_OPCODE_MASK
;
59 /* Default instructions are only used for A -> K instructions.
60 * Although they may be (ab)used for other types.
62 struct inst def
= {op
, 0xFF};
66 struct inst ioa
= {0x0080, 0x1F};
67 struct inst aio
= {0x00A0, 0x1F};
68 struct inst ma
= {0x05C0, 0x3F};
69 struct inst am
= {0x07C0, 0x3F};
70 emov(opWithFlags
, def
, ioa
, aio
, ma
, am
);
75 struct inst am
= {op
| 1, 0x1E};
76 struct inst ma
= {op
, 0x1E};
85 struct inst ma
= {0x0400 | combine
, 0x3F};
86 struct inst am
= {0x0600 | combine
, 0x3F};
95 struct inst ma
= {0x0480 | combine
, 0x3F};
96 struct inst am
= {0x0680 | combine
, 0x3F};
97 struct inst a
= {0x0010 + (combine
>> 6), 0x00};
98 struct inst m
= {0x0800 + combine
, 0x3F};
99 earithc(ma
, am
, m
, a
);
107 if (mp
->m_type
== S_SRC
|| mp
->m_type
== S_SLC
)
109 if (mp
->m_type
== S_SL
|| mp
->m_type
== S_SLC
)
112 struct inst a
= {0x001A + combine
, 0x00};
113 struct inst m
= {0x0A80 + (combine
<< 6), 0x3F};
121 if (mp
->m_type
== S_OR
) {
124 if (mp
->m_type
== S_XOR
) {
128 struct inst ma
= {0x0500 | combine
, 0x3F};
129 struct inst am
= {0x0700 | combine
, 0x3F};
130 struct inst ioa
= {0x0060, 0x1F};
131 ebit(opWithFlags
, def
, ma
, am
, mp
->m_type
== S_XOR
? &ioa
: NULL
);
139 struct inst m
= {0x0A00 | combine
, 0x3F};
145 struct inst io
= {0x0F00, 0x1F};
146 struct inst m
= {0x0310, 0x0F};
147 ebitn(opWithFlags
, io
, m
, /*N offset*/5);
152 struct inst io
= {0x0E00, 0x1F};
153 struct inst m
= {0x0300, 0x0F};
154 ebitn(opWithFlags
, io
, m
, /*N offset*/5);
159 struct inst m
= {0x0B80, 0xFF};
160 def
.op
|= combine
<< 2;
166 struct inst io
= {0x0D00, 0x1F};
167 struct inst m
= {0x0210, 0x0F};
168 ebitn(opWithFlags
, io
, m
, /*N offset*/5);
173 struct inst io
= {0x0C00, 0x1F};
174 struct inst m
= {0x0200, 0x0F};
175 ebitn(opWithFlags
, io
, m
, /*N offset*/5);
183 struct inst m
= {0x0880 | combine
, 0x3F};
189 struct inst k
= {0x0100, 0xFF};
208 outrwp(&e
, def
.op
, 0x3FF, /*jump=*/1);
233 /* Simple instructions consisting of only one opcode and no args */
243 case S_LDSPTL
: /* undocumented */
244 case S_LDSPTH
: /* undocumented */
251 * Machine specific initialization