Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1088 | alone | 1 | #include "defs.h" |
2 | #include "tables.h" |
||
3 | #include "op_noprefix.h" |
||
4 | #include "op_dd.h" |
||
5 | |||
6 | /* DD prefix opcodes */ |
||
7 | |||
8 | //#ifdef Z80_COMMON |
||
9 | static Z80OPCODE opx_09(Z80 *cpu) { // add ix,bc |
||
10 | cpu->memptr = cpu->ix+1; |
||
11 | cpu->f = (cpu->f & ~(NF | CF | F5 | F3 | HF)); |
||
12 | cpu->f |= (((cpu->ix & 0x0FFF) + (cpu->bc & 0x0FFF)) >> 8) & 0x10; /* HF */ |
||
13 | cpu->ix = (cpu->ix & 0xFFFF) + (cpu->bc & 0xFFFF); |
||
14 | if (cpu->ix & 0x10000) cpu->f |= CF; |
||
15 | cpu->f |= (cpu->xh & (F5 | F3)); |
||
16 | cpu->t += 7; |
||
17 | } |
||
18 | static Z80OPCODE opx_19(Z80 *cpu) { // add ix,de |
||
19 | cpu->memptr = cpu->ix+1; |
||
20 | cpu->f = (cpu->f & ~(NF | CF | F5 | F3 | HF)); |
||
21 | cpu->f |= (((cpu->ix & 0x0FFF) + (cpu->de & 0x0FFF)) >> 8) & 0x10; /* HF */ |
||
22 | cpu->ix = (cpu->ix & 0xFFFF) + (cpu->de & 0xFFFF); |
||
23 | if (cpu->ix & 0x10000) cpu->f |= CF; |
||
24 | cpu->f |= (cpu->xh & (F5 | F3)); |
||
25 | cpu->t += 7; |
||
26 | } |
||
27 | //#endif |
||
28 | //#ifndef Z80_COMMON |
||
29 | static Z80OPCODE opx_21(Z80 *cpu) { // ld ix,nnnn |
||
30 | cpu->xl = cpu->MemIf->xm(cpu->pc++); |
||
31 | cpu->xh = cpu->MemIf->xm(cpu->pc++); |
||
32 | cpu->t += 6; |
||
33 | } |
||
34 | static Z80OPCODE opx_22(Z80 *cpu) { // ld (nnnn),ix | M:6 T:20 (4, 4, 3, 3, 3, 3) |
||
35 | unsigned adr = cpu->MemIf->xm(cpu->pc++); |
||
36 | adr += cpu->MemIf->xm(cpu->pc++)*0x100; |
||
37 | cpu->memptr = adr+1; |
||
38 | cpu->MemIf->wm(adr, cpu->xl); |
||
39 | cpu->MemIf->wm(adr+1, cpu->xh); |
||
40 | cpu->t += 12; |
||
41 | } |
||
42 | //#endif |
||
43 | //#ifdef Z80_COMMON |
||
44 | static Z80OPCODE opx_23(Z80 *cpu) { // inc ix |
||
45 | cpu->ix++; |
||
46 | cpu->t += 2; |
||
47 | } |
||
48 | static Z80OPCODE opx_24(Z80 *cpu) { // inc xh |
||
49 | inc8(cpu, cpu->xh); |
||
50 | } |
||
51 | static Z80OPCODE opx_25(Z80 *cpu) { // dec xh |
||
52 | dec8(cpu, cpu->xh); |
||
53 | } |
||
54 | //#endif |
||
55 | //#ifndef Z80_COMMON |
||
56 | static Z80OPCODE opx_26(Z80 *cpu) { // ld xh,nn |
||
57 | cpu->xh = cpu->MemIf->xm(cpu->pc++); |
||
58 | cpu->t += 3; |
||
59 | } |
||
60 | //#endif |
||
61 | //#ifdef Z80_COMMON |
||
62 | static Z80OPCODE opx_29(Z80 *cpu) { // add ix,ix |
||
63 | cpu->memptr = cpu->ix+1; |
||
64 | cpu->f = (cpu->f & ~(NF | CF | F5 | F3 | HF)); |
||
65 | cpu->f |= ((cpu->ix >> 7) & 0x10); /* HF */ |
||
66 | cpu->ix = (cpu->ix & 0xFFFF)*2; |
||
67 | if (cpu->ix & 0x10000) cpu->f |= CF; |
||
68 | cpu->f |= (cpu->xh & (F5 | F3)); |
||
69 | cpu->t += 7; |
||
70 | } |
||
71 | //#endif |
||
72 | //#ifndef Z80_COMMON |
||
73 | static Z80OPCODE opx_2A(Z80 *cpu) { // ld ix,(nnnn) |
||
74 | unsigned adr = cpu->MemIf->xm(cpu->pc++); |
||
75 | adr += cpu->MemIf->xm(cpu->pc++)*0x100; |
||
76 | cpu->memptr = adr+1; |
||
77 | cpu->xl = cpu->MemIf->rm(adr); |
||
78 | cpu->xh = cpu->MemIf->rm(adr+1); |
||
79 | cpu->t += 12; |
||
80 | } |
||
81 | //#endif |
||
82 | //#ifdef Z80_COMMON |
||
83 | static Z80OPCODE opx_2B(Z80 *cpu) { // dec ix |
||
84 | cpu->ix--; |
||
85 | cpu->t += 2; |
||
86 | } |
||
87 | static Z80OPCODE opx_2C(Z80 *cpu) { // inc xl |
||
88 | inc8(cpu, cpu->xl); |
||
89 | } |
||
90 | static Z80OPCODE opx_2D(Z80 *cpu) { // dec xl |
||
91 | dec8(cpu, cpu->xl); |
||
92 | } |
||
93 | //#endif |
||
94 | //#ifndef Z80_COMMON |
||
95 | static Z80OPCODE opx_2E(Z80 *cpu) { // ld xl,nn |
||
96 | cpu->xl = cpu->MemIf->xm(cpu->pc++); |
||
97 | cpu->t += 3; |
||
98 | } |
||
99 | static Z80OPCODE opx_34(Z80 *cpu) { // inc (ix+nn) | M:6 T:23 (4, 4, 3, 5, 4, 3) |
||
100 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
101 | unsigned char t = cpu->MemIf->rm(u32(int(cpu->ix) + ofs)); |
||
102 | inc8(cpu, t); |
||
103 | cpu->MemIf->wm(u32(int(cpu->ix) + ofs), t); |
||
104 | cpu->t += 15; |
||
105 | } |
||
106 | static Z80OPCODE opx_35(Z80 *cpu) { // dec (ix+nn) | M:6 T:23 (4, 4, 3, 5, 4, 3) |
||
107 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
108 | unsigned char t = cpu->MemIf->rm(u32(int(cpu->ix) + ofs)); |
||
109 | dec8(cpu, t); |
||
110 | cpu->MemIf->wm(u32(int(cpu->ix) + ofs), t); |
||
111 | cpu->t += 15; |
||
112 | } |
||
113 | static Z80OPCODE opx_36(Z80 *cpu) { // ld (ix+nn),nn | M:5 T:19 (4, 4, 3,5,3) |
||
114 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
115 | cpu->MemIf->wm(u32(int(cpu->ix) + ofs), cpu->MemIf->rm(cpu->pc++)); |
||
116 | cpu->t += 11; |
||
117 | } |
||
118 | //#endif |
||
119 | //#ifdef Z80_COMMON |
||
120 | static Z80OPCODE opx_39(Z80 *cpu) { // add ix,sp |
||
121 | cpu->memptr = cpu->ix+1; |
||
122 | cpu->f = (cpu->f & ~(NF | CF | F5 | F3 | HF)); |
||
123 | cpu->f |= (((cpu->ix & 0x0FFF) + (cpu->sp & 0x0FFF)) >> 8) & 0x10; /* HF */ |
||
124 | cpu->ix = (cpu->ix & 0xFFFF) + (cpu->sp & 0xFFFF); |
||
125 | if (cpu->ix & 0x10000) cpu->f |= CF; |
||
126 | cpu->f |= (cpu->xh & (F5 | F3)); |
||
127 | cpu->t += 7; |
||
128 | } |
||
129 | static Z80OPCODE opx_44(Z80 *cpu) { // ld b,xh |
||
130 | cpu->b = cpu->xh; |
||
131 | } |
||
132 | static Z80OPCODE opx_45(Z80 *cpu) { // ld b,xl |
||
133 | cpu->b = cpu->xl; |
||
134 | } |
||
135 | //#endif |
||
136 | //#ifndef Z80_COMMON |
||
137 | static Z80OPCODE opx_46(Z80 *cpu) { // ld b,(ix+nn) |
||
138 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
139 | cpu->b = cpu->MemIf->rm(unsigned(int(cpu->ix) + ofs)); |
||
140 | cpu->t += 11; |
||
141 | } |
||
142 | //#endif |
||
143 | //#ifdef Z80_COMMON |
||
144 | static Z80OPCODE opx_4C(Z80 *cpu) { // ld c,xh |
||
145 | cpu->c = cpu->xh; |
||
146 | } |
||
147 | static Z80OPCODE opx_4D(Z80 *cpu) { // ld c,xl |
||
148 | cpu->c = cpu->xl; |
||
149 | } |
||
150 | //#endif |
||
151 | //#ifndef Z80_COMMON |
||
152 | static Z80OPCODE opx_4E(Z80 *cpu) { // ld c,(ix+nn) |
||
153 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
154 | cpu->c = cpu->MemIf->rm(unsigned(int(cpu->ix) + ofs)); |
||
155 | cpu->t += 11; |
||
156 | } |
||
157 | //#endif |
||
158 | //#ifdef Z80_COMMON |
||
159 | static Z80OPCODE opx_54(Z80 *cpu) { // ld d,xh |
||
160 | cpu->d = cpu->xh; |
||
161 | } |
||
162 | static Z80OPCODE opx_55(Z80 *cpu) { // ld d,xl |
||
163 | cpu->d = cpu->xl; |
||
164 | } |
||
165 | //#endif |
||
166 | //#ifndef Z80_COMMON |
||
167 | static Z80OPCODE opx_56(Z80 *cpu) { // ld d,(ix+nn) |
||
168 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
169 | cpu->d = cpu->MemIf->rm(unsigned(int(cpu->ix) + ofs)); |
||
170 | cpu->t += 11; |
||
171 | } |
||
172 | //#endif |
||
173 | //#ifdef Z80_COMMON |
||
174 | static Z80OPCODE opx_5C(Z80 *cpu) { // ld e,xh |
||
175 | cpu->e = cpu->xh; |
||
176 | } |
||
177 | static Z80OPCODE opx_5D(Z80 *cpu) { // ld e,xl |
||
178 | cpu->e = cpu->xl; |
||
179 | } |
||
180 | //#endif |
||
181 | //#ifndef Z80_COMMON |
||
182 | static Z80OPCODE opx_5E(Z80 *cpu) { // ld e,(ix+nn) |
||
183 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
184 | cpu->e = cpu->MemIf->rm(unsigned(int(cpu->ix) + ofs)); |
||
185 | cpu->t += 11; |
||
186 | } |
||
187 | //#endif |
||
188 | //#ifdef Z80_COMMON |
||
189 | static Z80OPCODE opx_60(Z80 *cpu) { // ld xh,b |
||
190 | cpu->xh = cpu->b; |
||
191 | } |
||
192 | static Z80OPCODE opx_61(Z80 *cpu) { // ld xh,c |
||
193 | cpu->xh = cpu->c; |
||
194 | } |
||
195 | static Z80OPCODE opx_62(Z80 *cpu) { // ld xh,d |
||
196 | cpu->xh = cpu->d; |
||
197 | } |
||
198 | static Z80OPCODE opx_63(Z80 *cpu) { // ld xh,e |
||
199 | cpu->xh = cpu->e; |
||
200 | } |
||
201 | static Z80OPCODE opx_65(Z80 *cpu) { // ld xh,xl |
||
202 | cpu->xh = cpu->xl; |
||
203 | } |
||
204 | //#endif |
||
205 | //#ifndef Z80_COMMON |
||
206 | static Z80OPCODE opx_66(Z80 *cpu) { // ld h,(ix+nn) |
||
207 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
208 | cpu->h = cpu->MemIf->rm(unsigned(int(cpu->ix) + ofs)); |
||
209 | cpu->t += 11; |
||
210 | } |
||
211 | //#endif |
||
212 | //#ifdef Z80_COMMON |
||
213 | static Z80OPCODE opx_67(Z80 *cpu) { // ld xh,a |
||
214 | cpu->xh = cpu->a; |
||
215 | } |
||
216 | static Z80OPCODE opx_68(Z80 *cpu) { // ld xl,b |
||
217 | cpu->xl = cpu->b; |
||
218 | } |
||
219 | static Z80OPCODE opx_69(Z80 *cpu) { // ld xl,c |
||
220 | cpu->xl = cpu->c; |
||
221 | } |
||
222 | static Z80OPCODE opx_6A(Z80 *cpu) { // ld xl,d |
||
223 | cpu->xl = cpu->d; |
||
224 | } |
||
225 | static Z80OPCODE opx_6B(Z80 *cpu) { // ld xl,e |
||
226 | cpu->xl = cpu->e; |
||
227 | } |
||
228 | static Z80OPCODE opx_6C(Z80 *cpu) { // ld xl,xh |
||
229 | cpu->xl = cpu->xh; |
||
230 | } |
||
231 | //#endif |
||
232 | //#ifndef Z80_COMMON |
||
233 | static Z80OPCODE opx_6E(Z80 *cpu) { // ld l,(ix+nn) |
||
234 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
235 | cpu->l = cpu->MemIf->rm(unsigned(int(cpu->ix) + ofs)); |
||
236 | cpu->t += 11; |
||
237 | } |
||
238 | //#endif |
||
239 | //#ifdef Z80_COMMON |
||
240 | static Z80OPCODE opx_6F(Z80 *cpu) { // ld xl,a |
||
241 | cpu->xl = cpu->a; |
||
242 | } |
||
243 | //#endif |
||
244 | //#ifndef Z80_COMMON |
||
245 | static Z80OPCODE opx_70(Z80 *cpu) { // ld (ix+nn),b | M:5 T:19 (4, 4, 3, 5, 3) |
||
246 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
247 | cpu->MemIf->wm(unsigned(int(cpu->ix) + ofs), cpu->b); |
||
248 | cpu->t += 11; |
||
249 | } |
||
250 | static Z80OPCODE opx_71(Z80 *cpu) { // ld (ix+nn),c | M:5 T:19 (4, 4, 3, 5, 3) |
||
251 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
252 | cpu->MemIf->wm(unsigned(int(cpu->ix) + ofs), cpu->c); |
||
253 | cpu->t += 11; |
||
254 | } |
||
255 | static Z80OPCODE opx_72(Z80 *cpu) { // ld (ix+nn),d | M:5 T:19 (4, 4, 3, 5, 3) |
||
256 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
257 | cpu->MemIf->wm(unsigned(int(cpu->ix) + ofs), cpu->d); |
||
258 | cpu->t += 11; |
||
259 | } |
||
260 | static Z80OPCODE opx_73(Z80 *cpu) { // ld (ix+nn),e | M:5 T:19 (4, 4, 3, 5, 3) |
||
261 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
262 | cpu->MemIf->wm(unsigned(int(cpu->ix) + ofs), cpu->e); |
||
263 | cpu->t += 11; |
||
264 | } |
||
265 | static Z80OPCODE opx_74(Z80 *cpu) { // ld (ix+nn),h | M:5 T:19 (4, 4, 3, 5, 3) |
||
266 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
267 | cpu->MemIf->wm(unsigned(int(cpu->ix) + ofs), cpu->h); |
||
268 | cpu->t += 11; |
||
269 | } |
||
270 | static Z80OPCODE opx_75(Z80 *cpu) { // ld (ix+nn),l | M:5 T:19 (4, 4, 3, 5, 3) |
||
271 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
272 | cpu->MemIf->wm(u32(int(cpu->ix) + ofs), cpu->l); |
||
273 | cpu->t += 11; |
||
274 | } |
||
275 | static Z80OPCODE opx_77(Z80 *cpu) { // ld (ix+nn),a | M:5 T:19 (4, 4, 3, 5, 3) |
||
276 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
277 | cpu->MemIf->wm(unsigned(int(cpu->ix) + ofs), cpu->a); |
||
278 | cpu->t += 11; |
||
279 | } |
||
280 | //#endif |
||
281 | //#ifdef Z80_COMMON |
||
282 | static Z80OPCODE opx_7C(Z80 *cpu) { // ld a,xh |
||
283 | cpu->a = cpu->xh; |
||
284 | } |
||
285 | static Z80OPCODE opx_7D(Z80 *cpu) { // ld a,xl |
||
286 | cpu->a = cpu->xl; |
||
287 | } |
||
288 | //#endif |
||
289 | //#ifndef Z80_COMMON |
||
290 | static Z80OPCODE opx_7E(Z80 *cpu) { // ld a,(ix+nn) |
||
291 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
292 | cpu->a = cpu->MemIf->rm(unsigned(int(cpu->ix) + ofs)); |
||
293 | cpu->t += 11; |
||
294 | } |
||
295 | //#endif |
||
296 | //#ifdef Z80_COMMON |
||
297 | static Z80OPCODE opx_84(Z80 *cpu) { // add a,xh |
||
298 | add8(cpu, cpu->xh); |
||
299 | } |
||
300 | static Z80OPCODE opx_85(Z80 *cpu) { // add a,xl |
||
301 | add8(cpu, cpu->xl); |
||
302 | } |
||
303 | //#endif |
||
304 | //#ifndef Z80_COMMON |
||
305 | static Z80OPCODE opx_86(Z80 *cpu) { // add a,(ix+nn) |
||
306 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
307 | add8(cpu, cpu->MemIf->rm(unsigned(int(cpu->ix) + ofs))); |
||
308 | cpu->t += 11; |
||
309 | } |
||
310 | //#endif |
||
311 | //#ifdef Z80_COMMON |
||
312 | static Z80OPCODE opx_8C(Z80 *cpu) { // adc a,xh |
||
313 | adc8(cpu, cpu->xh); |
||
314 | } |
||
315 | static Z80OPCODE opx_8D(Z80 *cpu) { // adc a,xl |
||
316 | adc8(cpu, cpu->xl); |
||
317 | } |
||
318 | //#endif |
||
319 | //#ifndef Z80_COMMON |
||
320 | static Z80OPCODE opx_8E(Z80 *cpu) { // adc a,(ix+nn) |
||
321 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
322 | adc8(cpu, cpu->MemIf->rm(u32(int(cpu->ix) + ofs))); |
||
323 | cpu->t += 11; |
||
324 | } |
||
325 | //#endif |
||
326 | //#ifdef Z80_COMMON |
||
327 | static Z80OPCODE opx_94(Z80 *cpu) { // sub xh |
||
328 | sub8(cpu, cpu->xh); |
||
329 | } |
||
330 | static Z80OPCODE opx_95(Z80 *cpu) { // sub xl |
||
331 | sub8(cpu, cpu->xl); |
||
332 | } |
||
333 | //#endif |
||
334 | //#ifndef Z80_COMMON |
||
335 | static Z80OPCODE opx_96(Z80 *cpu) { // sub (ix+nn) |
||
336 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
337 | sub8(cpu, cpu->MemIf->rm(u32(int(cpu->ix) + ofs))); |
||
338 | cpu->t += 11; |
||
339 | } |
||
340 | //#endif |
||
341 | //#ifdef Z80_COMMON |
||
342 | static Z80OPCODE opx_9C(Z80 *cpu) { // sbc a,xh |
||
343 | sbc8(cpu, cpu->xh); |
||
344 | } |
||
345 | static Z80OPCODE opx_9D(Z80 *cpu) { // sbc a,xl |
||
346 | sbc8(cpu, cpu->xl); |
||
347 | } |
||
348 | //#endif |
||
349 | //#ifndef Z80_COMMON |
||
350 | static Z80OPCODE opx_9E(Z80 *cpu) { // sbc a,(ix+nn) |
||
351 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
352 | sbc8(cpu, cpu->MemIf->rm(u32(int(cpu->ix) + ofs))); |
||
353 | cpu->t += 11; |
||
354 | } |
||
355 | //#endif |
||
356 | //#ifdef Z80_COMMON |
||
357 | static Z80OPCODE opx_A4(Z80 *cpu) { // and xh |
||
358 | and8(cpu, cpu->xh); |
||
359 | } |
||
360 | static Z80OPCODE opx_A5(Z80 *cpu) { // and xl |
||
361 | and8(cpu, cpu->xl); |
||
362 | } |
||
363 | //#endif |
||
364 | //#ifndef Z80_COMMON |
||
365 | static Z80OPCODE opx_A6(Z80 *cpu) { // and (ix+nn) |
||
366 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
367 | and8(cpu, cpu->MemIf->rm(u32(int(cpu->ix) + ofs))); |
||
368 | cpu->t += 11; |
||
369 | } |
||
370 | //#endif |
||
371 | //#ifdef Z80_COMMON |
||
372 | static Z80OPCODE opx_AC(Z80 *cpu) { // xor xh |
||
373 | xor8(cpu, cpu->xh); |
||
374 | } |
||
375 | static Z80OPCODE opx_AD(Z80 *cpu) { // xor xl |
||
376 | xor8(cpu, cpu->xl); |
||
377 | } |
||
378 | //#endif |
||
379 | //#ifndef Z80_COMMON |
||
380 | static Z80OPCODE opx_AE(Z80 *cpu) { // xor (ix+nn) |
||
381 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
382 | xor8(cpu, cpu->MemIf->rm(u32(int(cpu->ix) + ofs))); |
||
383 | cpu->t += 11; |
||
384 | } |
||
385 | //#endif |
||
386 | //#ifdef Z80_COMMON |
||
387 | static Z80OPCODE opx_B4(Z80 *cpu) { // or xh |
||
388 | or8(cpu, cpu->xh); |
||
389 | } |
||
390 | static Z80OPCODE opx_B5(Z80 *cpu) { // or xl |
||
391 | or8(cpu, cpu->xl); |
||
392 | } |
||
393 | //#endif |
||
394 | //#ifndef Z80_COMMON |
||
395 | static Z80OPCODE opx_B6(Z80 *cpu) { // or (ix+nn) |
||
396 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
397 | or8(cpu, cpu->MemIf->rm(u32(int(cpu->ix) + ofs))); |
||
398 | cpu->t += 11; |
||
399 | } |
||
400 | //#endif |
||
401 | //#ifdef Z80_COMMON |
||
402 | static Z80OPCODE opx_BC(Z80 *cpu) { // cp xh |
||
403 | cp8(cpu, cpu->xh); |
||
404 | } |
||
405 | static Z80OPCODE opx_BD(Z80 *cpu) { // cp xl |
||
406 | cp8(cpu, cpu->xl); |
||
407 | } |
||
408 | //#endif |
||
409 | //#ifndef Z80_COMMON |
||
410 | static Z80OPCODE opx_BE(Z80 *cpu) { // cp (ix+nn) |
||
411 | signed char ofs = i8(cpu->MemIf->xm(cpu->pc++)); |
||
412 | cp8(cpu, cpu->MemIf->rm(u32(int(cpu->ix) + ofs))); |
||
413 | cpu->t += 11; |
||
414 | } |
||
415 | static Z80OPCODE opx_E1(Z80 *cpu) { // pop ix |
||
416 | cpu->xl = cpu->MemIf->rm(cpu->sp++); |
||
417 | cpu->xh = cpu->MemIf->rm(cpu->sp++); |
||
418 | cpu->t += 6; |
||
419 | } |
||
420 | static Z80OPCODE opx_E3(Z80 *cpu) { // ex (sp),ix | M:6 T:23 (4, 4, 3, 4, 3, 5) |
||
421 | unsigned tmp = cpu->MemIf->rm(cpu->sp) + 0x100*cpu->MemIf->rm(cpu->sp + 1); |
||
422 | cpu->MemIf->wm(cpu->sp, cpu->xl); |
||
423 | cpu->MemIf->wm(cpu->sp+1, cpu->xh); |
||
424 | cpu->memptr = tmp; |
||
425 | cpu->ix = tmp; |
||
426 | cpu->t += 15; |
||
427 | } |
||
428 | static Z80OPCODE opx_E5(Z80 *cpu) { // push ix | M:4 T:15 (4, 5, 3, 3) |
||
429 | cpu->MemIf->wm(--cpu->sp, cpu->xh); |
||
430 | cpu->MemIf->wm(--cpu->sp, cpu->xl); |
||
431 | cpu->t += 7; |
||
432 | } |
||
433 | //#endif |
||
434 | //#ifdef Z80_COMMON |
||
435 | static Z80OPCODE opx_E9(Z80 *cpu) { // jp (ix) |
||
436 | cpu->last_branch = u16(cpu->pc-2); |
||
437 | cpu->pc = cpu->ix; |
||
438 | } |
||
439 | static Z80OPCODE opx_F9(Z80 *cpu) { // ld sp,ix |
||
440 | cpu->sp = cpu->ix; |
||
441 | cpu->t += 2; |
||
442 | } |
||
443 | //#endif |
||
444 | //#ifndef Z80_COMMON |
||
445 | |||
446 | STEPFUNC const ix_opcode[0x100] = { |
||
447 | |||
448 | op_00, op_01, op_02, op_03, op_04, op_05, op_06, op_07, |
||
449 | op_08, opx_09, op_0A, op_0B, op_0C, op_0D, op_0E, op_0F, |
||
450 | op_10, op_11, op_12, op_13, op_14, op_15, op_16, op_17, |
||
451 | op_18, opx_19, op_1A, op_1B, op_1C, op_1D, op_1E, op_1F, |
||
452 | op_20, opx_21, opx_22, opx_23, opx_24, opx_25, opx_26, op_27, |
||
453 | op_28, opx_29, opx_2A, opx_2B, opx_2C, opx_2D, opx_2E, op_2F, |
||
454 | op_30, op_31, op_32, op_33, opx_34, opx_35, opx_36, op_37, |
||
455 | op_38, opx_39, op_3A, op_3B, op_3C, op_3D, op_3E, op_3F, |
||
456 | |||
457 | op_40, op_41, op_42, op_43, opx_44, opx_45, opx_46, op_47, |
||
458 | op_48, op_49, op_4A, op_4B, opx_4C, opx_4D, opx_4E, op_4F, |
||
459 | op_50, op_51, op_52, op_53, opx_54, opx_55, opx_56, op_57, |
||
460 | op_58, op_59, op_5A, op_5B, opx_5C, opx_5D, opx_5E, op_5F, |
||
461 | opx_60, opx_61, opx_62, opx_63, op_64, opx_65, opx_66, opx_67, |
||
462 | opx_68, opx_69, opx_6A, opx_6B, opx_6C, op_6D, opx_6E, opx_6F, |
||
463 | opx_70, opx_71, opx_72, opx_73, opx_74, opx_75, op_76, opx_77, |
||
464 | op_78, op_79, op_7A, op_7B, opx_7C, opx_7D, opx_7E, op_7F, |
||
465 | |||
466 | op_80, op_81, op_82, op_83, opx_84, opx_85, opx_86, op_87, |
||
467 | op_88, op_89, op_8A, op_8B, opx_8C, opx_8D, opx_8E, op_8F, |
||
468 | op_90, op_91, op_92, op_93, opx_94, opx_95, opx_96, op_97, |
||
469 | op_98, op_99, op_9A, op_9B, opx_9C, opx_9D, opx_9E, op_9F, |
||
470 | op_A0, op_A1, op_A2, op_A3, opx_A4, opx_A5, opx_A6, op_A7, |
||
471 | op_A8, op_A9, op_AA, op_AB, opx_AC, opx_AD, opx_AE, op_AF, |
||
472 | op_B0, op_B1, op_B2, op_B3, opx_B4, opx_B5, opx_B6, op_B7, |
||
473 | op_B8, op_B9, op_BA, op_BB, opx_BC, opx_BD, opx_BE, op_BF, |
||
474 | |||
475 | op_C0, op_C1, op_C2, op_C3, op_C4, op_C5, op_C6, op_C7, |
||
476 | op_C8, op_C9, op_CA, op_CB, op_CC, op_CD, op_CE, op_CF, |
||
477 | op_D0, op_D1, op_D2, op_D3, op_D4, op_D5, op_D6, op_D7, |
||
478 | op_D8, op_D9, op_DA, op_DB, op_DC, op_DD, op_DE, op_DF, |
||
479 | op_E0, opx_E1, op_E2, opx_E3, op_E4, opx_E5, op_E6, op_E7, |
||
480 | op_E8, opx_E9, op_EA, op_EB, op_EC, op_ED, op_EE, op_EF, |
||
481 | op_F0, op_F1, op_F2, op_F3, op_F4, op_F5, op_F6, op_F7, |
||
482 | op_F8, opx_F9, op_FA, op_FB, op_FC, op_FD, op_FE, op_FF, |
||
483 | |||
484 | }; |
||
485 | |||
486 | //#endif |