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
34 static VOID
outpdkaw(struct inst inst
, struct expr e
) {
35 outaw(inst
.op
| (e
.e_addr
& inst
.mask
));
38 static VOID
outpdkrm(struct inst inst
, struct expr e
) {
39 /* Don't generate relocatable data if everything is constant. */
43 outrwp(&e
, inst
.op
, inst
.mask
, /*jump=*/0);
47 static VOID
outpdka(struct inst inst
) {
59 bool ioAdr
= op
& PDK_OPCODE_ADR_IO
;
64 int t
= addr(&e
, ioAdr
);
66 int t1
= addr(&e1
, ioAdr
);
68 if (t
== S_IO
&& t1
== S_A
) {
71 if (t
== S_A
&& t1
== S_IO
) {
74 if (t
== S_M
&& t1
== S_A
) {
77 if (t
== S_A
&& t1
== S_M
) {
80 if (t
== S_A
&& t1
== S_K
) {
86 VOID
eidxm(struct inst am
, struct inst ma
) {
91 int t
= addr(&e
, false);
93 int t1
= addr(&e1
, false);
95 if (t
== S_A
&& t1
== S_M
) {
98 if (t
== S_M
&& t1
== S_A
) {
104 VOID
earith(struct inst def
,
111 int t
= addr(&e
, false);
113 int t1
= addr(&e1
, false);
115 if (t
== S_M
&& t1
== S_A
) {
118 if (t
== S_A
&& t1
== S_M
) {
121 if (t
== S_A
&& t1
== S_K
) {
127 VOID
earithc(struct inst ma
,
133 int t
= more() ? addr(&e
, false) : S_A
;
138 int t1
= addr(&e1
, false);
139 if (t
== S_M
&& t1
== S_A
) {
142 if (t
== S_A
&& t1
== S_M
) {
156 VOID
eshift(struct inst a
,
160 int t
= more() ? addr(&e
, false) : S_A
;
176 bool ioAdr
= op
& PDK_OPCODE_ADR_IO
;
181 int t
= addr(&e
, ioAdr
), t1
= 0;
188 } else if (t
== S_IO
) {
194 t1
= addr(&e1
, ioAdr
);
197 if (t
== S_M
&& t1
== S_A
) {
200 if (t
== S_A
&& t1
== S_M
) {
203 if (t
== S_A
&& t1
== S_K
) {
206 if (t
== S_IO
&& t1
== S_A
&& ioa
) {
212 VOID
enot(struct inst def
, struct inst m
) {
215 int t
= more() ? addr(&e
, false) : S_A
;
219 } else if (t
== S_A
) {
225 VOID
ebitn(a_uint op
, struct inst io
, struct inst m
, int offset
) {
226 bool ioAdr
= op
& PDK_OPCODE_ADR_IO
;
231 int t
= addr(&e
, ioAdr
);
233 if (pdkbit(&e1
) != S_K
)
236 const a_uint bitn
= (e1
.e_addr
& 0x7) << offset
;
248 VOID
eskip(struct inst def
, struct inst m
) {
251 int t
= addr(&e
, false);
266 VOID
ezsn(struct inst def
, struct inst m
) {
267 /* IZSN and DZSN insts have the same params as NOT. */
271 VOID
eret(struct inst def
, struct inst k
) {
275 if (addr(&e
, false) != S_K
)
282 VOID
eone(struct inst m
) {
285 if (addr(&e
, false) != S_M
)
291 VOID
exch(struct inst m
) {
295 int t
= addr(&e
, false);
306 VOID
epupo(struct inst def
) {
307 if (more() && (def
.op
& 0x2000)) {
311 if (!more() || ((t
= getnb()) != 'f'))
318 VOID
eopta(struct inst def
) {
322 if (addr(&e
, false) != S_A
)
328 VOID
eswapc(a_uint op
, struct inst iok
, int offset
) {
329 bool ioAdr
= op
& PDK_OPCODE_ADR_IO
;
334 int t
= addr(&e
, ioAdr
);
336 int t1
= pdkbit(&e1
);
338 if (t
!= S_IO
|| t1
!= S_K
)
341 iok
.op
|= (e1
.e_addr
& 0x7) << offset
;
345 VOID
espec(struct inst am
, struct inst ma
) {
350 int t
= addr(&e
, false);
352 int t1
= addr(&e1
, false);
354 if (t
== S_A
&& t1
== S_M
) {
357 if (t
== S_M
&& t1
== S_A
) {