diff options
Diffstat (limited to 'apps/plugins/zxbox/z80_op2.c')
-rw-r--r-- | apps/plugins/zxbox/z80_op2.c | 165 |
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 | |||
26 | OPDEF(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) \ | ||
39 | OPDEF(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) \ | ||
48 | OPDEF(ld_ ## rsd ## _ ## rsd, 0x40 + n * 8 + n) \ | ||
49 | { \ | ||
50 | ENTIME(4); \ | ||
51 | } | ||
52 | |||
53 | LD_NOOP(b, 0) | ||
54 | LD_NOOP(c, 1) | ||
55 | LD_NOOP(d, 2) | ||
56 | LD_NOOP(e, 3) | ||
57 | LD_NOOP(h, 4) | ||
58 | LD_NOOP(l, 5) | ||
59 | LD_NOOP(a, 7) | ||
60 | |||
61 | #endif | ||
62 | |||
63 | LD_R_R(b, c, RB, RC, 0, 1) | ||
64 | LD_R_R(b, d, RB, RD, 0, 2) | ||
65 | LD_R_R(b, e, RB, RE, 0, 3) | ||
66 | LD_R_R(b, h, RB, RH, 0, 4) | ||
67 | LD_R_R(b, l, RB, RL, 0, 5) | ||
68 | LD_R_R(b, a, RB, RA, 0, 7) | ||
69 | |||
70 | LD_R_R(c, b, RC, RB, 1, 0) | ||
71 | LD_R_R(c, d, RC, RD, 1, 2) | ||
72 | LD_R_R(c, e, RC, RE, 1, 3) | ||
73 | LD_R_R(c, h, RC, RH, 1, 4) | ||
74 | LD_R_R(c, l, RC, RL, 1, 5) | ||
75 | LD_R_R(c, a, RC, RA, 1, 7) | ||
76 | |||
77 | LD_R_R(d, b, RD, RB, 2, 0) | ||
78 | LD_R_R(d, c, RD, RC, 2, 1) | ||
79 | LD_R_R(d, e, RD, RE, 2, 3) | ||
80 | LD_R_R(d, h, RD, RH, 2, 4) | ||
81 | LD_R_R(d, l, RD, RL, 2, 5) | ||
82 | LD_R_R(d, a, RD, RA, 2, 7) | ||
83 | |||
84 | |||
85 | LD_R_R(e, b, RE, RB, 3, 0) | ||
86 | LD_R_R(e, c, RE, RC, 3, 1) | ||
87 | LD_R_R(e, d, RE, RD, 3, 2) | ||
88 | LD_R_R(e, h, RE, RH, 3, 4) | ||
89 | LD_R_R(e, l, RE, RL, 3, 5) | ||
90 | LD_R_R(e, a, RE, RA, 3, 7) | ||
91 | |||
92 | LD_R_R(h, b, RH, RB, 4, 0) | ||
93 | LD_R_R(h, c, RH, RC, 4, 1) | ||
94 | LD_R_R(h, d, RH, RD, 4, 2) | ||
95 | LD_R_R(h, e, RH, RE, 4, 3) | ||
96 | LD_R_R(h, l, RH, RL, 4, 5) | ||
97 | LD_R_R(h, a, RH, RA, 4, 7) | ||
98 | |||
99 | LD_R_R(l, b, RL, RB, 5, 0) | ||
100 | LD_R_R(l, c, RL, RC, 5, 1) | ||
101 | LD_R_R(l, d, RL, RD, 5, 2) | ||
102 | LD_R_R(l, e, RL, RE, 5, 3) | ||
103 | LD_R_R(l, h, RL, RH, 5, 4) | ||
104 | LD_R_R(l, a, RL, RA, 5, 7) | ||
105 | |||
106 | LD_R_R(a, b, RA, RB, 7, 0) | ||
107 | LD_R_R(a, c, RA, RC, 7, 1) | ||
108 | LD_R_R(a, d, RA, RD, 7, 2) | ||
109 | LD_R_R(a, e, RA, RE, 7, 3) | ||
110 | LD_R_R(a, h, RA, RH, 7, 4) | ||
111 | LD_R_R(a, l, RA, RL, 7, 5) | ||
112 | |||
113 | |||
114 | #define LD_R_IHL(rdn, rd, n) \ | ||
115 | OPDEF(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) \ | ||
122 | OPDEF(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 | |||
131 | LD_R_IHL(b, RB, 0) | ||
132 | LD_R_IHL(c, RC, 1) | ||
133 | LD_R_IHL(d, RD, 2) | ||
134 | LD_R_IHL(e, RE, 3) | ||
135 | LD_R_IHL(h, RH, 4) | ||
136 | LD_R_IHL(l, RL, 5) | ||
137 | LD_R_IHL(a, RA, 7) | ||
138 | |||
139 | #define LD_IHL_R(rsn, rs, n) \ | ||
140 | OPDEF(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) \ | ||
147 | OPDEF(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 | |||
157 | LD_IHL_R(b, RB, 0) | ||
158 | LD_IHL_R(c, RC, 1) | ||
159 | LD_IHL_R(d, RD, 2) | ||
160 | LD_IHL_R(e, RE, 3) | ||
161 | LD_IHL_R(h, RH, 4) | ||
162 | LD_IHL_R(l, RL, 5) | ||
163 | LD_IHL_R(a, RA, 7) | ||
164 | |||
165 | #include "z80_op2x.c" | ||