summaryrefslogtreecommitdiff
path: root/apps/plugins/zxbox/z80_op2.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/zxbox/z80_op2.c')
-rw-r--r--apps/plugins/zxbox/z80_op2.c165
1 files changed, 165 insertions, 0 deletions
diff --git a/apps/plugins/zxbox/z80_op2.c b/apps/plugins/zxbox/z80_op2.c
new file mode 100644
index 0000000000..89bb5af50b
--- /dev/null
+++ b/apps/plugins/zxbox/z80_op2.c
@@ -0,0 +1,165 @@
1/*
2 * Copyright (C) 1996-1998 Szeredi Miklos
3 * Email: mszeredi@inf.bme.hu
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. See the file COPYING.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 */
20
21#ifndef NO_OPDEF
22#include "z80_def.h"
23#include "z80_op2.h"
24#endif
25
26OPDEF(halt, 0x76)
27{
28 register int nn;
29
30 DANM(haltstate) = 1;
31 nn = (DANM(tc) - 1) / 4 + 1;
32
33 DANM(tc) -= 4 * nn;
34 RR += nn-1;
35 ENDOP();
36}
37
38#define LD_R_R(rdn, rsn, rd, rs, n1, n2) \
39OPDEF(ld_ ## rdn ## _ ## rsn, 0x40 + n1 * 8 + n2) \
40{ \
41 rd = rs; \
42 ENTIME(4); \
43}
44
45#if 0
46
47#define LD_NOOP(rsd, n) \
48OPDEF(ld_ ## rsd ## _ ## rsd, 0x40 + n * 8 + n) \
49{ \
50 ENTIME(4); \
51}
52
53LD_NOOP(b, 0)
54LD_NOOP(c, 1)
55LD_NOOP(d, 2)
56LD_NOOP(e, 3)
57LD_NOOP(h, 4)
58LD_NOOP(l, 5)
59LD_NOOP(a, 7)
60
61#endif
62
63LD_R_R(b, c, RB, RC, 0, 1)
64LD_R_R(b, d, RB, RD, 0, 2)
65LD_R_R(b, e, RB, RE, 0, 3)
66LD_R_R(b, h, RB, RH, 0, 4)
67LD_R_R(b, l, RB, RL, 0, 5)
68LD_R_R(b, a, RB, RA, 0, 7)
69
70LD_R_R(c, b, RC, RB, 1, 0)
71LD_R_R(c, d, RC, RD, 1, 2)
72LD_R_R(c, e, RC, RE, 1, 3)
73LD_R_R(c, h, RC, RH, 1, 4)
74LD_R_R(c, l, RC, RL, 1, 5)
75LD_R_R(c, a, RC, RA, 1, 7)
76
77LD_R_R(d, b, RD, RB, 2, 0)
78LD_R_R(d, c, RD, RC, 2, 1)
79LD_R_R(d, e, RD, RE, 2, 3)
80LD_R_R(d, h, RD, RH, 2, 4)
81LD_R_R(d, l, RD, RL, 2, 5)
82LD_R_R(d, a, RD, RA, 2, 7)
83
84
85LD_R_R(e, b, RE, RB, 3, 0)
86LD_R_R(e, c, RE, RC, 3, 1)
87LD_R_R(e, d, RE, RD, 3, 2)
88LD_R_R(e, h, RE, RH, 3, 4)
89LD_R_R(e, l, RE, RL, 3, 5)
90LD_R_R(e, a, RE, RA, 3, 7)
91
92LD_R_R(h, b, RH, RB, 4, 0)
93LD_R_R(h, c, RH, RC, 4, 1)
94LD_R_R(h, d, RH, RD, 4, 2)
95LD_R_R(h, e, RH, RE, 4, 3)
96LD_R_R(h, l, RH, RL, 4, 5)
97LD_R_R(h, a, RH, RA, 4, 7)
98
99LD_R_R(l, b, RL, RB, 5, 0)
100LD_R_R(l, c, RL, RC, 5, 1)
101LD_R_R(l, d, RL, RD, 5, 2)
102LD_R_R(l, e, RL, RE, 5, 3)
103LD_R_R(l, h, RL, RH, 5, 4)
104LD_R_R(l, a, RL, RA, 5, 7)
105
106LD_R_R(a, b, RA, RB, 7, 0)
107LD_R_R(a, c, RA, RC, 7, 1)
108LD_R_R(a, d, RA, RD, 7, 2)
109LD_R_R(a, e, RA, RE, 7, 3)
110LD_R_R(a, h, RA, RH, 7, 4)
111LD_R_R(a, l, RA, RL, 7, 5)
112
113
114#define LD_R_IHL(rdn, rd, n) \
115OPDEF(ld_ ## rdn ## _ihl, 0x46+n*8) \
116{ \
117 rd = *HLP; \
118 ENTIME(7); \
119}
120
121#define LD_R_ID(ixyn, ixy, rsn, rs, n) \
122OPDEF(ld_ ## rsn ## _i ## ixyn ## d, 0x46+n*8) \
123{ \
124 register dbyte addr; \
125 IXDGET(ixy, addr); \
126 rs = READ(addr); \
127 ENTIME(15); \
128}
129
130
131LD_R_IHL(b, RB, 0)
132LD_R_IHL(c, RC, 1)
133LD_R_IHL(d, RD, 2)
134LD_R_IHL(e, RE, 3)
135LD_R_IHL(h, RH, 4)
136LD_R_IHL(l, RL, 5)
137LD_R_IHL(a, RA, 7)
138
139#define LD_IHL_R(rsn, rs, n) \
140OPDEF(ld_ihl_ ## rsn, 0x70+n) \
141{ \
142 PUTMEM(HL, HLP, rs); \
143 ENTIME(7); \
144}
145
146#define LD_ID_R(ixyn, ixy, rsn, rs, n) \
147OPDEF(ld_i ## ixyn ## d_ ## rsn, 0x70+n) \
148{ \
149 register dbyte addr; \
150 IXDGET(ixy, addr); \
151 WRITE(addr, rs); \
152 ENTIME(15); \
153}
154
155
156
157LD_IHL_R(b, RB, 0)
158LD_IHL_R(c, RC, 1)
159LD_IHL_R(d, RD, 2)
160LD_IHL_R(e, RE, 3)
161LD_IHL_R(h, RH, 4)
162LD_IHL_R(l, RL, 5)
163LD_IHL_R(a, RA, 7)
164
165#include "z80_op2x.c"