]>
Commit | Line | Data |
---|---|---|
e7a0f403 | 1 | ; 8080/Z80 Interpreter. |
fa9059af L |
2 | ; This is part of the Z80-CP/M emulator written by Sprite_tm. |
3 | ; | |
4 | ||
5 | ; Copyright (C) 2010 Sprite_tm | |
6 | ; Copyright (C) 2010 Leo C. | |
7 | ; Copyright (C) 2010 Horst S. | |
8 | ||
9 | ; This file is part of avrcpm. | |
10 | ; | |
11 | ; avrcpm is free software: you can redistribute it and/or modify it | |
12 | ; under the terms of the GNU General Public License as published by | |
13 | ; the Free Software Foundation, either version 3 of the License, or | |
14 | ; (at your option) any later version. | |
15 | ; | |
16 | ; avrcpm is distributed in the hope that it will be useful, | |
17 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ; GNU General Public License for more details. | |
20 | ; | |
21 | ; You should have received a copy of the GNU General Public License | |
22 | ; along with avrcpm. If not, see <http://www.gnu.org/licenses/>. | |
23 | ; | |
24 | ; $Id$ | |
25 | ; | |
26 | ||
e7a0f403 | 27 | #if EM_Z80 |
2217c855 | 28 | #define OPC_TABSTART 0x1900 |
e7a0f403 L |
29 | #else |
30 | #define OPC_TABSTART 0x1200 | |
31 | #endif | |
32 | ||
fa9059af | 33 | .dseg |
e7a0f403 | 34 | z_regs: |
fa9059af L |
35 | z_b: .byte 1 |
36 | z_c: .byte 1 | |
37 | z_d: .byte 1 | |
38 | z_e: .byte 1 | |
39 | z_h: .byte 1 | |
40 | z_l: .byte 1 | |
41 | ||
e7a0f403 L |
42 | .equ oz_b = 0 |
43 | .equ oz_c = 1 | |
44 | .equ oz_d = 2 | |
45 | .equ oz_e = 3 | |
46 | .equ oz_h = 4 | |
47 | .equ oz_l = 5 | |
48 | ||
49 | ||
fa9059af | 50 | #if EM_Z80 |
80e1fa71 L |
51 | z_b2: .byte 1 |
52 | z_c2: .byte 1 | |
53 | z_d2: .byte 1 | |
54 | z_e2: .byte 1 | |
55 | z_h2: .byte 1 | |
56 | z_l2: .byte 1 | |
e7a0f403 L |
57 | z_f2: .byte 1 |
58 | z_a2: .byte 1 | |
59 | .equ r2ofs = z_b2-z_b | |
60 | .equ oz_b2 = 6 | |
61 | .equ oz_c2 = 7 | |
62 | .equ oz_d2 = 8 | |
63 | .equ oz_e2 = 9 | |
64 | .equ oz_h2 = 10 | |
65 | .equ oz_l2 = 11 | |
66 | .equ oz_f2 = 12 | |
67 | .equ oz_a2 = 13 | |
80e1fa71 | 68 | |
fa9059af L |
69 | z_xh: .byte 1 |
70 | z_xl: .byte 1 | |
71 | z_yh: .byte 1 | |
72 | z_yl: .byte 1 | |
73 | ||
74 | z_i: .byte 1 | |
75 | z_r: .byte 1 | |
e7a0f403 L |
76 | .equ oz_xh = 14 |
77 | .equ oz_xl = 15 | |
78 | .equ oz_yh = 16 | |
79 | .equ oz_yl = 17 | |
80 | .equ oz_i = 18 | |
81 | .equ oz_r = 19 | |
80e1fa71 | 82 | |
4c92af0d | 83 | z_istat: .byte 1 |
e7a0f403 | 84 | .equ oz_istat = 20 |
4c92af0d L |
85 | |
86 | .equ IM_MASK = 0x03 ;Mask IM 0..2 | |
87 | .equ IM0 = 0 | |
88 | .equ IM1 = 1 | |
89 | .equ IM2 = 2 | |
80e1fa71 | 90 | |
4c92af0d L |
91 | .equ IFF1 = 2 ;IFF1 Flag |
92 | .equ IFF2 = 3 ;IFF2 Flag | |
93 | ||
fa9059af L |
94 | #endif |
95 | ||
96 | .cseg | |
97 | ||
98 | ;Init z80 | |
99 | z80_init: | |
e7a0f403 L |
100 | ldiw z_pc,IPLADDR |
101 | ldiw y,z_regs | |
fa9059af L |
102 | |
103 | cbi flags,trace | |
104 | clr intstat | |
e7a0f403 | 105 | |
fa9059af | 106 | printnewline |
80e1fa71 | 107 | |
e7a0f403 L |
108 | .if INS_DEBUG |
109 | sbr intstat,(1<<i_trace) | |
110 | .endif | |
80e1fa71 L |
111 | |
112 | printstring "Ok, "CPUSTR"-CPU is live!" | |
fa9059af L |
113 | printnewline |
114 | ||
115 | main: | |
fa9059af L |
116 | |
117 | .if PRINT_PC | |
118 | cpi z_pch,DBG_TRACE_BOTTOM | |
119 | brlo noprintpc | |
120 | cpi z_pch,DBG_TRACE_TOP | |
121 | brsh noprintpc | |
122 | ||
123 | printnewline | |
124 | printstring "PC=" | |
125 | movw temp,z_pcl | |
80e1fa71 | 126 | lcall printhexw |
fa9059af L |
127 | printstring " " |
128 | noprintpc: | |
129 | .endif | |
130 | ||
fa9059af L |
131 | ;TODO: hier kommt die Interruptbehandlung rein |
132 | ||
80e1fa71 | 133 | cpse intstat,_0 ;fast path if no trace, int, break, ... |
fa9059af L |
134 | rjmp int_test |
135 | ||
80e1fa71 | 136 | int_instr: |
fa9059af L |
137 | mem_read_ds zl,z_pc ;zl = memReadByte(z_pc) |
138 | adiw z_pcl,1 ;++z_pc | |
139 | ldi zh,high(opcjmp) ; | |
140 | icall | |
141 | rjmp main ; | |
142 | ||
143 | int_test: | |
80e1fa71 L |
144 | sbrs intstat,i_trace |
145 | rjmp int_notrace | |
146 | cpi z_pch,DBG_TRACE_BOTTOM | |
147 | brlo int_notrace | |
148 | cpi z_pch,DBG_TRACE_TOP | |
149 | brsh int_notrace | |
150 | lcall printregs | |
151 | int_notrace: | |
fa9059af | 152 | sbrs intstat,i_break |
80e1fa71 L |
153 | rjmp int_nobreak |
154 | cbr intstat,(1<<i_break)|(1<<i_halt) | |
fa9059af L |
155 | printnewline |
156 | printstring "Break detected! " | |
157 | mov z_pcl,_0 | |
158 | mov z_pch,_0 | |
80e1fa71 L |
159 | int_nobreak: |
160 | ||
161 | rjmp int_instr ;continue with normal instruction interpretation | |
fa9059af | 162 | |
fa9059af L |
163 | |
164 | ;-------------------------------------------------- | |
165 | ; init opcode table | |
166 | ; | |
167 | ; opctable opc_name | |
168 | ; | |
e7a0f403 L |
169 | #if EM_Z80 |
170 | .equ numtabs_ = 5 | |
171 | #else | |
172 | .equ numtabs_ = 1 | |
173 | #endif | |
174 | ||
fa9059af L |
175 | .macro opctable |
176 | ||
177 | .ifndef opc_tabnext_ | |
e7a0f403 L |
178 | .if OPC_TABSTART & 0x00ff |
179 | .error "OPC_TABSTART is not page aligned!" | |
180 | .endif | |
181 | .set opc_tabnext_ = OPC_TABSTART | |
182 | .equ opc_tablow_ = opc_tabnext_ | |
183 | .equ opc_tabend_ = opc_tablow_ + (256 * numtabs_) + 128 | |
184 | .equ sz53p_table_pos = opc_tablow_ + (256 * numtabs_) | |
fa9059af L |
185 | .endif |
186 | ||
187 | .set opcjmp_table_pos_ = opc_tabnext_ | |
188 | .set opc_tabnext_ = opc_tabnext_ + 256 | |
189 | ||
190 | .equ @0 = opcjmp_table_pos_ | |
191 | ||
e7a0f403 L |
192 | .set todo_table_pos_ = 0 |
193 | ||
fa9059af L |
194 | .endm |
195 | ||
fa9059af L |
196 | ;-------------------------------------------------- |
197 | ; Generate a table entry for one instruction | |
198 | ; | |
199 | ; instr fetch, op, store | |
200 | ; | |
201 | .macro instr | |
202 | ||
2217c855 L |
203 | .set fetch_ = (do_@0 != do_fetch_nop) ; must call or jump to fetch action |
204 | .set op_ = (do_@1 != do_op_nop) ; must call or jump to op action | |
205 | .set store_ = (do_@2 != do_store_nop) ; must jump to store action | |
206 | .set cnt_ = fetch_ + op_ + store_ ; number of actions for this instruction | |
207 | ||
208 | .set action_1_ = 0 | |
209 | .set action_2_ = 0 | |
210 | .set action_3_ = 0 | |
211 | ||
212 | .if cnt_ == 1 | |
213 | .if fetch_ | |
214 | .set action_1_ = do_@0 | |
215 | .elif op_ | |
216 | .set action_1_ = do_@1 | |
217 | .else | |
218 | .set action_1_ = do_@2 | |
219 | .endif | |
220 | .elif cnt_ == 2 | |
221 | .if fetch_ | |
222 | .set action_1_ = do_@0 | |
223 | .if op_ | |
224 | .set action_2_ = do_@1 | |
225 | .else | |
226 | .set action_2_ = do_@2 | |
227 | .endif | |
228 | .else | |
229 | .set action_1_ = do_@1 | |
230 | .set action_2_ = do_@2 | |
231 | .endif | |
232 | .elif cnt_ == 3 | |
233 | .set action_1_ = do_@0 | |
234 | .set action_2_ = do_@1 | |
235 | .set action_3_ = do_@2 | |
236 | .endif | |
237 | ||
e7a0f403 L |
238 | .set longdist_ = 0 |
239 | .set pc_save_ = PC | |
fa9059af L |
240 | |
241 | .org opcjmp_table_pos_ | |
242 | .set opcjmp_table_pos_ = opcjmp_table_pos_ + 1 | |
243 | ||
2217c855 | 244 | |
fa9059af L |
245 | .if cnt_ == 0 ; nothing to do (nop) |
246 | ret ; go back to main | |
247 | .elif cnt_ == 1 ; jump direct to action | |
2217c855 L |
248 | .if (PC - action_1_) > 2047 |
249 | .set longdist_ = 1 ; target action out of reach for rel jump | |
250 | .else | |
251 | rjmp action_1_ ; do op and return to main | |
252 | .endif | |
e7a0f403 L |
253 | .endif |
254 | ||
2217c855 | 255 | |
e7a0f403 L |
256 | .set done_ = 0 |
257 | .if (cnt_ > 1) || longdist_ | |
fa9059af | 258 | ; two or tree actions |
2217c855 | 259 | .if defined (l_@0_@1_@2) |
e7a0f403 L |
260 | .if (PC - l_@0_@1_@2) <= 2047 |
261 | rjmp l_@0_@1_@2 ; generate a jump to action table | |
262 | .set done_ = 1 | |
263 | .endif | |
264 | .endif | |
265 | ||
266 | .if !done_ | |
fa9059af | 267 | |
e7a0f403 L |
268 | .if todo_table_pos_ == 0 |
269 | .set todo_table_pos_ = opcjmp_table_pos_ - 2048 | |
270 | .if todo_table_pos_ < pc_save_ | |
271 | .set todo_table_pos_ = pc_save_ | |
fa9059af L |
272 | .endif |
273 | .endif | |
274 | ||
e7a0f403 L |
275 | .if todo_table_pos_ < opc_tablow_ |
276 | .if todo_table_pos_ + 2*cnt_ > opc_tablow_ | |
277 | .set todo_table_pos_ = opc_tabend_ | |
278 | .endif | |
279 | .endif | |
280 | ||
2217c855 | 281 | .if defined (l_@0_@1_@2) |
e7a0f403 L |
282 | rjmp todo_table_pos_ |
283 | .org todo_table_pos_ | |
284 | jmp l_@0_@1_@2 | |
285 | .set todo_table_pos_ = PC | |
286 | .set done_ = 1 | |
287 | .endif | |
288 | .endif | |
fa9059af | 289 | |
e7a0f403 L |
290 | .if !done_ |
291 | ||
292 | .equ l_@0_@1_@2 = todo_table_pos_ ; make a label | |
293 | rjmp l_@0_@1_@2 ; generate a jump to action table | |
294 | ||
295 | .org l_@0_@1_@2 | |
fa9059af L |
296 | |
297 | .if fetch_ ; must fetch | |
e7a0f403 L |
298 | .if op_ || store_ |
299 | .if do_@0 == 0 | |
300 | m_do_@0 | |
301 | .else | |
302 | lcall do_@0 ; fetch and come back here | |
303 | .endif | |
304 | .else | |
305 | .if do_@0 == 0 | |
306 | m_do_@0 | |
307 | ret | |
308 | .else | |
309 | ljmp do_@0 ; do op and return to main | |
310 | .endif | |
fa9059af L |
311 | .endif |
312 | .endif | |
313 | .if op_ ; must exec op | |
314 | .if store_ | |
e7a0f403 L |
315 | .if do_@1 == 0 |
316 | m_do_@1 | |
317 | .else | |
318 | lcall do_@1 ; fetch and come back here | |
319 | .endif | |
fa9059af | 320 | .else |
e7a0f403 L |
321 | .if do_@1 == 0 |
322 | m_do_@1 | |
323 | ret | |
324 | .else | |
325 | ljmp do_@1 ; do op and return to main | |
326 | .endif | |
fa9059af L |
327 | .endif |
328 | .endif | |
e7a0f403 L |
329 | .if store_ ; must store |
330 | .if do_@2 == 0 | |
331 | m_do_@2 | |
332 | ret | |
333 | .else | |
334 | ljmp do_@2 ; store is allways last | |
335 | .endif | |
fa9059af | 336 | .endif |
e7a0f403 | 337 | |
fa9059af L |
338 | .set todo_table_pos_ = PC |
339 | ||
340 | .endif | |
341 | .endif | |
342 | ||
e7a0f403 L |
343 | .if todo_table_pos_ == 0 |
344 | .org pc_save_ | |
345 | .else | |
346 | .org todo_table_pos_ | |
347 | .endif | |
fa9059af L |
348 | |
349 | .endm | |
350 | ||
e7a0f403 L |
351 | |
352 | do_x_nop: | |
353 | ret | |
354 | ||
fa9059af L |
355 | ; ------------ Fetch phase stuff ----------------- |
356 | ||
fa9059af | 357 | fetch_ops: |
e7a0f403 L |
358 | .equ do_fetch_nop = do_x_nop |
359 | ||
fa9059af | 360 | |
e7a0f403 | 361 | .macro m_do_fetch_a |
fa9059af | 362 | mov opl,z_a |
e7a0f403 | 363 | .endm |
fa9059af | 364 | |
e7a0f403 L |
365 | .equ do_fetch_a = 0 |
366 | ; mov opl,z_a | |
367 | ; ret | |
fa9059af | 368 | |
e7a0f403 L |
369 | .macro m_do_fetch_b |
370 | ldd opl,y+oz_b | |
371 | .endm | |
fa9059af | 372 | |
e7a0f403 L |
373 | .equ do_fetch_b = 0 |
374 | ; ldd opl,y+oz_b | |
375 | ; ret | |
fa9059af | 376 | |
e7a0f403 L |
377 | .macro m_do_fetch_c |
378 | ldd opl,y+oz_c | |
379 | .endm | |
fa9059af | 380 | |
e7a0f403 L |
381 | .equ do_fetch_c = 0 |
382 | ; ldd opl,y+oz_c | |
383 | ; ret | |
fa9059af | 384 | |
e7a0f403 L |
385 | .macro m_do_fetch_d |
386 | ldd opl,y+oz_d | |
387 | .endm | |
388 | ||
389 | .equ do_fetch_d = 0 | |
390 | ; ldd opl,y+oz_d | |
391 | ; ret | |
392 | ||
393 | .macro m_do_fetch_e | |
394 | ldd opl,y+oz_e | |
395 | .endm | |
396 | ||
397 | .equ do_fetch_e = 0 | |
398 | ; ldd opl,y+oz_e | |
399 | ; ret | |
400 | ||
401 | .macro m_do_fetch_h | |
402 | ldd opl,y+oz_h | |
403 | .endm | |
404 | ||
405 | .equ do_fetch_h = 0 | |
406 | ; ldd opl,y+oz_h | |
407 | ; ret | |
408 | ||
409 | .macro m_do_fetch_l | |
410 | ldd opl,y+oz_l | |
411 | .endm | |
412 | ||
413 | .equ do_fetch_l = 0 | |
414 | ; ldd opl,y+oz_l | |
415 | ; ret | |
fa9059af L |
416 | |
417 | do_fetch_af: | |
418 | mov opl,z_flags | |
419 | mov oph,z_a | |
420 | ret | |
421 | ||
422 | do_fetch_bc: | |
e7a0f403 L |
423 | ldd opl,y+oz_c |
424 | ldd oph,y+oz_b | |
fa9059af L |
425 | ret |
426 | ||
427 | do_fetch_de: | |
e7a0f403 L |
428 | ldd opl,y+oz_e |
429 | ldd oph,y+oz_d | |
fa9059af L |
430 | ret |
431 | ||
432 | do_fetch_hl: | |
e7a0f403 L |
433 | ldd opl,y+oz_l |
434 | ldd oph,y+oz_h | |
fa9059af L |
435 | ret |
436 | ||
e7a0f403 | 437 | .macro m_do_fetch_sp |
fa9059af | 438 | movw opl,z_spl |
e7a0f403 L |
439 | .endm |
440 | ||
441 | .equ do_fetch_sp = 0 | |
442 | ; movw opl,z_spl | |
443 | ; ret | |
fa9059af L |
444 | |
445 | do_fetch_mbc: | |
e7a0f403 L |
446 | ldd xh,y+oz_b |
447 | ldd xl,y+oz_c | |
fa9059af L |
448 | mem_read_d z_a |
449 | ret | |
450 | ||
451 | do_fetch_mde: | |
e7a0f403 L |
452 | ldd xh,y+oz_d |
453 | ldd xl,y+oz_e | |
fa9059af L |
454 | mem_read_d z_a |
455 | ret | |
456 | ||
457 | do_fetch_mhl: | |
e7a0f403 L |
458 | ldd xh,y+oz_h |
459 | ldd xl,y+oz_l | |
fa9059af L |
460 | mem_read_d opl |
461 | ret | |
462 | ||
463 | do_fetch_msp: | |
464 | movw x,z_spl | |
465 | mem_read_d opl | |
466 | adiw x,1 | |
467 | mem_read_d oph | |
468 | ret | |
469 | ||
470 | do_fetch_dir8: | |
471 | mem_read_ds opl, z_pc | |
472 | adiw z_pcl,1 | |
473 | ret | |
474 | ||
8fec4e62 L |
475 | do_fetch_dir8_2: |
476 | movw xl,z_pcl | |
477 | adiw xl,1 | |
478 | mem_read_d opl | |
479 | ret | |
480 | ||
fa9059af L |
481 | do_fetch_dir16: |
482 | mem_read_ds opl, z_pc | |
483 | adiw z_pcl,1 | |
484 | mem_read_ds oph, z_pc | |
485 | adiw z_pcl,1 | |
486 | ret | |
487 | ||
488 | do_fetch_rst: | |
489 | movw x,z_pcl | |
490 | sbiw x,1 | |
491 | mem_read_d opl | |
492 | andi opl,0x38 | |
493 | ldi oph,0 | |
494 | ret | |
495 | ||
496 | ; ------------ Store phase stuff ----------------- | |
497 | ||
fa9059af | 498 | store_ops: |
e7a0f403 L |
499 | .equ do_store_nop = do_x_nop |
500 | ||
fa9059af L |
501 | |
502 | do_store_a: | |
503 | mov z_a,opl | |
504 | ret | |
505 | ||
e7a0f403 L |
506 | ;.macro m_do_store_b |
507 | ; std y+oz_b,opl | |
508 | ;.endm | |
509 | ;.equ do_store_b = 0 | |
fa9059af | 510 | do_store_b: |
e7a0f403 | 511 | std y+oz_b,opl |
fa9059af L |
512 | ret |
513 | ||
514 | do_store_c: | |
e7a0f403 | 515 | std y+oz_c,opl |
fa9059af L |
516 | ret |
517 | ||
518 | do_store_d: | |
e7a0f403 | 519 | std y+oz_d,opl |
fa9059af L |
520 | ret |
521 | ||
522 | do_store_e: | |
e7a0f403 | 523 | std y+oz_e,opl |
fa9059af L |
524 | ret |
525 | ||
526 | do_store_h: | |
e7a0f403 | 527 | std y+oz_h,opl |
fa9059af L |
528 | ret |
529 | ||
530 | do_store_l: | |
e7a0f403 | 531 | std y+oz_l,opl |
fa9059af L |
532 | ret |
533 | ||
534 | do_store_af: | |
535 | mov z_a,oph | |
536 | mov z_flags,opl | |
537 | ret | |
538 | ||
539 | do_store_bc: | |
e7a0f403 L |
540 | std y+oz_b,oph |
541 | std y+oz_c,opl | |
fa9059af L |
542 | ret |
543 | ||
544 | do_store_de: | |
e7a0f403 L |
545 | std y+oz_d,oph |
546 | std y+oz_e,opl | |
fa9059af L |
547 | ret |
548 | ||
549 | do_store_hl: | |
e7a0f403 L |
550 | std y+oz_h,oph |
551 | std y+oz_l,opl | |
fa9059af L |
552 | ret |
553 | ||
554 | do_store_mbc: | |
e7a0f403 L |
555 | ldd xh,y+oz_b |
556 | ldd xl,y+oz_c | |
fa9059af L |
557 | mem_write_s z_a |
558 | ret | |
559 | ||
560 | do_store_mde: | |
e7a0f403 L |
561 | ldd xh,y+oz_d |
562 | ldd xl,y+oz_e | |
fa9059af L |
563 | mem_write_s z_a |
564 | ret | |
565 | ||
566 | do_store_mhl: | |
e7a0f403 L |
567 | ldd xh,y+oz_h |
568 | ldd xl,y+oz_l | |
fa9059af L |
569 | mem_write_s opl |
570 | ret | |
571 | ||
572 | do_store_msp: | |
573 | movw xl,z_spl | |
574 | mem_write_s opl | |
575 | adiw xl,1 | |
576 | mem_write_s oph | |
577 | ret | |
578 | ||
579 | do_store_sp: | |
580 | movw z_spl,opl | |
581 | ret | |
582 | ||
583 | do_store_pc: | |
584 | movw z_pcl,opl | |
585 | ret | |
586 | ||
80e1fa71 L |
587 | do_store_pcrel: ;add displacement to PC |
588 | clr oph | |
589 | tst opl ;sign extend | |
590 | brpl stpcr1 | |
591 | com oph | |
592 | stpcr1: | |
593 | add z_pcl,opl | |
594 | adc z_pch,oph | |
595 | ret | |
596 | ||
597 | ||
fa9059af L |
598 | do_store_ret: |
599 | movw x,z_spl | |
600 | mem_read_d z_pcl | |
601 | adiw x,1 | |
602 | mem_read_d z_pch | |
603 | adiw x,1 | |
604 | movw z_spl,x | |
605 | ||
606 | .if STACK_DBG | |
607 | printnewline | |
608 | printstring "Stack pop " | |
609 | movw temp,z_pcl | |
610 | rcall printhexw | |
611 | printstring ", SP is now " | |
612 | movw temp,z_spl | |
613 | rcall printhexw | |
614 | printstring ". " | |
615 | .endif | |
616 | ret | |
617 | ||
618 | do_store_call: | |
619 | movw xl,z_spl | |
620 | sbiw x,1 | |
621 | mem_write_s z_pch | |
622 | sbiw x,1 | |
623 | mem_write_s z_pcl | |
624 | movw z_spl,xl | |
625 | ||
626 | .if STACK_DBG | |
627 | printnewline | |
628 | printstring "Stack push " | |
629 | movw temp,z_pcl | |
630 | rcall printhexw | |
631 | printstring ", SP is now " | |
632 | movw temp,z_spl | |
633 | rcall printhexw | |
634 | printstring ". " | |
635 | .endif | |
636 | movw z_pcl,opl | |
637 | ret | |
638 | ||
639 | ||
640 | do_store_am: | |
641 | mem_write_ds op, z_a | |
642 | ret | |
643 | ||
fa9059af L |
644 | ; ------------ Operation phase stuff ----------------- |
645 | ||
646 | ;---------------------------------------------------------------- | |
647 | ;| | | |
648 | ;| Zilog | | |
649 | ;| | | |
650 | ;| ZZZZZZZ 88888 000 | | |
651 | ;| Z 8 8 0 0 | | |
652 | ;| Z 8 8 0 0 0 | | |
653 | ;| Z 88888 0 0 0 | | |
654 | ;| Z 8 8 0 0 0 | | |
655 | ;| Z 8 8 0 0 | | |
656 | ;| ZZZZZZZ 88888 000 | | |
657 | ;| | | |
658 | ;| Z80 MICROPROCESSOR Instruction Set Summary | | |
659 | ;| | | |
660 | ;---------------------------------------------------------------- | |
661 | ;---------------------------------------------------------------- | |
662 | ;|Mnemonic |SZHPNC|Description |Notes | | |
663 | ;|----------+------+---------------------+----------------------| | |
664 | ;|ADC A,s |***V0*|Add with Carry |A=A+s+CY | | |
665 | ;|ADC HL,ss |**?V0*|Add with Carry |HL=HL+ss+CY | | |
666 | ;|ADD A,s |***V0*|Add |A=A+s | | |
80e1fa71 L |
667 | ;|ADD HL,ss |--*-0*|Add |HL=HL+ss | |
668 | ;|ADD IX,pp |--*-0*|Add |IX=IX+pp | | |
669 | ;|ADD IY,rr |--*-0*|Add |IY=IY+rr | | |
fa9059af L |
670 | ;|AND s |**1P00|Logical AND |A=A&s | |
671 | ;|BIT b,m |?*1?0-|Test Bit |m&{2^b} | | |
672 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
673 | ;|CALL nn |------|Unconditional Call |-[SP]=PC,PC=nn | | |
674 | ;|CCF |--?-0*|Complement Carry Flag|CY=~CY | | |
675 | ;|CP s |***V1*|Compare |A-s | | |
676 | ;|CPD |****1-|Compare and Decrement|A-[HL],HL=HL-1,BC=BC-1| | |
677 | ;|CPDR |****1-|Compare, Dec., Repeat|CPD till A=[HL]or BC=0| | |
678 | ;|CPI |****1-|Compare and Increment|A-[HL],HL=HL+1,BC=BC-1| | |
679 | ;|CPIR |****1-|Compare, Inc., Repeat|CPI till A=[HL]or BC=0| | |
680 | ;|CPL |--1-1-|Complement |A=~A | | |
681 | ;|DAA |***P-*|Decimal Adjust Acc. |A=BCD format | | |
682 | ;|DEC s |***V1-|Decrement |s=s-1 | | |
683 | ;|DEC xx |------|Decrement |xx=xx-1 | | |
684 | ;|DEC ss |------|Decrement |ss=ss-1 | | |
4c92af0d | 685 | ;|DI |------|Disable Interrupts |IFF1 = IFF2 = 0 | |
fa9059af | 686 | ;|DJNZ e |------|Dec., Jump Non-Zero |B=B-1 till B=0 | |
4c92af0d | 687 | ;|EI |------|Enable Interrupts |IFF1 = IFF2 = 1 | |
fa9059af L |
688 | ;|EX [SP],HL|------|Exchange |[SP]<->HL | |
689 | ;|EX [SP],xx|------|Exchange |[SP]<->xx | | |
690 | ;|EX AF,AF' |------|Exchange |AF<->AF' | | |
691 | ;|EX DE,HL |------|Exchange |DE<->HL | | |
692 | ;|EXX |------|Exchange |qq<->qq' (except AF)| | |
693 | ;|HALT |------|Halt | | | |
694 | ;|IM n |------|Interrupt Mode | (n=0,1,2)| | |
695 | ;|IN A,[n] |------|Input |A=[n] | | |
696 | ;|IN r,[C] |***P0-|Input |r=[C] | | |
697 | ;|INC r |***V0-|Increment |r=r+1 | | |
698 | ;|INC [HL] |***V0-|Increment |[HL]=[HL]+1 | | |
699 | ;|INC xx |------|Increment |xx=xx+1 | | |
700 | ;|INC [xx+d]|***V0-|Increment |[xx+d]=[xx+d]+1 | | |
701 | ;|INC ss |------|Increment |ss=ss+1 | | |
702 | ;|IND |?*??1-|Input and Decrement |[HL]=[C],HL=HL-1,B=B-1| | |
703 | ;|INDR |?1??1-|Input, Dec., Repeat |IND till B=0 | | |
704 | ;|INI |?*??1-|Input and Increment |[HL]=[C],HL=HL+1,B=B-1| | |
705 | ;|INIR |?1??1-|Input, Inc., Repeat |INI till B=0 | | |
706 | ;|JP [HL] |------|Unconditional Jump |PC=[HL] | | |
707 | ;|JP [xx] |------|Unconditional Jump |PC=[xx] | | |
708 | ;|JP nn |------|Unconditional Jump |PC=nn | | |
709 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
710 | ;|JR e |------|Unconditional Jump |PC=PC+e | | |
711 | ;|JR cc,e |------|Conditional Jump |If cc JR(cc=C,NC,NZ,Z)| | |
712 | ;|LD dst,src|------|Load |dst=src | | |
713 | ;|LD A,i |**0*0-|Load |A=i (i=I,R)| | |
714 | ;|LDD |--0*0-|Load and Decrement |[DE]=[HL],HL=HL-1,# | | |
715 | ;|LDDR |--000-|Load, Dec., Repeat |LDD till BC=0 | | |
716 | ;|LDI |--0*0-|Load and Increment |[DE]=[HL],HL=HL+1,# | | |
717 | ;|LDIR |--000-|Load, Inc., Repeat |LDI till BC=0 | | |
718 | ;|NEG |***V1*|Negate |A=-A | | |
719 | ;|NOP |------|No Operation | | | |
720 | ;|OR s |**0P00|Logical inclusive OR |A=Avs | | |
721 | ;|OTDR |?1??1-|Output, Dec., Repeat |OUTD till B=0 | | |
722 | ;|OTIR |?1??1-|Output, Inc., Repeat |OUTI till B=0 | | |
723 | ;|OUT [C],r |------|Output |[C]=r | | |
724 | ;|OUT [n],A |------|Output |[n]=A | | |
725 | ;|OUTD |?*??1-|Output and Decrement |[C]=[HL],HL=HL-1,B=B-1| | |
726 | ;|OUTI |?*??1-|Output and Increment |[C]=[HL],HL=HL+1,B=B-1| | |
727 | ;|POP xx |------|Pop |xx=[SP]+ | | |
728 | ;|POP qq |------|Pop |qq=[SP]+ | | |
729 | ;|PUSH xx |------|Push |-[SP]=xx | | |
730 | ;|PUSH qq |------|Push |-[SP]=qq | | |
731 | ;|RES b,m |------|Reset bit |m=m&{~2^b} | | |
732 | ;|RET |------|Return |PC=[SP]+ | | |
733 | ;|RET cc |------|Conditional Return |If cc RET | | |
734 | ;|RETI |------|Return from Interrupt|PC=[SP]+ | | |
735 | ;|RETN |------|Return from NMI |PC=[SP]+ | | |
736 | ;|RL m |**0P0*|Rotate Left |m={CY,m}<- | | |
737 | ;|RLA |--0-0*|Rotate Left Acc. |A={CY,A}<- | | |
738 | ;|RLC m |**0P0*|Rotate Left Circular |m=m<- | | |
739 | ;|RLCA |--0-0*|Rotate Left Circular |A=A<- | | |
740 | ;|RLD |**0P0-|Rotate Left 4 bits |{A,[HL]}={A,[HL]}<- ##| | |
741 | ;|RR m |**0P0*|Rotate Right |m=->{CY,m} | | |
742 | ;|RRA |--0-0*|Rotate Right Acc. |A=->{CY,A} | | |
743 | ;|RRC m |**0P0*|Rotate Right Circular|m=->m | | |
744 | ;|RRCA |--0-0*|Rotate Right Circular|A=->A | | |
745 | ;|RRD |**0P0-|Rotate Right 4 bits |{A,[HL]}=->{A,[HL]} ##| | |
746 | ;|RST p |------|Restart | (p=0H,8H,10H,...,38H)| | |
747 | ;|SBC A,s |***V1*|Subtract with Carry |A=A-s-CY | | |
80e1fa71 | 748 | ;|SBC HL,ss |***V1*|Subtract with Carry |HL=HL-ss-CY | |
fa9059af L |
749 | ;|SCF |--0-01|Set Carry Flag |CY=1 | |
750 | ;|SET b,m |------|Set bit |m=mv{2^b} | | |
751 | ;|SLA m |**0P0*|Shift Left Arithmetic|m=m*2 | | |
752 | ;|SRA m |**0P0*|Shift Right Arith. |m=m/2 | | |
753 | ;|SRL m |**0P0*|Shift Right Logical |m=->{0,m,CY} | | |
754 | ;|SUB s |***V1*|Subtract |A=A-s | | |
755 | ;|XOR s |**0P00|Logical Exclusive OR |A=Axs | | |
756 | ;|----------+------+--------------------------------------------| | |
757 | ;| F |-*01? |Flag unaffected/affected/reset/set/unknown | | |
758 | ;| S |S |Sign flag (Bit 7) | | |
759 | ;| Z | Z |Zero flag (Bit 6) | | |
760 | ;| HC | H |Half Carry flag (Bit 4) | | |
761 | ;| P/V | P |Parity/Overflow flag (Bit 2, V=overflow) | | |
762 | ;| N | N |Add/Subtract flag (Bit 1) | | |
763 | ;| CY | C|Carry flag (Bit 0) | | |
764 | ;|-----------------+--------------------------------------------| | |
765 | ;| n |Immediate addressing | | |
766 | ;| nn |Immediate extended addressing | | |
767 | ;| e |Relative addressing (PC=PC+2+offset) | | |
768 | ;| [nn] |Extended addressing | | |
769 | ;| [xx+d] |Indexed addressing | | |
770 | ;| r |Register addressing | | |
771 | ;| [rr] |Register indirect addressing | | |
772 | ;| |Implied addressing | | |
773 | ;| b |Bit addressing | | |
774 | ;| p |Modified page zero addressing (see RST) | | |
775 | ;|-----------------+--------------------------------------------| | |
776 | ;|DEFB n(,...) |Define Byte(s) | | |
777 | ;|DEFB 'str'(,...) |Define Byte ASCII string(s) | | |
778 | ;|DEFS nn |Define Storage Block | | |
779 | ;|DEFW nn(,...) |Define Word(s) | | |
780 | ;|-----------------+--------------------------------------------| | |
781 | ;| A B C D E |Registers (8-bit) | | |
782 | ;| AF BC DE HL |Register pairs (16-bit) | | |
783 | ;| F |Flag register (8-bit) | | |
784 | ;| I |Interrupt page address register (8-bit) | | |
785 | ;| IX IY |Index registers (16-bit) | | |
786 | ;| PC |Program Counter register (16-bit) | | |
787 | ;| R |Memory Refresh register | | |
788 | ;| SP |Stack Pointer register (16-bit) | | |
789 | ;|-----------------+--------------------------------------------| | |
790 | ;| b |One bit (0 to 7) | | |
791 | ;| cc |Condition (C,M,NC,NZ,P,PE,PO,Z) | | |
792 | ;| d |One-byte expression (-128 to +127) | | |
793 | ;| dst |Destination s, ss, [BC], [DE], [HL], [nn] | | |
794 | ;| e |One-byte expression (-126 to +129) | | |
795 | ;| m |Any register r, [HL] or [xx+d] | | |
796 | ;| n |One-byte expression (0 to 255) | | |
797 | ;| nn |Two-byte expression (0 to 65535) | | |
798 | ;| pp |Register pair BC, DE, IX or SP | | |
799 | ;| qq |Register pair AF, BC, DE or HL | | |
800 | ;| qq' |Alternative register pair AF, BC, DE or HL | | |
801 | ;| r |Register A, B, C, D, E, H or L | | |
802 | ;| rr |Register pair BC, DE, IY or SP | | |
803 | ;| s |Any register r, value n, [HL] or [xx+d] | | |
804 | ;| src |Source s, ss, [BC], [DE], [HL], nn, [nn] | | |
805 | ;| ss |Register pair BC, DE, HL or SP | | |
806 | ;| xx |Index register IX or IY | | |
807 | ;|-----------------+--------------------------------------------| | |
808 | ;| + - * / ^ |Add/subtract/multiply/divide/exponent | | |
809 | ;| & ~ v x |Logical AND/NOT/inclusive OR/exclusive OR | | |
810 | ;| <- -> |Rotate left/right | | |
811 | ;| [ ] |Indirect addressing | | |
812 | ;| [ ]+ -[ ] |Indirect addressing auto-increment/decrement| | |
813 | ;| { } |Combination of operands | | |
814 | ;| # |Also BC=BC-1,DE=DE-1 | | |
815 | ;| ## |Only lower 4 bits of accumulator A used | | |
816 | ;---------------------------------------------------------------- | |
817 | ||
818 | ;How the flags are supposed to work: | |
819 | ;7 ZFL_S - Sign flag (=MSBit of result) | |
820 | ;6 ZFL_Z - Zero flag. Is 1 when the result is 0 | |
821 | ;4 ZFL_H - Half-carry (carry from bit 3 to 4) | |
822 | ;2 ZFL_P - Parity/2-complement Overflow | |
823 | ;1 ZFL_N - Subtract - set if last op was a subtract | |
824 | ;0 ZFL_C - Carry | |
825 | ; | |
826 | ;I sure hope I got the mapping between flags and instructions correct... | |
827 | ||
828 | .equ ZFL_S = 7 | |
829 | .equ ZFL_Z = 6 | |
830 | .equ ZFL_H = 4 | |
831 | .equ ZFL_P = 2 | |
832 | .equ ZFL_N = 1 | |
833 | .equ ZFL_C = 0 | |
834 | ||
835 | .equ AVR_T = SREG_T | |
836 | .equ AVR_H = SREG_H | |
837 | .equ AVR_S = SREG_S | |
838 | .equ AVR_V = SREG_V | |
839 | .equ AVR_N = SREG_N | |
840 | .equ AVR_Z = SREG_Z | |
841 | .equ AVR_C = SREG_C | |
842 | ||
843 | ; TODO: check Z80 flag settings | |
844 | ||
845 | ;------------------------------------------------; | |
846 | ; Load table value from flash indexed by source reg. | |
847 | ; | |
848 | ; ldpmx dstreg,tablebase,indexreg | |
849 | ; | |
850 | ; (6 words, 8 cycles) | |
851 | ||
852 | .macro ldpmx | |
853 | ldi zh,high(@1*2) ; table must be page aligned | |
854 | mov zl,@2 | |
855 | lpm @0,z | |
856 | .endm | |
857 | ||
858 | .macro do_z80_flags_V | |
859 | #if EM_Z80 | |
860 | bmov z_flags, ZFL_P, temp, AVR_V | |
861 | #endif | |
862 | .endm | |
863 | ||
80e1fa71 L |
864 | .macro do_z80_flags_H |
865 | #if EM_Z80 | |
866 | bmov z_flags, ZFL_H, temp, AVR_H | |
867 | #endif | |
868 | .endm | |
869 | ||
fa9059af L |
870 | .macro do_z80_flags_set_N |
871 | #if EM_Z80 | |
872 | ori z_flags, (1<<ZFL_N) ; Negation auf 1 | |
873 | #endif | |
874 | .endm | |
875 | ||
876 | .macro do_z80_flags_set_HN | |
877 | #if EM_Z80 | |
878 | ori z_flags,(1<<ZFL_N)|(1<<ZFL_H) | |
879 | #endif | |
880 | .endm | |
881 | ||
882 | .macro do_z80_flags_clear_N | |
883 | #if EM_Z80 | |
884 | andi z_flags,~(1<<ZFL_N) | |
885 | #endif | |
886 | .endm | |
887 | ||
888 | .macro do_z80_flags_clear_HN | |
889 | #if EM_Z80 | |
890 | andi z_flags,~((1<<ZFL_H)|(1<<ZFL_N)) | |
891 | #endif | |
892 | .endm | |
893 | ||
894 | ||
895 | .macro do_z80_flags_copy_HC | |
896 | #if EM_Z80 | |
897 | bmov z_flags, ZFL_H, z_flags, ZFL_H | |
898 | #endif | |
899 | .endm | |
900 | ||
901 | .macro do_z80_flags_op_rotate | |
902 | ; must not change avr carry flag! | |
903 | #if EM_Z80 | |
904 | andi z_flags, ~( (1<<ZFL_H) | (1<<ZFL_N) | (1<<ZFL_C) ) | |
905 | #else | |
906 | andi z_flags, ~( (1<<ZFL_C) ) | |
907 | #endif | |
908 | .endm | |
909 | ||
910 | .macro do_z80_flags_op_and | |
911 | #if EM_Z80 | |
912 | ori z_flags,(1<<ZFL_H) | |
913 | #endif | |
914 | .endm | |
915 | ||
916 | .macro do_z80_flags_op_or | |
917 | #if EM_Z80 | |
918 | ;nothing to do | |
919 | #endif | |
920 | .endm | |
921 | ||
922 | ||
923 | ;---------------------------------------------------------------- | |
924 | ||
e7a0f403 L |
925 | .equ do_op_nop = do_x_nop |
926 | ||
fa9059af L |
927 | do_op_inv: |
928 | sbiw z_pcl,1 | |
929 | lcall printregs | |
930 | printstring "Invalid opcode! " | |
931 | ||
932 | haltinv: | |
933 | rjmp haltinv | |
934 | ||
80e1fa71 L |
935 | |
936 | ;---------------------------------------------------------------- | |
937 | ;|Mnemonic |SZHPNC|Description |Notes | | |
938 | ;---------------------------------------------------------------- | |
939 | ;|HALT |------|Halt | | | |
940 | ||
941 | ||
942 | do_op_HALT: | |
943 | sbiw z_pcl,1 | |
944 | sbrc intstat,i_halt | |
945 | ret | |
946 | sbr intstat,(1<<i_halt) | |
947 | lcall printregs | |
948 | printstring "CPU halted! " | |
949 | ret | |
950 | ||
fa9059af L |
951 | ;---------------------------------------------------------------- |
952 | ;|Mnemonic |SZHPNC|Description |Notes | | |
953 | ;---------------------------------------------------------------- | |
954 | ;|OUT [n],A |------|Output |[n]=A | | |
955 | ; | |
956 | ; | |
957 | ;Interface with peripherials goes here :) | |
958 | do_op_outa: ; out (opl),a | |
959 | .if PORT_DEBUG | |
960 | printnewline | |
961 | printstring "Port write: " | |
962 | mov temp,z_a | |
80e1fa71 | 963 | lcall printhex |
fa9059af L |
964 | printstring " -> (" |
965 | mov temp,opl | |
80e1fa71 | 966 | lcall printhex |
fa9059af L |
967 | printstring ") " |
968 | .endif | |
969 | mov temp,z_a | |
970 | mov temp2,opl | |
e7a0f403 | 971 | lcall portWrite |
fa9059af L |
972 | ret |
973 | ||
fa9059af L |
974 | ;---------------------------------------------------------------- |
975 | ;|Mnemonic |SZHPNC|Description |Notes | | |
976 | ;---------------------------------------------------------------- | |
977 | ;|IN A,[n] |------|Input |A=[n] | | |
978 | ; | |
979 | ; | |
80e1fa71 | 980 | do_op_ina: ; in a,(opl) |
fa9059af L |
981 | .if PORT_DEBUG |
982 | printnewline | |
983 | printstring "Port read: (" | |
984 | mov temp,opl | |
80e1fa71 | 985 | lcall printhex |
fa9059af L |
986 | printstring ") -> " |
987 | .endif | |
988 | ||
989 | mov temp2,opl | |
990 | lcall portRead | |
80e1fa71 | 991 | mov z_a,temp |
fa9059af L |
992 | |
993 | .if PORT_DEBUG | |
80e1fa71 | 994 | lcall printhex |
fa9059af L |
995 | printstring " " |
996 | .endif | |
997 | ret | |
998 | ||
999 | ;---------------------------------------------------------------- | |
1000 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1001 | ;---------------------------------------------------------------- | |
1002 | ;|INC r |***V0-|Increment |r=r+1 | | |
1003 | ;|INC [HL] |***V0-|Increment |[HL]=[HL]+1 | | |
1004 | ;|INC [xx+d]|***V0-|Increment |[xx+d]=[xx+d]+1 | | |
1005 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1006 | ;|INC r |**-P0-|Increment |r=r+1 | | |
1007 | ;|INC [HL] |**-P0-|Increment |[HL]=[HL]+1 | | |
1008 | ; | |
2217c855 | 1009 | |
fa9059af | 1010 | do_op_inc: |
2217c855 | 1011 | andi z_flags,(1<<ZFL_C) ; preserve C-flag |
fa9059af L |
1012 | ldi temp,1 |
1013 | add opl,temp | |
2217c855 L |
1014 | #if EM_Z80 |
1015 | brpl PC+2 | |
1016 | sbr z_flags,(1<<ZFL_S) | |
1017 | brne PC+2 | |
1018 | sbr z_flags,(1<<ZFL_Z) | |
1019 | brhc PC+2 | |
1020 | sbr z_flags,(1<<ZFL_H) | |
1021 | brvc PC+2 | |
1022 | sbr z_flags,(1<<ZFL_P) | |
1023 | #else /* 8080 */ | |
1024 | ldpmx temp,sz53p_tab,opl ;S,Z,P flag | |
1025 | or z_flags,temp | |
1026 | #endif | |
fa9059af L |
1027 | ret |
1028 | ||
1029 | do_op_inca: | |
2217c855 | 1030 | andi z_flags,(1<<ZFL_C) ; preserve C-flag |
fa9059af L |
1031 | ldi temp,1 |
1032 | add z_a,temp | |
2217c855 L |
1033 | #if EM_Z80 |
1034 | brpl PC+2 | |
1035 | sbr z_flags,(1<<ZFL_S) | |
1036 | brne PC+2 | |
1037 | sbr z_flags,(1<<ZFL_Z) | |
1038 | brhc PC+2 | |
1039 | sbr z_flags,(1<<ZFL_H) | |
1040 | brvc PC+2 | |
1041 | sbr z_flags,(1<<ZFL_P) | |
1042 | #else /* 8080 */ | |
1043 | ldpmx temp,sz53p_tab,opl ;S,Z,P flag | |
1044 | or z_flags,temp | |
1045 | #endif | |
fa9059af L |
1046 | ret |
1047 | ||
1048 | ;---------------------------------------------------------------- | |
1049 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1050 | ;---------------------------------------------------------------- | |
1051 | ;|DEC r |***V1-|Decrement |s=s-1 | | |
2217c855 L |
1052 | ;|DEC [HL] |***V0-|Increment |[HL]=[HL]-1 | |
1053 | ;|DEC [xx+d]|***V0-|Increment |[xx+d]=[xx+d]-1 | | |
fa9059af | 1054 | ;|----------|SZHP C|---------- 8080 ----------------------------| |
2217c855 L |
1055 | ;|DEC r |**-P -|Increment |r=r-1 | |
1056 | ;|DEC [HL] |**-P -|Increment |[HL]=[HL]-1 | | |
fa9059af | 1057 | ; |
2217c855 | 1058 | |
fa9059af | 1059 | do_op_dec: |
fa9059af | 1060 | andi z_flags,(1<<ZFL_C) ; preserve C-flag |
2217c855 L |
1061 | subi opl,1 |
1062 | #if EM_Z80 | |
1063 | brpl PC+2 | |
1064 | sbr z_flags,(1<<ZFL_S) | |
1065 | brne PC+2 | |
1066 | sbr z_flags,(1<<ZFL_Z) | |
1067 | brhc PC+2 | |
1068 | sbr z_flags,(1<<ZFL_H) | |
1069 | brvc PC+2 | |
1070 | sbr z_flags,(1<<ZFL_P) | |
1071 | ori z_flags,(1<<ZFL_N) ; Set N-flag | |
1072 | #else /* 8080 */ | |
1073 | ldpmx temp,sz53p_tab,opl ; S,Z,P flag | |
1074 | or z_flags,temp | |
1075 | #endif | |
fa9059af L |
1076 | ret |
1077 | ||
2217c855 | 1078 | |
fa9059af | 1079 | do_op_deca: |
fa9059af | 1080 | andi z_flags,(1<<ZFL_C) ; preserve C-flag |
2217c855 L |
1081 | ldi temp,1 |
1082 | #if EM_Z80 | |
1083 | sub z_a,temp | |
1084 | brpl PC+2 | |
1085 | sbr z_flags,(1<<ZFL_S) | |
1086 | brne PC+2 | |
1087 | sbr z_flags,(1<<ZFL_Z) | |
1088 | brhc PC+2 | |
1089 | sbr z_flags,(1<<ZFL_H) | |
1090 | brvc PC+2 | |
1091 | sbr z_flags,(1<<ZFL_P) | |
1092 | ori z_flags,(1<<ZFL_N) ; Set N-flag | |
1093 | #else /* 8080 */ | |
1094 | ldpmx temp,sz53p_tab,opl ; S,Z,P flag | |
1095 | or z_flags,temp | |
1096 | #endif | |
fa9059af L |
1097 | ret |
1098 | ||
2217c855 | 1099 | |
fa9059af L |
1100 | ;---------------------------------------------------------------- |
1101 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1102 | ;---------------------------------------------------------------- | |
1103 | ;|INC xx |------|Increment |xx=xx+1 | | |
1104 | ;|INC ss |------|Increment |ss=ss+1 | | |
1105 | ; | |
1106 | ; | |
1107 | do_op_inc16: | |
1108 | subi opl,low(-1) | |
1109 | sbci oph,high(-1) | |
1110 | ret | |
1111 | ||
1112 | ;---------------------------------------------------------------- | |
1113 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1114 | ;---------------------------------------------------------------- | |
1115 | ;|DEC xx |------|Decrement |xx=xx-1 | | |
1116 | ;|DEC ss |------|Decrement |ss=ss-1 | | |
1117 | ; | |
1118 | ; | |
1119 | do_op_dec16: | |
1120 | subi opl, 1 | |
1121 | sbci oph, 0 | |
1122 | ret | |
1123 | ||
1124 | ;---------------------------------------------------------------- | |
1125 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1126 | ;---------------------------------------------------------------- | |
1127 | ;|RLCA |--0-0*|Rotate Left Circular |A=A<- | | |
1128 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1129 | ;|RLCA |---- *|Rotate Left Circular |A=A<- | | |
1130 | ; | |
1131 | ; | |
1132 | do_op_rlca: | |
1133 | ;Rotate Left Cyclical. All bits move 1 to the | |
1134 | ;left, the msb becomes c and lsb. | |
1135 | do_z80_flags_op_rotate | |
1136 | lsl z_a | |
1137 | brcc do_op_rlc_noc | |
1138 | ldi temp,1 | |
1139 | or z_a,temp | |
1140 | ori z_flags, (1<<ZFL_C) | |
1141 | do_op_rlc_noc: | |
1142 | ret | |
1143 | ||
1144 | ;---------------------------------------------------------------- | |
1145 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1146 | ;---------------------------------------------------------------- | |
1147 | ;|RRCA |--0-0*|Rotate Right Circular|A=->A | | |
1148 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1149 | ;|RRCA |---- *|Rotate Right Circular|A=->A | | |
1150 | ; | |
1151 | ; | |
1152 | do_op_rrca: | |
1153 | ;Rotate Right Cyclical. All bits move 1 to the | |
1154 | ;right, the lsb becomes c and msb. | |
1155 | do_z80_flags_op_rotate | |
1156 | lsr z_a | |
1157 | brcc do_op_rrc_noc | |
1158 | ldi temp,0x80 | |
1159 | or z_a,temp | |
1160 | ori z_flags, (1<<ZFL_C) | |
1161 | do_op_rrc_noc: | |
1162 | ret | |
1163 | ||
1164 | ;---------------------------------------------------------------- | |
1165 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1166 | ;---------------------------------------------------------------- | |
1167 | ;|RRA |--0-0*|Rotate Right Acc. |A=->{CY,A} | | |
1168 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1169 | ;|RRA |---- *|Rotate Right Acc. |A=->{CY,A} | | |
1170 | ; | |
1171 | ; | |
1172 | do_op_rra: | |
1173 | ;Rotate Right. All bits move 1 to the right, the lsb | |
1174 | ;becomes c, c becomes msb. | |
1175 | clc ; get z80 carry to avr carry | |
1176 | sbrc z_flags,ZFL_C | |
1177 | sec | |
1178 | do_z80_flags_op_rotate ; (clear ZFL_C, doesn't change AVR_C) | |
1179 | bmov z_flags,ZFL_C, z_a,0 ; Bit 0 --> CY | |
1180 | ror z_a | |
1181 | ret | |
1182 | ||
1183 | ;---------------------------------------------------------------- | |
1184 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1185 | ;---------------------------------------------------------------- | |
1186 | ;|RLA |--0-0*|Rotate Left Acc. |A={CY,A}<- | | |
1187 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1188 | ;|RLA |---- *|Rotate Left Acc. |A={CY,A}<- | | |
1189 | ; | |
1190 | ; | |
1191 | do_op_rla: | |
1192 | ;Rotate Left. All bits move 1 to the left, the msb | |
1193 | ;becomes c, c becomes lsb. | |
1194 | clc | |
1195 | sbrc z_flags,ZFL_C | |
1196 | sec | |
1197 | do_z80_flags_op_rotate ; (clear ZFL_C, doesn't change AVR_C) | |
1198 | bmov z_flags,ZFL_C, z_a,7 ; Bit 7 --> CY | |
1199 | rol z_a | |
1200 | ret | |
1201 | ||
1202 | ;---------------------------------------------------------------- | |
1203 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1204 | ;---------------------------------------------------------------- | |
1205 | ;|ADD A,s |***V0*|Add |A=A+s | | |
1206 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1207 | ;|ADD A,s |***P *|Add |A=A+s | | |
1208 | ; | |
1209 | ; | |
1210 | do_op_adda: | |
1211 | add z_a,opl | |
1212 | in temp,sreg | |
1213 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,P flag | |
1214 | bmov z_flags,ZFL_C, temp,AVR_C | |
1215 | bmov z_flags,ZFL_H, temp,AVR_H | |
1216 | do_z80_flags_V | |
1217 | ret | |
1218 | ||
1219 | ;---------------------------------------------------------------- | |
1220 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1221 | ;---------------------------------------------------------------- | |
1222 | ;|ADC A,s |***V0*|Add with Carry |A=A+s+CY | | |
1223 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1224 | ;|ADC A,s |***P *|Add with Carry |A=A+s+CY | | |
1225 | ; | |
1226 | ; | |
1227 | do_op_adca: | |
1228 | clc | |
1229 | sbrc z_flags,ZFL_C | |
1230 | sec | |
1231 | adc z_a,opl | |
1232 | in temp,sreg | |
1233 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,P | |
1234 | bmov z_flags,ZFL_C, temp,AVR_C | |
1235 | bmov z_flags,ZFL_H, temp,AVR_H | |
1236 | do_z80_flags_V | |
1237 | ret | |
1238 | ||
1239 | ;---------------------------------------------------------------- | |
1240 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1241 | ;---------------------------------------------------------------- | |
1242 | ;|SUB s |***V1*|Subtract |A=A-s | | |
1243 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1244 | ;|SUB s |***P *|Subtract |A=A-s | | |
1245 | ||
1246 | ; | |
1247 | do_op_subfa: | |
1248 | sub z_a,opl | |
1249 | in temp,sreg | |
1250 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,P | |
1251 | bmov z_flags,ZFL_C, temp,AVR_C | |
1252 | bmov z_flags,ZFL_H, temp,AVR_H | |
1253 | do_z80_flags_V | |
1254 | do_z80_flags_set_N | |
1255 | ret | |
1256 | ||
1257 | ;---------------------------------------------------------------- | |
1258 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1259 | ;---------------------------------------------------------------- | |
1260 | ;|CP s |***V1*|Compare |A-s | | |
1261 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1262 | ;|CP s |***P *|Compare |A-s | | |
1263 | ||
1264 | ; | |
1265 | do_op_cpfa: | |
1266 | mov temp2,z_a | |
1267 | sub temp2,opl | |
1268 | in temp,sreg | |
1269 | ldpmx z_flags,sz53p_tab,temp2 ;S,Z,P | |
1270 | bmov z_flags,ZFL_C, temp,AVR_C | |
1271 | bmov z_flags,ZFL_H, temp,AVR_H | |
1272 | do_z80_flags_V | |
1273 | do_z80_flags_set_N | |
1274 | ret | |
1275 | ||
1276 | ;---------------------------------------------------------------- | |
1277 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1278 | ;---------------------------------------------------------------- | |
1279 | ;|SBC A,s |***V1*|Subtract with Carry |A=A-s-CY | | |
1280 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1281 | ;|SBC A,s |***P *|Subtract with Carry |A=A-s-CY | | |
1282 | ; | |
1283 | ; | |
1284 | do_op_sbcfa: | |
1285 | clc | |
1286 | sbrc z_flags,ZFL_C | |
1287 | sec | |
1288 | sbc z_a,opl | |
1289 | in temp,sreg | |
1290 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,P | |
1291 | bmov z_flags,ZFL_C, temp,AVR_C | |
1292 | bmov z_flags,ZFL_H, temp,AVR_H | |
1293 | do_z80_flags_V | |
1294 | do_z80_flags_set_N | |
1295 | ret | |
1296 | ||
1297 | ;---------------------------------------------------------------- | |
1298 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1299 | ;---------------------------------------------------------------- | |
1300 | ;|AND s |**1P00|Logical AND |A=A&s | | |
1301 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1302 | ;|AND s |**-P 0|Logical AND |A=A&s | | |
1303 | ; | |
1304 | ; | |
1305 | do_op_anda: | |
1306 | and z_a,opl ; | |
1307 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,P,N,C | |
1308 | do_z80_flags_op_and | |
1309 | ret | |
1310 | ||
1311 | ||
1312 | ;---------------------------------------------------------------- | |
1313 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1314 | ;---------------------------------------------------------------- | |
1315 | ;|OR s |**0P00|Logical inclusive OR |A=Avs | | |
1316 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1317 | ;|OR s |**-P00|Logical inclusive OR |A=Avs | | |
1318 | ; | |
1319 | ; | |
1320 | do_op_ora: | |
1321 | or z_a,opl | |
1322 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,H,P,N,C | |
1323 | do_z80_flags_op_or | |
1324 | ret | |
1325 | ||
1326 | ;---------------------------------------------------------------- | |
1327 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1328 | ;---------------------------------------------------------------- | |
1329 | ;|XOR s |**0P00|Logical Exclusive OR |A=Axs | | |
1330 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1331 | ;|XOR s |**-P 0|Logical Exclusive OR |A=Axs | | |
1332 | ; | |
1333 | ; | |
1334 | do_op_xora: | |
e7a0f403 | 1335 | eor z_a,opl |
fa9059af L |
1336 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,H,P,N,C |
1337 | do_z80_flags_op_or | |
1338 | ret | |
1339 | ||
1340 | ;---------------------------------------------------------------- | |
1341 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1342 | ;---------------------------------------------------------------- | |
80e1fa71 | 1343 | ;|ADD HL,ss |--*-0*|Add |HL=HL+ss | |
fa9059af L |
1344 | ;|----------|SZHP C|---------- 8080 ----------------------------| |
1345 | ;|ADD HL,ss |---- *|Add |HL=HL+ss | | |
1346 | ; | |
1347 | ; | |
1348 | do_op_addhl: | |
e7a0f403 L |
1349 | ldd temp,y+oz_l |
1350 | ldd temp2,y+oz_h | |
1351 | add opl,temp | |
1352 | adc oph,temp2 | |
1353 | std y+oz_l,opl | |
1354 | std y+oz_h,oph | |
1355 | in temp,sreg | |
fa9059af | 1356 | bmov z_flags,ZFL_C, temp,AVR_C |
80e1fa71 | 1357 | do_z80_flags_H |
fa9059af L |
1358 | do_z80_flags_clear_N |
1359 | ret | |
1360 | ||
1361 | ;---------------------------------------------------------------- | |
1362 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1363 | ;---------------------------------------------------------------- | |
1364 | ;|LD dst,src|------|Load |dst=src | | |
1365 | ; | |
1366 | ; | |
1367 | do_op_sthl: ;store hl to mem loc in opl:h | |
e7a0f403 L |
1368 | movw xl,opl |
1369 | ldd temp,y+oz_l | |
fa9059af | 1370 | mem_write |
e7a0f403 L |
1371 | adiw xl,1 |
1372 | ldd temp,y+oz_h | |
fa9059af L |
1373 | mem_write |
1374 | ret | |
1375 | ||
1376 | ;---------------------------------------------------------------- | |
1377 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1378 | ;---------------------------------------------------------------- | |
1379 | ;|LD dst,src|------|Load |dst=src | | |
1380 | ; | |
1381 | ; | |
1382 | do_op_rmem16: | |
1383 | movw xl,opl | |
1384 | mem_read_d opl | |
1385 | adiw x,1 | |
1386 | mem_read_d oph | |
1387 | ret | |
1388 | ||
1389 | ;---------------------------------------------------------------- | |
1390 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1391 | ;---------------------------------------------------------------- | |
1392 | ;|LD dst,src|------|Load |dst=src | | |
1393 | ; | |
1394 | ; | |
1395 | do_op_rmem8: | |
1396 | mem_read_ds opl, op | |
1397 | ret | |
1398 | ||
1399 | ;---------------------------------------------------------------- | |
1400 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1401 | ;---------------------------------------------------------------- | |
1402 | ;|DAA |***P-*|Decimal Adjust Acc. | | | |
1403 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1404 | ; | |
1405 | ; Not yet checked | |
1406 | ||
1407 | ; Description (http://www.z80.info/z80syntx.htm#DAA): | |
1408 | ; This instruction conditionally adjusts the accumulator for BCD addition | |
1409 | ; and subtraction operations. For addition (ADD, ADC, INC) or subtraction | |
1410 | ; (SUB, SBC, DEC, NEC), the following table indicates the operation performed: | |
1411 | ; | |
1412 | ; ------------------------------------------------------------------- | |
1413 | ; | |C Flag |HEX value in|H Flag |HEX val in | Number |C flag | | |
1414 | ; | Oper |Before |upper digit |Before |lower digit| added |After | | |
1415 | ; | |DAA |(bit 7-4) |DAA |(bit 3-0) | to A |DAA | | |
1416 | ; |-------+-------+------------+-------+-----------+--------+-------| | |
1417 | ; | | 0 | 0-9 | 0 | 0-9 | 00 | 0 | | |
1418 | ; | ADD | 0 | 0-8 | 0 | A-F | 06 | 0 | | |
1419 | ; | | 0 | 0-9 | 1 | 0-3 | 06 | 0 | | |
1420 | ; | ADC | 0 | A-F | 0 | 0-9 | 60 | 1 | | |
1421 | ; | | 0 | 9-F | 0 | A-F | 66 | 1 | | |
1422 | ; | INC | 0 | A-F | 1 | 0-3 | 66 | 1 | | |
1423 | ; | | 1 | 0-2 | 0 | 0-9 | 60 | 1 | | |
1424 | ; | | 1 | 0-2 | 0 | A-F | 66 | 1 | | |
1425 | ; | | 1 | 0-3 | 1 | 0-3 | 66 | 1 | | |
1426 | ; |-------+-------+------------+-------+-----------+--------+-------| | |
1427 | ; | SUB | 0 | 0-9 | 0 | 0-9 | 00 | 0 | | |
1428 | ; | SBC | 0 | 0-8 | 1 | 6-F | FA | 0 | | |
1429 | ; | DEC | 1 | 7-F | 0 | 0-9 | A0 | 1 | | |
1430 | ; | NEG | 1 | 6-F | 1 | 6-F | 9A | 1 | | |
1431 | ; ------------------------------------------------------------------- | |
1432 | ; | |
1433 | ; The H flag is affected as follows: | |
1434 | ; | |
1435 | ; --------------------- | |
1436 | ; | N | H | low |H' | | |
1437 | ; | | |nibble | | | |
1438 | ; |---+---+-------+---| | |
1439 | ; | 0 | * | 0-9 | 0 | | |
1440 | ; | 0 | * | a-f | 1 | | |
1441 | ; | 1 | 0 | * | 0 | | |
1442 | ; | 1 | 1 | 6-f | 0 | | |
1443 | ; | 1 | 1 | 0-5 | 1 | | |
1444 | ; --------------------- | |
1445 | ; | |
1446 | ; Ohter flags: | |
1447 | ; N: Unaffected. | |
1448 | ; P/V: Set if Acc. is even parity after operation, reset otherwise. | |
1449 | ; Z: Set if Acc. is Zero after operation, reset otherwise. | |
1450 | ; S: Set if most significant bit of Acc. is 1 after operation, reset otherwise. | |
1451 | ||
1452 | #if 1 | |
1453 | ||
1454 | do_op_da: | |
1455 | ||
1456 | #if EM_Z80 | |
1457 | sbrc z_flags,ZFL_N ;if add-op | |
1458 | rjmp op_da_sub ;then | |
1459 | #endif | |
1460 | ||
1461 | op_da_add: | |
1462 | ldi temp2,0 ; new C and H flag | |
1463 | sbrc z_flags,ZFL_H ; | | |
1464 | rjmp op_da_a01 ; if (H flag ... | |
1465 | mov temp,opl ; | | |
1466 | andi temp,0x0f ; | | |
1467 | cpi temp,0x0a ; or (lower nibble >= 0x0A)) | |
1468 | brlo op_da_a10 ; | | |
1469 | op_da_a01: ; then | |
1470 | ldi oph,0x06 ; add 6 to lower nibble | |
1471 | add opl,oph ; | |
1472 | brhc op_da_02 ; if | |
1473 | ori temp2,(1<<ZFL_H) ; set new H flag | |
1474 | op_da_02: ; | |
1475 | brcc op_da_a10 ; if | |
1476 | ori temp2,(1<<ZFL_C) ; set new H flag | |
1477 | op_da_a10: ; endif | |
1478 | sbrc z_flags,ZFL_C ; | | |
1479 | rjmp op_da_a12 ; if (C flag ... | |
1480 | cpi opl,0xA0 ; |... or upper nibble >= 0xA0) | |
1481 | brlo op_da_a13 ; | |
1482 | op_da_a12: ; | |
1483 | ldi oph,0x60 ; add 6 to lower nibble | |
1484 | add opl,oph ; | |
1485 | ori temp2,(1<<ZFL_C) ; set new C flag | |
1486 | op_da_a13: ; | |
1487 | ldpmx z_flags, sz53p_tab, opl ; get S,Z,P flag | |
1488 | or z_flags,temp2 ; merge new C and H flag | |
1489 | ret | |
1490 | ||
1491 | #if EM_Z80 | |
1492 | ||
1493 | op_da_sub: ;else (sub-op) | |
1494 | rcall do_op_inv ; TODO: ! Z80 DAA whith N flag set. | |
1495 | ret ;endif | |
1496 | #endif | |
1497 | ||
1498 | #else | |
1499 | ||
1500 | do_op_da: | |
1501 | ldi temp2,0 ;new C and H flag | |
1502 | ldi oph,0 ;oph: what to add | |
1503 | ||
1504 | sbrc z_flags,ZFL_N ;if add-op | |
1505 | rjmp op_da_sub ;then | |
1506 | op_da_add: | |
1507 | mov temp,opl ; | | |
1508 | andi temp,0x0f ; | | |
1509 | cpi temp,0x0a ; if (lower nibble >= 0x0A) | |
1510 | brlo op_da_a10 ; | | |
1511 | ori oph,0x06 ; add 6 | |
1512 | ori temp2,(1<<ZFL_H) ; set new H flag | |
1513 | ||
1514 | sbrc z_flags,ZFL_C ; | | |
1515 | rjmp op_da_a02 ; if (C flag ... | |
1516 | cpi opl,0x90 ; |... or upper nibble >= 0x90) | |
1517 | brlo op_da_a03 ; | | |
1518 | op_da_a02: | |
1519 | ori oph,0x60 ; add 0x60 | |
1520 | ori temp2,(1<<ZFL_C) ; set new C flag | |
1521 | op_da_a03: ; endif | |
1522 | rjmp op_da_ae | |
1523 | op_da_a10: ; else (lower nibble is 0x09 or lower) | |
1524 | sbrc z_flags,ZFL_C ; | | |
1525 | rjmp op_da_a12 ; if (C flag ... | |
1526 | cpi opl,0xA0 ; |... or upper nibble >= 0xA0) | |
1527 | brlo op_da_a13 ; | |
1528 | op_da_a12: | |
1529 | ori oph,0x60 ; add 0x60 | |
1530 | ori temp2,(1<<ZFL_C) ; set new C flag | |
1531 | op_da_a13: | |
1532 | sbrs z_flags,ZFL_H ; if (H flag) | |
1533 | rjmp op_da_ae ; | | |
1534 | ori oph,0x06 ; add 0x06 | |
1535 | mov temp,opl ; | | |
1536 | andi temp,0x0f ; | | |
1537 | cpi temp,0x06 ; if (lower nibble >= 0x0A) | |
1538 | brsh op_da_ae ; | | |
1539 | ori temp2,(1<<ZFL_H) ; set new H flag | |
1540 | ; endif | |
1541 | ; endif | |
1542 | op_da_ae: | |
1543 | add opl,oph | |
1544 | ldpmx z_flags, sz53p_tab, opl ; get S,Z,P flag | |
1545 | or z_flags,temp2 ; merge new C and H flag | |
1546 | ret | |
1547 | ||
1548 | op_da_sub: ;else (sub-op) | |
1549 | rcall do_op_inv ; TODO: ! | |
1550 | ret ;endif | |
1551 | #endif | |
1552 | ||
1553 | ||
1554 | ;---------------------------------------------------------------- | |
1555 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1556 | ;---------------------------------------------------------------- | |
1557 | ;|SCF |--0-01|Set Carry Flag |CY=1 | | |
1558 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1559 | ; | |
1560 | ; | |
1561 | do_op_scf: | |
1562 | do_z80_flags_clear_HN | |
1563 | ori z_flags,(1<<ZFL_C) | |
1564 | ret | |
1565 | ||
1566 | ;---------------------------------------------------------------- | |
1567 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1568 | ;---------------------------------------------------------------- | |
1569 | ;|CCF |--?-0*|Complement Carry Flag|CY=~CY, HC=previous CY| | |
1570 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1571 | ;|CCF |---- 1|Set Carry Flag |CY=1 | | |
1572 | ; | |
1573 | do_op_ccf: | |
1574 | do_z80_flags_clear_N | |
1575 | do_z80_flags_copy_HC | |
1576 | ldi temp,(1<<ZFL_C) | |
1577 | eor z_flags,temp | |
1578 | ret | |
1579 | ||
1580 | ;---------------------------------------------------------------- | |
1581 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1582 | ;---------------------------------------------------------------- | |
1583 | ;|CPL |--1-1-|Complement |A=~A | | |
1584 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1585 | ;|CPL |---- -|Complement |A=~A | | |
1586 | ; | |
1587 | ; | |
1588 | do_op_cpl: | |
1589 | com z_a | |
1590 | do_z80_flags_set_HN | |
1591 | ret | |
1592 | ||
1593 | ||
1594 | ;---------------------------------------------------------------- | |
1595 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1596 | ;---------------------------------------------------------------- | |
1597 | ;|PUSH xx |------|Push |-[SP]=xx | | |
1598 | ;|PUSH qq |------|Push |-[SP]=qq | | |
1599 | ; | |
1600 | ; | |
1601 | do_op_push16: | |
1602 | movw xl,z_spl | |
1603 | sbiw x,1 | |
1604 | mem_write_s oph | |
1605 | sbiw x,1 | |
1606 | mem_write_s opl | |
1607 | movw z_spl,xl | |
1608 | ||
1609 | .if STACK_DBG | |
1610 | printnewline | |
1611 | printstring "Stack push " | |
1612 | movw temp,opl | |
1613 | rcall printhexw | |
1614 | printstring ", SP is now " | |
1615 | movw temp,z_spl | |
1616 | rcall printhexw | |
1617 | printstring ". " | |
1618 | .endif | |
1619 | ||
1620 | ret | |
1621 | ||
1622 | ;---------------------------------------------------------------- | |
1623 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1624 | ;---------------------------------------------------------------- | |
1625 | ;|POP xx |------|Pop |xx=[SP]+ | | |
1626 | ;|POP qq |------|Pop |qq=[SP]+ | | |
1627 | ; | |
1628 | ; | |
1629 | do_op_pop16: | |
1630 | movw x,z_spl | |
1631 | mem_read_d opl | |
1632 | adiw x,1 | |
1633 | mem_read_d oph | |
1634 | adiw x,1 | |
1635 | movw z_spl,x | |
1636 | ||
1637 | .if STACK_DBG | |
1638 | printnewline | |
1639 | printstring "Stack pop " | |
1640 | movw temp,opl | |
1641 | rcall printhexw | |
1642 | printstring ", SP is now " | |
1643 | movw temp,z_spl | |
1644 | rcall printhexw | |
1645 | printstring ". " | |
1646 | .endif | |
1647 | ret | |
1648 | ||
1649 | ;---------------------------------------------------------------- | |
1650 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1651 | ;---------------------------------------------------------------- | |
1652 | ;|EX [SP],HL|------|Exchange |[SP]<->HL | | |
1653 | ;|EX DE,HL |------|Exchange |DE<->HL | | |
1654 | ;-----------------------------Z80-------------------------------- | |
1655 | ; | |
1656 | do_op_exhl: | |
e7a0f403 L |
1657 | ldd temp,y+oz_l |
1658 | ldd temp2,y+oz_h | |
1659 | std y+oz_l,opl | |
1660 | std y+oz_h,oph | |
fa9059af L |
1661 | movw opl,temp |
1662 | ret | |
1663 | ||
1664 | ;---------------------------------------------------------------- | |
1665 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1666 | ;---------------------------------------------------------------- | |
4c92af0d L |
1667 | ;|DI |------|Disable Interrupts |IFF1 = IFF2 = 0 | |
1668 | ;|EI |------|Enable Interrupts |IFF1 = IFF2 = 1 | | |
fa9059af | 1669 | ; |
4c92af0d L |
1670 | |
1671 | do_op_DI: | |
e7a0f403 L |
1672 | #if EM_Z80 |
1673 | ldd temp,y+oz_istat | |
4c92af0d | 1674 | andi temp,~((1<<IFF2) | (1<<IFF1)) |
e7a0f403 L |
1675 | std y+oz_istat,temp |
1676 | #endif | |
fa9059af L |
1677 | ret |
1678 | ||
4c92af0d | 1679 | do_op_EI: |
e7a0f403 L |
1680 | #if EM_Z80 |
1681 | ldd temp,y+oz_istat | |
4c92af0d | 1682 | ori temp,(1<<IFF2) | (1<<IFF1) |
e7a0f403 L |
1683 | std y+oz_istat,temp |
1684 | #endif | |
fa9059af L |
1685 | ret |
1686 | ||
1687 | ;---------------------------------------------------------------- | |
1688 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1689 | ;---------------------------------------------------------------- | |
1690 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1691 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1692 | ;|RET cc |------|Conditional Return |If cc RET | | |
1693 | ; | |
1694 | ; | |
1695 | do_op_ifnz: | |
1696 | sbrs z_flags, ZFL_Z | |
1697 | ret | |
1698 | pop temp ; nix tun | |
4c92af0d | 1699 | pop temp ; direkt zurueck zu main |
fa9059af L |
1700 | ret |
1701 | ||
1702 | ;---------------------------------------------------------------- | |
1703 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1704 | ;---------------------------------------------------------------- | |
1705 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1706 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1707 | ;|RET cc |------|Conditional Return |If cc RET | | |
1708 | ; | |
1709 | ; | |
1710 | do_op_ifz: | |
1711 | sbrc z_flags, ZFL_Z | |
1712 | ret | |
1713 | pop temp ; nix tun | |
4c92af0d | 1714 | pop temp ; direkt zurueck zu main |
fa9059af L |
1715 | ret |
1716 | ||
1717 | ;---------------------------------------------------------------- | |
1718 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1719 | ;---------------------------------------------------------------- | |
1720 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1721 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1722 | ;|RET cc |------|Conditional Return |If cc RET | | |
1723 | ; | |
1724 | ; | |
1725 | do_op_ifnc: | |
1726 | sbrs z_flags, ZFL_C | |
1727 | ret | |
1728 | pop temp ; nix tun | |
1729 | pop temp ; direkt zuruech zu main | |
1730 | ret | |
1731 | ||
1732 | ;---------------------------------------------------------------- | |
1733 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1734 | ;---------------------------------------------------------------- | |
1735 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1736 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1737 | ;|RET cc |------|Conditional Return |If cc RET | | |
1738 | ; | |
1739 | ; | |
1740 | do_op_ifc: | |
1741 | sbrc z_flags, ZFL_C | |
1742 | ret | |
1743 | pop temp ; nix tun | |
1744 | pop temp ; direkt zuruech zu main | |
1745 | ret | |
1746 | ||
1747 | ;---------------------------------------------------------------- | |
1748 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1749 | ;---------------------------------------------------------------- | |
1750 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1751 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1752 | ;|RET cc |------|Conditional Return |If cc RET | | |
1753 | ; | |
1754 | ; | |
1755 | do_op_ifpo: | |
1756 | sbrs z_flags, ZFL_P | |
1757 | ret | |
1758 | pop temp ; nix tun | |
1759 | pop temp ; direkt zuruech zu main | |
1760 | ret | |
1761 | ||
1762 | ;---------------------------------------------------------------- | |
1763 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1764 | ;---------------------------------------------------------------- | |
1765 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1766 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1767 | ;|RET cc |------|Conditional Return |If cc RET | | |
1768 | ; | |
1769 | ; | |
1770 | do_op_ifpe: | |
1771 | sbrc z_flags, ZFL_P | |
1772 | ret | |
1773 | pop temp ; nix tun | |
1774 | pop temp ; direkt zuruech zu main | |
1775 | ret | |
1776 | ||
1777 | ;---------------------------------------------------------------- | |
1778 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1779 | ;---------------------------------------------------------------- | |
1780 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1781 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1782 | ;|RET cc |------|Conditional Return |If cc RET | | |
1783 | ; | |
1784 | ; | |
1785 | do_op_ifp: ;sign positive, aka s=0 | |
1786 | sbrs z_flags, ZFL_S | |
1787 | ret | |
1788 | pop temp ; nix tun | |
1789 | pop temp ; direkt zuruech zu main | |
1790 | ret | |
1791 | ||
1792 | ;---------------------------------------------------------------- | |
1793 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1794 | ;---------------------------------------------------------------- | |
1795 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1796 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1797 | ;|RET cc |------|Conditional Return |If cc RET | | |
1798 | ; | |
1799 | ; | |
1800 | do_op_ifm: ;sign negative, aka s=1 | |
1801 | sbrc z_flags, ZFL_S | |
1802 | ret | |
1803 | pop temp ; nix tun | |
1804 | pop temp ; direkt zuruech zu main | |
1805 | ret | |
1806 | ||
80e1fa71 | 1807 | ;---------------------------------------------------------------- |
fa9059af | 1808 | |
80e1fa71 L |
1809 | #if EM_Z80 |
1810 | ||
1811 | ;---------------------------------------------------------------- | |
1812 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1813 | ;---------------------------------------------------------------- | |
1814 | ;|DJNZ e |------|Dec., Jump Non-Zero |B=B-1 till B=0 | | |
1815 | ; | |
1816 | ||
1817 | do_op_djnz: | |
e7a0f403 | 1818 | ldd temp,y+oz_b |
80e1fa71 | 1819 | dec temp |
e7a0f403 | 1820 | std y+oz_b,temp |
80e1fa71 L |
1821 | brne opdjnze |
1822 | pop temp ; nix tun | |
1823 | pop temp ; direkt zuruech zu main | |
1824 | opdjnze: | |
1825 | ret | |
1826 | ||
1827 | ||
1828 | ;---------------------------------------------------------------- | |
1829 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1830 | ;---------------------------------------------------------------- | |
1831 | ;|EX AF,AF' |------|Exchange |AF<->AF' | | |
1832 | ||
1833 | do_op_EXAF: | |
e7a0f403 L |
1834 | ldd temp,y+oz_f2 |
1835 | ldd temp2,y+oz_a2 | |
1836 | std y+oz_f2,z_flags | |
1837 | std y+oz_a2,z_a | |
80e1fa71 L |
1838 | mov z_flags,temp |
1839 | mov z_a,temp2 | |
1840 | ret | |
1841 | ||
1842 | ||
1843 | ;---------------------------------------------------------------- | |
1844 | ;|Mnemonic |SZHPNC|Description |Notes | | |
fa9059af | 1845 | ;---------------------------------------------------------------- |
80e1fa71 L |
1846 | ;|EXX |------|Exchange |qq<->qq' (except AF)| |
1847 | ||
1848 | ||
1849 | do_op_EXX: | |
1850 | ldiw z,z_b | |
1851 | ldi temp3,6 | |
1852 | opexx_loop: | |
1853 | ld temp,z | |
1854 | ldd temp2,z+r2ofs | |
1855 | std z+r2ofs,temp | |
1856 | st z+,temp2 | |
1857 | dec temp3 | |
1858 | brne opexx_loop | |
1859 | ret | |
1860 | ||
1861 | #else | |
1862 | do_op_djnz: | |
1863 | do_op_EXAF: | |
1864 | do_op_EXX: | |
1865 | ret | |
1866 | #endif | |
fa9059af L |
1867 | |
1868 | #if EM_Z80 | |
1869 | ||
1870 | do_op_prefixED: | |
1871 | mem_read_ds zl,z_pc ;zl = memReadByte(z_pc) | |
1872 | adiw z_pcl,1 ;++z_pc | |
1873 | ldi zh,high(EDjmp) ; | |
1874 | ijmp | |
1875 | ||
1876 | ||
1877 | do_op_prefixDD: | |
80e1fa71 | 1878 | cbi flags,prefixfd |
fa9059af L |
1879 | mem_read_ds zl,z_pc ;zl = memReadByte(z_pc) |
1880 | adiw z_pcl,1 ;++z_pc | |
1881 | ldi zh,high(DDFDjmp) ; | |
1882 | ijmp | |
1883 | ||
1884 | ||
1885 | do_op_prefixFD: | |
80e1fa71 | 1886 | sbi flags,prefixfd |
fa9059af L |
1887 | mem_read_ds zl,z_pc ;zl = memReadByte(z_pc) |
1888 | adiw z_pcl,1 ;++z_pc | |
1889 | ldi zh,high(DDFDjmp) ; | |
1890 | ijmp | |
1891 | ||
80e1fa71 L |
1892 | do_op_prefixCB: |
1893 | mem_read_ds zl,z_pc ;zl = memReadByte(z_pc) | |
1894 | adiw z_pcl,1 ;++z_pc | |
1895 | ldi zh,high(CBjmp) ; | |
1896 | ijmp | |
1897 | ||
1898 | ||
1899 | do_op_prefixDDFDCB: | |
e7a0f403 L |
1900 | sbic flags,prefixfd |
1901 | rjmp opprxcb_fd | |
1902 | ldd xh,y+oz_xh | |
1903 | ldd xl,y+oz_xl | |
1904 | rjmp opprxcb_1 | |
1905 | opprxcb_fd: | |
1906 | ldd xh,y+oz_yh | |
1907 | ldd xl,y+oz_yl | |
1908 | opprxcb_1: | |
1909 | mem_read_s z_pc ;get displacement | |
1910 | adiw z_pcl,1 ;++z_pc | |
1911 | clr temp2 ;sign extend | |
1912 | tst temp | |
1913 | brpl PC+2 | |
1914 | com temp2 | |
1915 | add xl,temp ;add displacement | |
1916 | adc xh,temp2 | |
1917 | mem_read_d opl | |
1918 | ||
80e1fa71 L |
1919 | mem_read_ds zl,z_pc ;zl = opcode |
1920 | adiw z_pcl,1 ;++z_pc | |
e7a0f403 L |
1921 | ldi zh,high(DDFDCBjmp) ; |
1922 | icall | |
1923 | mem_write_s opl | |
1924 | ret | |
80e1fa71 L |
1925 | |
1926 | ||
fa9059af L |
1927 | #else ; TODO: geht das so? |
1928 | ||
1929 | do_op_prefixED: | |
1930 | do_op_prefixDD: | |
1931 | do_op_prefixFD: | |
80e1fa71 | 1932 | do_op_prefixCB: |
fa9059af L |
1933 | ret |
1934 | #endif | |
1935 | ||
1936 | ||
1937 | ; ----------------------- Opcode decoding ------------------------- | |
1938 | ||
1939 | ; Lookup table for Z80 opcodes. Translates the first byte of the instruction word into three | |
1940 | ; operations: fetch, do something, store. | |
1941 | ; The table is made of 256 words. | |
1942 | ||
1943 | opctable opcjmp | |
1944 | ||
1945 | instr fetch_nop, op_nop, store_nop ;00 ;NOP | |
1946 | instr fetch_DIR16, op_nop, store_BC ;01 nn nn ;LD BC,nn | |
1947 | instr fetch_nop, op_nop, store_MBC ;02 ;LD (BC),A | |
1948 | instr fetch_BC, op_INC16, store_BC ;03 ;INC BC | |
1949 | instr fetch_B, op_INC, store_B ;04 ;INC B | |
1950 | instr fetch_B, op_DEC, store_B ;05 ;DEC B | |
1951 | instr fetch_DIR8, op_nop, store_B ;06 ;LD B,n | |
1952 | instr fetch_nop, op_RLCA, store_nop ;07 ;RLCA | |
80e1fa71 L |
1953 | instr fetch_nop, op_EXAF, store_nop ;08 ;EX AF,AF' |
1954 | instr fetch_BC, op_ADDHL, store_nop ;09 ;ADD HL,BC | |
fa9059af L |
1955 | instr fetch_MBC, op_nop, store_nop ;0A ;LD A,(BC) |
1956 | instr fetch_BC, op_DEC16, store_BC ;0B ;DEC BC | |
1957 | instr fetch_C, op_INC, store_C ;0C ;INC C | |
1958 | instr fetch_C, op_DEC, store_C ;0D ;DEC C | |
1959 | instr fetch_DIR8, op_nop, store_C ;0E nn ;LD C,n | |
1960 | instr fetch_nop, op_RRCA, store_nop ;0F ;RRCA | |
80e1fa71 | 1961 | instr fetch_DIR8, op_DJNZ, store_pcrel ;10 oo ;DJNZ o |
fa9059af L |
1962 | instr fetch_DIR16, op_nop, store_DE ;11 nn nn ;LD DE,nn |
1963 | instr fetch_nop, op_nop, store_MDE ;12 ;LD (DE),A | |
1964 | instr fetch_DE, op_INC16, store_DE ;13 ;INC DE | |
1965 | instr fetch_D, op_INC, store_D ;14 ;INC D | |
1966 | instr fetch_D, op_DEC, store_D ;15 ;DEC D | |
1967 | instr fetch_DIR8, op_nop, store_D ;16 nn ;LD D,n | |
1968 | instr fetch_nop, op_RLA, store_nop ;17 ;RLA | |
80e1fa71 L |
1969 | instr fetch_DIR8, op_nop, store_pcrel ;18 oo ;JR o |
1970 | instr fetch_DE, op_ADDHL, store_nop ;19 ;ADD HL,DE | |
fa9059af L |
1971 | instr fetch_MDE, op_nop, store_nop ;1A ;LD A,(DE) |
1972 | instr fetch_DE, op_DEC16, store_DE ;1B ;DEC DE | |
1973 | instr fetch_E, op_INC, store_E ;1C ;INC E | |
1974 | instr fetch_E, op_DEC, store_E ;1D ;DEC E | |
1975 | instr fetch_DIR8, op_nop, store_E ;1E nn ;LD E,n | |
1976 | instr fetch_nop, op_RRA, store_nop ;1F ;RRA | |
80e1fa71 | 1977 | instr fetch_DIR8, op_IFNZ, store_pcrel ;20 oo ;JR NZ,o |
fa9059af L |
1978 | instr fetch_DIR16, op_nop, store_HL ;21 nn nn ;LD HL,nn |
1979 | instr fetch_DIR16, op_STHL, store_nop ;22 nn nn ;LD (nn),HL | |
1980 | instr fetch_HL, op_INC16, store_HL ;23 ;INC HL | |
1981 | instr fetch_H, op_INC, store_H ;24 ;INC H | |
1982 | instr fetch_H, op_DEC, store_H ;25 ;DEC H | |
1983 | instr fetch_DIR8, op_nop, store_H ;26 nn ;LD H,n | |
1984 | instr fetch_A, op_DA, store_A ;27 ;DAA | |
80e1fa71 L |
1985 | instr fetch_DIR8, op_IFZ, store_pcrel ;28 oo ;JR Z,o |
1986 | instr fetch_HL, op_ADDHL, store_nop ;29 ;ADD HL,HL | |
fa9059af L |
1987 | instr fetch_DIR16, op_RMEM16, store_HL ;2A nn nn ;LD HL,(nn) |
1988 | instr fetch_HL, op_DEC16, store_HL ;2B ;DEC HL | |
1989 | instr fetch_L, op_INC, store_L ;2C ;INC L | |
1990 | instr fetch_L, op_DEC, store_L ;2D ;DEC L | |
1991 | instr fetch_DIR8, op_nop, store_L ;2E nn ;LD L,n | |
1992 | instr fetch_nop, op_CPL, store_nop ;2F ;CPL | |
80e1fa71 | 1993 | instr fetch_DIR8, op_IFNC, store_pcrel ;30 oo ;JR NC,o |
fa9059af L |
1994 | instr fetch_DIR16, op_nop, store_SP ;31 nn nn ;LD SP,nn |
1995 | instr fetch_DIR16, op_nop, store_AM ;32 nn nn ;LD (nn),A | |
1996 | instr fetch_SP, op_INC16, store_SP ;33 ;INC SP | |
1997 | instr fetch_MHL, op_INC, store_MHL ;34 ;INC (HL) | |
1998 | instr fetch_MHL, op_DEC, store_MHL ;35 ;DEC (HL) | |
1999 | instr fetch_DIR8, op_nop, store_MHL ;36 nn ;LD (HL),n | |
2000 | instr fetch_nop, op_SCF, store_nop ;37 ;SCF | |
80e1fa71 L |
2001 | instr fetch_DIR8, op_IFC, store_pcrel ;38 oo ;JR C,o |
2002 | instr fetch_SP, op_ADDHL, store_nop ;39 ;ADD HL,SP | |
fa9059af L |
2003 | instr fetch_DIR16, op_RMEM8, store_A ;3A nn nn ;LD A,(nn) |
2004 | instr fetch_SP, op_DEC16, store_SP ;3B ;DEC SP | |
2005 | instr fetch_nop, op_INCA, store_nop ;3C ;INC A | |
2006 | instr fetch_nop, op_DECA, store_nop ;3D ;DEC A | |
2007 | instr fetch_DIR8, op_nop, store_A ;3E nn ;LD A,n | |
2008 | instr fetch_nop, op_CCF, store_nop ;3F ;CCF (Complement Carry Flag, gvd) | |
2009 | instr fetch_nop, op_nop, store_nop ;40 ;LD B,B | |
2010 | instr fetch_C, op_nop, store_B ;41 ;LD B,C | |
2011 | instr fetch_D, op_nop, store_B ;42 ;LD B,D | |
2012 | instr fetch_E, op_nop, store_B ;43 ;LD B,E | |
2013 | instr fetch_H, op_nop, store_B ;44 ;LD B,H | |
2014 | instr fetch_L, op_nop, store_B ;45 ;LD B,L | |
2015 | instr fetch_MHL, op_nop, store_B ;46 ;LD B,(HL) | |
2016 | instr fetch_A, op_nop, store_B ;47 ;LD B,A | |
2017 | instr fetch_B, op_nop, store_C ;48 ;LD C,B | |
2018 | instr fetch_nop, op_nop, store_nop ;49 ;LD C,C | |
2019 | instr fetch_D, op_nop, store_C ;4A ;LD C,D | |
2020 | instr fetch_E, op_nop, store_C ;4B ;LD C,E | |
2021 | instr fetch_H, op_nop, store_C ;4C ;LD C,H | |
2022 | instr fetch_L, op_nop, store_C ;4D ;LD C,L | |
2023 | instr fetch_MHL, op_nop, store_C ;4E ;LD C,(HL) | |
2024 | instr fetch_A, op_nop, store_C ;4F ;LD C,A | |
2025 | instr fetch_B, op_nop, store_D ;50 ;LD D,B | |
2026 | instr fetch_C, op_nop, store_D ;51 ;LD D,C | |
2027 | instr fetch_nop, op_nop, store_nop ;52 ;LD D,D | |
2028 | instr fetch_E, op_nop, store_D ;53 ;LD D,E | |
2029 | instr fetch_H, op_nop, store_D ;54 ;LD D,H | |
2030 | instr fetch_L, op_nop, store_D ;55 ;LD D,L | |
2031 | instr fetch_MHL, op_nop, store_D ;56 ;LD D,(HL) | |
2032 | instr fetch_A, op_nop, store_D ;57 ;LD D,A | |
2033 | instr fetch_B, op_nop, store_E ;58 ;LD E,B | |
2034 | instr fetch_C, op_nop, store_E ;59 ;LD E,C | |
2035 | instr fetch_D, op_nop, store_E ;5A ;LD E,D | |
2036 | instr fetch_nop, op_nop, store_nop ;5B ;LD E,E | |
2037 | instr fetch_H, op_nop, store_E ;5C ;LD E,H | |
2038 | instr fetch_L, op_nop, store_E ;5D ;LD E,L | |
2039 | instr fetch_MHL, op_nop, store_E ;5E ;LD E,(HL) | |
2040 | instr fetch_A, op_nop, store_E ;5F ;LD E,A | |
2041 | instr fetch_B, op_nop, store_H ;60 ;LD H,B | |
2042 | instr fetch_C, op_nop, store_H ;61 ;LD H,C | |
2043 | instr fetch_D, op_nop, store_H ;62 ;LD H,D | |
2044 | instr fetch_E, op_nop, store_H ;63 ;LD H,E | |
2045 | instr fetch_nop, op_nop, store_nop ;64 ;LD H,H | |
2046 | instr fetch_L, op_nop, store_H ;65 ;LD H,L | |
2047 | instr fetch_MHL, op_nop, store_H ;66 ;LD H,(HL) | |
2048 | instr fetch_A, op_nop, store_H ;67 ;LD H,A | |
2049 | instr fetch_B, op_nop, store_L ;68 ;LD L,B | |
2050 | instr fetch_C, op_nop, store_L ;69 ;LD L,C | |
2051 | instr fetch_D, op_nop, store_L ;6A ;LD L,D | |
2052 | instr fetch_E, op_nop, store_L ;6B ;LD L,E | |
2053 | instr fetch_H, op_nop, store_L ;6C ;LD L,H | |
2054 | instr fetch_nop, op_nop, store_nop ;6D ;LD L,L | |
2055 | instr fetch_MHL, op_nop, store_L ;6E ;LD L,(HL) | |
2056 | instr fetch_A, op_nop, store_L ;6F ;LD L,A | |
2057 | instr fetch_B, op_nop, store_MHL ;70 ;LD (HL),B | |
2058 | instr fetch_C, op_nop, store_MHL ;71 ;LD (HL),C | |
2059 | instr fetch_D, op_nop, store_MHL ;72 ;LD (HL),D | |
2060 | instr fetch_E, op_nop, store_MHL ;73 ;LD (HL),E | |
2061 | instr fetch_H, op_nop, store_MHL ;74 ;LD (HL),H | |
2062 | instr fetch_L, op_nop, store_MHL ;75 ;LD (HL),L | |
80e1fa71 | 2063 | instr fetch_nop, op_HALT, store_nop ;76 ;HALT |
fa9059af L |
2064 | instr fetch_A, op_nop, store_MHL ;77 ;LD (HL),A |
2065 | instr fetch_B, op_nop, store_A ;78 ;LD A,B | |
2066 | instr fetch_C, op_nop, store_A ;79 ;LD A,C | |
2067 | instr fetch_D, op_nop, store_A ;7A ;LD A,D | |
2068 | instr fetch_E, op_nop, store_A ;7B ;LD A,E | |
2069 | instr fetch_H, op_nop, store_A ;7C ;LD A,H | |
2070 | instr fetch_L, op_nop, store_A ;7D ;LD A,L | |
2071 | instr fetch_MHL, op_nop, store_A ;7E ;LD A,(HL) | |
2072 | instr fetch_nop, op_nop, store_nop ;7F ;LD A,A | |
2073 | instr fetch_B, op_ADDA, store_nop ;80 ;ADD A,B | |
2074 | instr fetch_C, op_ADDA, store_nop ;81 ;ADD A,C | |
2075 | instr fetch_D, op_ADDA, store_nop ;82 ;ADD A,D | |
2076 | instr fetch_E, op_ADDA, store_nop ;83 ;ADD A,E | |
2077 | instr fetch_H, op_ADDA, store_nop ;84 ;ADD A,H | |
2078 | instr fetch_L, op_ADDA, store_nop ;85 ;ADD A,L | |
2079 | instr fetch_MHL, op_ADDA, store_nop ;86 ;ADD A,(HL) | |
2080 | instr fetch_A, op_ADDA, store_nop ;87 ;ADD A,A | |
2081 | instr fetch_B, op_ADCA, store_nop ;88 ;ADC A,B | |
2082 | instr fetch_C, op_ADCA, store_nop ;89 ;ADC A,C | |
2083 | instr fetch_D, op_ADCA, store_nop ;8A ;ADC A,D | |
2084 | instr fetch_E, op_ADCA, store_nop ;8B ;ADC A,E | |
2085 | instr fetch_H, op_ADCA, store_nop ;8C ;ADC A,H | |
2086 | instr fetch_L, op_ADCA, store_nop ;8D ;ADC A,L | |
2087 | instr fetch_MHL, op_ADCA, store_nop ;8E ;ADC A,(HL) | |
2088 | instr fetch_A, op_ADCA, store_nop ;8F ;ADC A,A | |
2089 | instr fetch_B, op_SUBFA, store_nop ;90 ;SUB A,B | |
2090 | instr fetch_C, op_SUBFA, store_nop ;91 ;SUB A,C | |
2091 | instr fetch_D, op_SUBFA, store_nop ;92 ;SUB A,D | |
2092 | instr fetch_E, op_SUBFA, store_nop ;93 ;SUB A,E | |
2093 | instr fetch_H, op_SUBFA, store_nop ;94 ;SUB A,H | |
2094 | instr fetch_L, op_SUBFA, store_nop ;95 ;SUB A,L | |
2095 | instr fetch_MHL, op_SUBFA, store_nop ;96 ;SUB A,(HL) | |
2096 | instr fetch_A, op_SUBFA, store_nop ;97 ;SUB A,A | |
2097 | instr fetch_B, op_SBCFA, store_nop ;98 ;SBC A,B | |
2098 | instr fetch_C, op_SBCFA, store_nop ;99 ;SBC A,C | |
2099 | instr fetch_D, op_SBCFA, store_nop ;9A ;SBC A,D | |
2100 | instr fetch_E, op_SBCFA, store_nop ;9B ;SBC A,E | |
2101 | instr fetch_H, op_SBCFA, store_nop ;9C ;SBC A,H | |
2102 | instr fetch_L, op_SBCFA, store_nop ;9D ;SBC A,L | |
2103 | instr fetch_MHL, op_SBCFA, store_nop ;9E ;SBC A,(HL) | |
2104 | instr fetch_A, op_SBCFA, store_nop ;9F ;SBC A,A | |
2105 | instr fetch_B, op_ANDA, store_nop ;A0 ;AND A,B | |
2106 | instr fetch_C, op_ANDA, store_nop ;A1 ;AND A,C | |
2107 | instr fetch_D, op_ANDA, store_nop ;A2 ;AND A,D | |
2108 | instr fetch_E, op_ANDA, store_nop ;A3 ;AND A,E | |
2109 | instr fetch_H, op_ANDA, store_nop ;A4 ;AND A,H | |
2110 | instr fetch_L, op_ANDA, store_nop ;A5 ;AND A,L | |
2111 | instr fetch_MHL, op_ANDA, store_nop ;A6 ;AND A,(HL) | |
2112 | instr fetch_A, op_ANDA, store_nop ;A7 ;AND A,A | |
2113 | instr fetch_B, op_XORA, store_nop ;A8 ;XOR A,B | |
2114 | instr fetch_C, op_XORA, store_nop ;A9 ;XOR A,C | |
2115 | instr fetch_D, op_XORA, store_nop ;AA ;XOR A,D | |
2116 | instr fetch_E, op_XORA, store_nop ;AB ;XOR A,E | |
2117 | instr fetch_H, op_XORA, store_nop ;AC ;XOR A,H | |
2118 | instr fetch_L, op_XORA, store_nop ;AD ;XOR A,L | |
2119 | instr fetch_MHL, op_XORA, store_nop ;AE ;XOR A,(HL) | |
2120 | instr fetch_A, op_XORA, store_nop ;AF ;XOR A,A | |
2121 | instr fetch_B, op_ORA, store_nop ;B0 ;OR A,B | |
2122 | instr fetch_C, op_ORA, store_nop ;B1 ;OR A,C | |
2123 | instr fetch_D, op_ORA, store_nop ;B2 ;OR A,D | |
2124 | instr fetch_E, op_ORA, store_nop ;B3 ;OR A,E | |
2125 | instr fetch_H, op_ORA, store_nop ;B4 ;OR A,H | |
2126 | instr fetch_L, op_ORA, store_nop ;B5 ;OR A,L | |
2127 | instr fetch_MHL, op_ORA, store_nop ;B6 ;OR A,(HL) | |
2128 | instr fetch_A, op_ORA, store_nop ;B7 ;OR A,A | |
2129 | instr fetch_B, op_CPFA, store_nop ;B8 ;CP A,B | |
2130 | instr fetch_C, op_CPFA, store_nop ;B9 ;CP A,C | |
2131 | instr fetch_D, op_CPFA, store_nop ;BA ;CP A,D | |
2132 | instr fetch_E, op_CPFA, store_nop ;BB ;CP A,E | |
2133 | instr fetch_H, op_CPFA, store_nop ;BC ;CP A,H | |
2134 | instr fetch_L, op_CPFA, store_nop ;BD ;CP A,L | |
2135 | instr fetch_MHL, op_CPFA, store_nop ;BE ;CP A,(HL) | |
2136 | instr fetch_A, op_CPFA, store_nop ;BF ;CP A,A | |
2137 | instr fetch_nop, op_IFNZ, store_RET ;C0 ;RET NZ | |
2138 | instr fetch_nop, op_POP16, store_BC ;C1 ;POP BC | |
2139 | instr fetch_DIR16, op_IFNZ, store_PC ;C2 nn nn ;JP NZ,nn | |
2140 | instr fetch_DIR16, op_nop, store_PC ;C3 nn nn ;JP nn | |
2141 | instr fetch_DIR16, op_IFNZ, store_CALL ;C4 nn nn ;CALL NZ,nn | |
2142 | instr fetch_BC, op_PUSH16, store_nop ;C5 ;PUSH BC | |
2143 | instr fetch_DIR8, op_ADDA, store_nop ;C6 nn ;ADD A,n | |
2144 | instr fetch_RST, op_nop, store_CALL ;C7 ;RST 0 | |
2145 | instr fetch_nop, op_IFZ, store_RET ;C8 ;RET Z | |
2146 | instr fetch_nop, op_nop, store_RET ;C9 ;RET | |
2147 | instr fetch_DIR16, op_IFZ, store_PC ;CA nn nn ;JP Z,nn | |
80e1fa71 | 2148 | instr fetch_nop, op_prefixCB, store_nop ;CB ;(CB opcode prefix) |
fa9059af L |
2149 | instr fetch_DIR16, op_IFZ, store_CALL ;CC nn nn ;CALL Z,nn |
2150 | instr fetch_DIR16, op_nop, store_CALL ;CD nn nn ;CALL nn | |
2151 | instr fetch_DIR8, op_ADCA, store_nop ;CE nn ;ADC A,n | |
2152 | instr fetch_RST, op_nop, store_CALL ;CF ;RST 8H | |
2153 | instr fetch_nop, op_IFNC, store_RET ;D0 ;RET NC | |
2154 | instr fetch_nop, op_POP16, store_DE ;D1 ;POP DE | |
2155 | instr fetch_DIR16, op_IFNC, store_PC ;D2 nn nn ;JP NC,nn | |
2156 | instr fetch_DIR8, op_OUTA, store_nop ;D3 nn ;OUT (n),A | |
2157 | instr fetch_DIR16, op_IFNC, store_CALL ;D4 nn nn ;CALL NC,nn | |
2158 | instr fetch_DE, op_PUSH16, store_nop ;D5 ;PUSH DE | |
2159 | instr fetch_DIR8, op_SUBFA, store_nop ;D6 nn ;SUB n | |
2160 | instr fetch_RST, op_nop, store_CALL ;D7 ;RST 10H | |
2161 | instr fetch_nop, op_IFC, store_RET ;D8 ;RET C | |
80e1fa71 | 2162 | instr fetch_nop, op_EXX, store_nop ;D9 ;EXX |
fa9059af | 2163 | instr fetch_DIR16, op_IFC, store_PC ;DA nn nn ;JP C,nn |
80e1fa71 | 2164 | instr fetch_DIR8, op_INA, store_nop ;DB nn ;IN A,(n) |
fa9059af | 2165 | instr fetch_DIR16, op_IFC, store_CALL ;DC nn nn ;CALL C,nn |
e7a0f403 | 2166 | instr fetch_nop, op_prefixDD, store_nop ;DD ;(DD opcode prefix) |
fa9059af L |
2167 | instr fetch_DIR8, op_SBCFA, store_nop ;DE nn ;SBC A,n |
2168 | instr fetch_RST, op_nop, store_CALL ;DF ;RST 18H | |
2169 | instr fetch_nop, op_IFPO, store_RET ;E0 ;RET PO | |
2170 | instr fetch_nop, op_POP16, store_HL ;E1 ;POP HL | |
2171 | instr fetch_DIR16, op_IFPO, store_PC ;E2 nn nn ;JP PO,nn | |
2172 | instr fetch_MSP, op_EXHL, store_MSP ;E3 ;EX (SP),HL | |
2173 | instr fetch_DIR16, op_IFPO, store_CALL ;E4 nn nn ;CALL PO,nn | |
2174 | instr fetch_HL, op_PUSH16, store_nop ;E5 ;PUSH HL | |
2175 | instr fetch_DIR8, op_ANDA, store_nop ;E6 nn ;AND n | |
2176 | instr fetch_RST, op_nop, store_CALL ;E7 ;RST 20H | |
2177 | instr fetch_nop, op_IFPE, store_RET ;E8 ;RET PE | |
2178 | instr fetch_HL, op_nop, store_PC ;E9 ;JP HL | |
2179 | instr fetch_DIR16, op_IFPE, store_PC ;EA nn nn ;JP PE,nn | |
2180 | instr fetch_DE, op_EXHL, store_DE ;EB ;EX DE,HL | |
2181 | instr fetch_DIR16, op_IFPE, store_CALL ;EC nn nn ;CALL PE,nn | |
2182 | instr fetch_nop, op_prefixED, store_nop ;ED ;(ED opcode prefix) | |
2183 | instr fetch_DIR8, op_XORA, store_nop ;EE nn ;XOR n | |
2184 | instr fetch_RST, op_nop, store_CALL ;EF ;RST 28H | |
2185 | instr fetch_nop, op_IFP, store_RET ;F0 ;RET P | |
2186 | instr fetch_nop, op_POP16, store_AF ;F1 ;POP AF | |
2187 | instr fetch_DIR16, op_IFP, store_PC ;F2 nn nn ;JP P,nn | |
2188 | instr fetch_nop, op_DI, store_nop ;F3 ;DI | |
2189 | instr fetch_DIR16, op_IFP, store_CALL ;F4 nn nn ;CALL P,nn | |
2190 | instr fetch_AF, op_PUSH16, store_nop ;F5 ;PUSH AF | |
2191 | instr fetch_DIR8, op_ORA, store_nop ;F6 nn ;OR n | |
2192 | instr fetch_RST, op_nop, store_CALL ;F7 ;RST 30H | |
2193 | instr fetch_nop, op_IFM, store_RET ;F8 ;RET M | |
2194 | instr fetch_HL, op_nop, store_SP ;F9 ;LD SP,HL | |
2195 | instr fetch_DIR16, op_IFM, store_PC ;FA nn nn ;JP M,nn | |
2196 | instr fetch_nop, op_EI, store_nop ;FB ;EI | |
2197 | instr fetch_DIR16, op_IFM, store_CALL ;FC nn nn ;CALL M,nn | |
2198 | instr fetch_nop, op_prefixFD, store_nop ;FD ;(FD opcode prefix) | |
2199 | instr fetch_DIR8, op_CPFA, store_nop ;FE nn ;CP n | |
2200 | instr fetch_RST, op_nop, store_CALL ;FF ;RST 38H | |
2201 | ||
2202 | ||
2203 | #if EM_Z80 | |
2204 | ||
e7a0f403 L |
2205 | |
2206 | ||
fa9059af L |
2207 | do_fetch_0: |
2208 | ldi opl,0 | |
2209 | ret | |
2210 | ||
2211 | ;---------------------------------------------------------------- | |
2212 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2213 | ;---------------------------------------------------------------- | |
80e1fa71 L |
2214 | ;|IN r,[C] |***P0-|Input |r=[C] | |
2215 | ; | |
2216 | ||
2217 | do_op_in: ; in opl,(opl) | |
2218 | .if PORT_DEBUG | |
2219 | printnewline | |
2220 | printstring "Port read: (" | |
2221 | mov temp,opl | |
2222 | rcall printhex | |
2223 | printstring ") -> " | |
2224 | .endif | |
2225 | ||
2226 | mov temp2,opl | |
2227 | lcall portRead | |
2228 | mov opl,temp | |
2229 | bst z_flags,ZFL_C ;save Carry | |
2230 | ldpmx z_flags,sz53p_tab,temp ;S,Z,P | |
2231 | bld z_flags,ZFL_C | |
2232 | ||
2233 | .if PORT_DEBUG | |
2234 | rcall printhex | |
2235 | printstring " " | |
2236 | .endif | |
2237 | ret | |
2238 | ||
2239 | ;---------------------------------------------------------------- | |
2240 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2241 | ;---------------------------------------------------------------- | |
2242 | ;|OUT [C],r |------|Output |[C]=r | | |
fa9059af | 2243 | ; |
80e1fa71 L |
2244 | |
2245 | do_op_out: ; out (c),opl | |
2246 | mov temp,opl | |
e7a0f403 | 2247 | ldd temp2,y+oz_c |
80e1fa71 L |
2248 | lcall portWrite |
2249 | ret | |
2250 | ||
2251 | ;---------------------------------------------------------------- | |
2252 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2253 | ;---------------------------------------------------------------- | |
2254 | ;|LD dst,src|------|Load |dst=src | | |
fa9059af | 2255 | ; |
80e1fa71 | 2256 | |
fa9059af L |
2257 | do_op_stbc: ;store bc to mem loc in opl:h |
2258 | movw xl,opl | |
e7a0f403 | 2259 | ldd temp,y+oz_c |
fa9059af L |
2260 | mem_write |
2261 | adiw xl,1 | |
e7a0f403 | 2262 | ldd temp,y+oz_b |
fa9059af L |
2263 | mem_write |
2264 | ret | |
2265 | ||
2266 | ;---------------------------------------------------------------- | |
2267 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2268 | ;---------------------------------------------------------------- | |
2269 | ;|LD dst,src|------|Load |dst=src | | |
2270 | ; | |
2271 | ; | |
2272 | do_op_stde: ;store de to mem loc in opl:h | |
2273 | movw xl,opl | |
e7a0f403 | 2274 | ldd temp,y+oz_e |
fa9059af L |
2275 | mem_write |
2276 | adiw xl,1 | |
e7a0f403 | 2277 | ldd temp,y+oz_d |
fa9059af L |
2278 | mem_write |
2279 | ret | |
2280 | ||
2281 | ;---------------------------------------------------------------- | |
2282 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2283 | ;---------------------------------------------------------------- | |
2284 | ;|LD dst,src|------|Load |dst=src | | |
2285 | ; | |
2286 | ; | |
2287 | do_op_stsp: ;store sp to mem loc in opl:h | |
2288 | movw xl,opl | |
2289 | mem_write_s z_spl | |
2290 | adiw xl,1 | |
2291 | mem_write_s z_sph | |
2292 | ret | |
2293 | ||
2294 | ;---------------------------------------------------------------- | |
2295 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2296 | ;---------------------------------------------------------------- | |
80e1fa71 | 2297 | ;|ADC HL,ss |***V0*|Add with Carry |HL=HL+ss+CY | |
fa9059af L |
2298 | ; |
2299 | ||
fa9059af | 2300 | do_op_ADCHL: |
e7a0f403 L |
2301 | ldd temp,y+oz_l |
2302 | ldd temp2,y+oz_h | |
80e1fa71 L |
2303 | clc |
2304 | sbrc z_flags,ZFL_C | |
2305 | sec | |
2306 | adc opl,temp | |
2307 | in temp,sreg ; save lower Z | |
fa9059af | 2308 | adc oph,temp2 |
80e1fa71 | 2309 | in temp2,sreg |
e7a0f403 L |
2310 | std y+oz_l,opl |
2311 | std y+oz_h,oph | |
80e1fa71 L |
2312 | and temp,temp2 ; 16bit Z |
2313 | ldi z_flags,0 ; clear N | |
2314 | bmov z_flags,ZFL_C, temp2,AVR_C | |
2315 | bmov z_flags,ZFL_P, temp2,AVR_V | |
2316 | bmov z_flags,ZFL_H, temp2,AVR_H | |
2317 | bmov z_flags,ZFL_Z, temp,AVR_Z | |
4c92af0d | 2318 | bmov z_flags,ZFL_S, temp2,AVR_N |
fa9059af L |
2319 | ret |
2320 | ||
fa9059af L |
2321 | ;---------------------------------------------------------------- |
2322 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2323 | ;---------------------------------------------------------------- | |
80e1fa71 | 2324 | ;|SBC HL,ss |***V1*|Subtract with carry |HL=HL-ss-CY | |
fa9059af L |
2325 | ; |
2326 | ; | |
2327 | do_op_sbchl: | |
e7a0f403 L |
2328 | ldd temp,y+oz_l |
2329 | ldd temp2,y+oz_h | |
4c92af0d | 2330 | cp temp,opl ; set z |
fa9059af | 2331 | clc |
4c92af0d | 2332 | sbrc z_flags,ZFL_C |
fa9059af | 2333 | sec |
4c92af0d L |
2334 | sbc temp,opl |
2335 | sbc temp2,oph | |
e7a0f403 L |
2336 | std y+oz_l,temp |
2337 | std y+oz_h,temp2 | |
fa9059af | 2338 | in temp,sreg |
80e1fa71 | 2339 | ldi z_flags,(1<<ZFL_N) ; set N |
fa9059af | 2340 | bmov z_flags,ZFL_C, temp,AVR_C |
80e1fa71 | 2341 | bmov z_flags,ZFL_P, temp,AVR_V |
fa9059af | 2342 | bmov z_flags,ZFL_H, temp,AVR_H |
80e1fa71 | 2343 | bmov z_flags,ZFL_Z, temp,AVR_Z |
4c92af0d | 2344 | bmov z_flags,ZFL_S, temp,AVR_N |
fa9059af L |
2345 | ret |
2346 | ||
2347 | ;---------------------------------------------------------------- | |
2348 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2349 | ;---------------------------------------------------------------- | |
2350 | ;|NEG |***V1*|Negate A |A=0-A | | |
2351 | ||
2352 | ; | |
4c92af0d | 2353 | do_op_NEG: |
fa9059af L |
2354 | ldi temp,0 |
2355 | sub temp,z_a | |
2356 | mov z_a,temp | |
2357 | in temp,sreg | |
2358 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,P | |
2359 | bmov z_flags,ZFL_C, temp,AVR_C | |
2360 | bmov z_flags,ZFL_H, temp,AVR_H | |
2361 | do_z80_flags_V | |
2362 | do_z80_flags_set_N | |
2363 | ret | |
2364 | ||
2365 | ;---------------------------------------------------------------- | |
2366 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2367 | ;---------------------------------------------------------------- | |
2368 | ;|RETI |------|Return from Interrupt|PC=[SP]+ | | |
2369 | ;|RETN |------|Return from NMI | Copy IFF2 to IFF1 | | |
2370 | ||
2371 | ||
4c92af0d L |
2372 | do_op_RETI: |
2373 | do_op_RETN: | |
e7a0f403 | 2374 | ldd temp,y+oz_istat |
4c92af0d | 2375 | bmov temp,IFF1, temp,IFF2 |
e7a0f403 | 2376 | std y+oz_istat,temp |
fa9059af L |
2377 | ljmp do_store_ret |
2378 | ||
2379 | ||
2380 | ;---------------------------------------------------------------- | |
2381 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2382 | ;---------------------------------------------------------------- | |
2383 | ;|IM n |------|Interrupt Mode | (n=0,1,2)| | |
2384 | ||
4c92af0d | 2385 | do_op_IM0: |
e7a0f403 | 2386 | ldd temp,y+oz_istat |
4c92af0d | 2387 | andi temp, ~IM_MASK |
e7a0f403 | 2388 | std y+oz_istat,temp |
4c92af0d L |
2389 | ret |
2390 | ||
2391 | do_op_IM1: | |
e7a0f403 | 2392 | ldd temp,y+oz_istat |
4c92af0d L |
2393 | andi temp,~IM_MASK |
2394 | ori temp,IM1 | |
e7a0f403 | 2395 | std y+oz_istat,temp |
4c92af0d L |
2396 | ret |
2397 | ||
2398 | do_op_IM2: | |
e7a0f403 | 2399 | ldd temp,y+oz_istat |
4c92af0d L |
2400 | andi temp, ~IM_MASK |
2401 | ori temp,IM2 | |
e7a0f403 | 2402 | std y+oz_istat,temp |
fa9059af L |
2403 | ret |
2404 | ||
2405 | ;---------------------------------------------------------------- | |
2406 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2407 | ;---------------------------------------------------------------- | |
2408 | ;|LD A,i |**0*0-|Load |(i=I,R) IFF2 --> P | | |
2409 | ;|LD i,A |------|Load |(i=I,R) | | |
2410 | ||
2411 | do_op_ldai: | |
e7a0f403 | 2412 | ldd z_a,y+oz_i |
fa9059af L |
2413 | rjmp op_ldar1 |
2414 | ||
2415 | do_op_ldar: | |
e7a0f403 | 2416 | ldd z_a,y+oz_r |
fa9059af L |
2417 | op_ldar1: |
2418 | bst z_flags,ZFL_C ;save C | |
2419 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,H,P,N | |
2420 | bld z_flags,ZFL_C ; | |
e7a0f403 | 2421 | ldd temp,y+oz_istat |
4c92af0d | 2422 | bmov z_flags,ZFL_P, temp,IFF2 |
fa9059af L |
2423 | ret |
2424 | ||
2425 | do_op_ldia: | |
e7a0f403 | 2426 | std y+oz_i,z_a |
fa9059af L |
2427 | ret |
2428 | ||
2429 | do_op_ldra: | |
e7a0f403 | 2430 | std y+oz_r,z_a |
fa9059af L |
2431 | ret |
2432 | ||
2433 | ;---------------------------------------------------------------- | |
2434 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2435 | ;---------------------------------------------------------------- | |
2436 | ;|RLD |**0P0-|Rotate Left 4 bits |{A,[HL]}={A,[HL]}<- ##| | |
2437 | ;|RRD |**0P0-|Rotate Right 4 bits |{A,[HL]}=->{A,[HL]} ##| | |
2438 | ||
2439 | do_op_rld: | |
2440 | swap opl | |
2441 | mov oph,opl | |
2442 | andi opl,0xf0 | |
2443 | andi oph,0x0f | |
2444 | mov temp,z_a | |
2445 | andi temp,0x0f | |
2446 | or opl,temp | |
2447 | mov temp,z_a | |
2448 | andi temp,0xf0 | |
2449 | or temp,oph | |
2450 | mov z_a,temp | |
2451 | bst z_flags,ZFL_C ;save C | |
2452 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,H,P,N | |
2453 | bld z_flags,ZFL_C ; | |
2454 | ret | |
2455 | ||
2456 | do_op_rrd: | |
2457 | mov oph,opl | |
2458 | andi opl,0xf0 | |
2459 | andi oph,0x0f | |
2460 | mov temp,z_a | |
2461 | andi temp,0x0f | |
2462 | or opl,temp | |
2463 | swap opl | |
2464 | mov temp,z_a | |
2465 | andi temp,0xf0 | |
2466 | or temp,oph | |
2467 | mov z_a,temp | |
2468 | bst z_flags,ZFL_C ;save C | |
2469 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,H,P,N | |
2470 | bld z_flags,ZFL_C ; | |
2471 | ret | |
2472 | ||
80e1fa71 L |
2473 | |
2474 | do_fetch_xh: | |
2475 | sbis flags,prefixfd | |
e7a0f403 | 2476 | ldd opl,y+oz_xh |
80e1fa71 | 2477 | sbic flags,prefixfd |
e7a0f403 | 2478 | ldd opl,y+oz_yh |
80e1fa71 L |
2479 | ret |
2480 | ||
2481 | do_fetch_xl: | |
2482 | sbis flags,prefixfd | |
e7a0f403 | 2483 | ldd opl,y+oz_xl |
80e1fa71 | 2484 | sbic flags,prefixfd |
e7a0f403 | 2485 | ldd opl,y+oz_yl |
80e1fa71 L |
2486 | ret |
2487 | ||
2488 | ||
2489 | do_fetch_mxx: | |
2490 | sbic flags,prefixfd | |
2491 | rjmp fetchmxx_fd | |
e7a0f403 L |
2492 | ldd xh,y+oz_xh |
2493 | ldd xl,y+oz_xl | |
80e1fa71 L |
2494 | rjmp fetchmxx1 |
2495 | fetchmxx_fd: | |
e7a0f403 L |
2496 | ldd xh,y+oz_yh |
2497 | ldd xl,y+oz_yl | |
80e1fa71 L |
2498 | fetchmxx1: |
2499 | mem_read_ds opl, z_pc ;get displacement | |
2500 | adiw z_pcl,1 | |
2501 | clr oph ;sign extend | |
2502 | tst opl | |
2503 | brpl fetchmxx2 | |
2504 | com oph | |
2505 | fetchmxx2: | |
2506 | add xl,opl ;add displacement | |
2507 | adc xh,oph | |
e7a0f403 | 2508 | mem_read_d opl ;get operand |
80e1fa71 L |
2509 | ret |
2510 | ||
2511 | ||
fa9059af | 2512 | do_fetch_xx: |
80e1fa71 L |
2513 | sbic flags,prefixfd |
2514 | rjmp fetchxx_fd | |
e7a0f403 L |
2515 | ldd opl,y+oz_xl |
2516 | ldd oph,y+oz_xh | |
80e1fa71 L |
2517 | ret |
2518 | fetchxx_fd: | |
e7a0f403 L |
2519 | ldd opl,y+oz_yl |
2520 | ldd oph,y+oz_yh | |
fa9059af L |
2521 | ret |
2522 | ||
80e1fa71 L |
2523 | do_store_xh: |
2524 | sbis flags,prefixfd | |
e7a0f403 | 2525 | std y+oz_xh,opl |
80e1fa71 | 2526 | sbic flags,prefixfd |
e7a0f403 | 2527 | std y+oz_yh,opl |
80e1fa71 L |
2528 | ret |
2529 | ||
2530 | do_store_xl: | |
2531 | sbis flags,prefixfd | |
e7a0f403 | 2532 | std y+oz_xl,opl |
80e1fa71 | 2533 | sbic flags,prefixfd |
e7a0f403 | 2534 | std y+oz_yl,opl |
80e1fa71 L |
2535 | ret |
2536 | ||
80e1fa71 L |
2537 | do_store_mxx: |
2538 | sbic flags,prefixfd | |
2539 | rjmp storemxx_fd | |
e7a0f403 L |
2540 | ldd xh,y+oz_xh |
2541 | ldd xl,y+oz_xl | |
80e1fa71 L |
2542 | rjmp storemxx1 |
2543 | storemxx_fd: | |
e7a0f403 L |
2544 | ldd xh,y+oz_yh |
2545 | ldd xl,y+oz_yl | |
80e1fa71 L |
2546 | storemxx1: |
2547 | mem_read_s z_pc ;get displacement | |
2548 | adiw z_pcl,1 | |
2549 | clr temp2 ;sign extend | |
2550 | tst temp | |
2551 | brpl storemxx2 | |
2552 | com temp2 | |
2553 | storemxx2: | |
2554 | add xl,temp ;add displacement | |
2555 | adc xh,temp2 | |
e7a0f403 | 2556 | mem_write_s opl ;store operand |
80e1fa71 L |
2557 | ret |
2558 | ||
8fec4e62 L |
2559 | do_store_mxx_2: |
2560 | sbic flags,prefixfd | |
2561 | rjmp storemxx2_fd | |
2562 | ldd xh,y+oz_xh | |
2563 | ldd xl,y+oz_xl | |
2564 | rjmp storemxx21 | |
2565 | storemxx2_fd: | |
2566 | ldd xh,y+oz_yh | |
2567 | ldd xl,y+oz_yl | |
2568 | storemxx21: | |
2569 | mem_read_s z_pc ;get displacement | |
2570 | adiw z_pcl,1 | |
2571 | adiw z_pcl,1 | |
2572 | clr temp2 ;sign extend | |
2573 | tst temp | |
2574 | brpl storemxx22 | |
2575 | com temp2 | |
2576 | storemxx22: | |
2577 | add xl,temp ;add displacement | |
2578 | adc xh,temp2 | |
2579 | mem_write_s opl ;store operand | |
2580 | ret | |
2581 | ||
80e1fa71 L |
2582 | do_store_xx: |
2583 | sbic flags,prefixfd | |
2584 | rjmp storexx_fd | |
e7a0f403 L |
2585 | std y+oz_xl,opl |
2586 | std y+oz_xh,oph | |
80e1fa71 L |
2587 | ret |
2588 | storexx_fd: | |
e7a0f403 L |
2589 | std y+oz_yl,opl |
2590 | std y+oz_yh,oph | |
80e1fa71 L |
2591 | ret |
2592 | ||
fa9059af L |
2593 | ;---------------------------------------------------------------- |
2594 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2595 | ;---------------------------------------------------------------- | |
80e1fa71 L |
2596 | ;|LD dst,src|------|Load |dst=src | |
2597 | ; | |
2598 | ; | |
2599 | do_op_stxx: ;store xx to mem loc in opl:h | |
2600 | ||
2601 | movw xl,opl | |
2602 | sbis flags,prefixfd | |
e7a0f403 | 2603 | ldd temp,y+oz_xl |
80e1fa71 | 2604 | sbic flags,prefixfd |
e7a0f403 | 2605 | ldd temp,y+oz_yl |
80e1fa71 L |
2606 | mem_write |
2607 | adiw xl,1 | |
2608 | sbis flags,prefixfd | |
e7a0f403 | 2609 | ldd temp,y+oz_xh |
80e1fa71 | 2610 | sbic flags,prefixfd |
e7a0f403 | 2611 | ldd temp,y+oz_yh |
80e1fa71 L |
2612 | mem_write |
2613 | ret | |
2614 | ||
2615 | ||
2616 | ;---------------------------------------------------------------- | |
2617 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2618 | ;---------------------------------------------------------------- | |
2619 | ;|EX [SP],IX|------|Exchange |[SP]<->IX | | |
2620 | ;|EX [SP],IY|------|Exchange |[SP]<->IY | | |
2621 | ; | |
2622 | do_op_EXxx: | |
2623 | sbic flags,prefixfd | |
2624 | rjmp opexxx_fd | |
e7a0f403 L |
2625 | ldd temp,y+oz_xl |
2626 | ldd temp2,y+oz_xh | |
2627 | std y+oz_xl,opl | |
2628 | std y+oz_xh,oph | |
80e1fa71 L |
2629 | rjmp opexxxe |
2630 | opexxx_fd: | |
e7a0f403 L |
2631 | ldd temp,y+oz_yl |
2632 | ldd temp2,y+oz_yh | |
2633 | std y+oz_yl,opl | |
2634 | std y+oz_yh,oph | |
80e1fa71 L |
2635 | opexxxe: |
2636 | movw opl,temp | |
2637 | ret | |
2638 | ||
2639 | ;---------------------------------------------------------------- | |
2640 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2641 | ;---------------------------------------------------------------- | |
2642 | ;|ADD IX,pp |--*-0*|Add |IX=IX+pp | | |
2643 | ;|ADD IY,rr |--*-0*|Add |IY=IY+rr | | |
fa9059af L |
2644 | ; |
2645 | ; | |
2646 | do_op_addxx: | |
80e1fa71 L |
2647 | sbic flags,prefixfd |
2648 | rjmp opadx_fd | |
e7a0f403 L |
2649 | ldd temp,y+oz_xl |
2650 | ldd temp2,y+oz_xh | |
2651 | add opl,temp | |
2652 | adc oph,temp2 | |
2653 | std y+oz_xl,opl | |
2654 | std y+oz_xh,oph | |
80e1fa71 L |
2655 | rjmp opadx_e |
2656 | opadx_fd: | |
e7a0f403 L |
2657 | ldd temp,y+oz_yl |
2658 | ldd temp2,y+oz_yh | |
2659 | add opl,temp | |
2660 | adc oph,temp2 | |
2661 | std y+oz_yl,opl | |
2662 | std y+oz_yh,oph | |
80e1fa71 | 2663 | opadx_e: |
e7a0f403 | 2664 | in temp,sreg |
80e1fa71 L |
2665 | bmov z_flags,ZFL_C, temp,AVR_C |
2666 | do_z80_flags_H | |
fa9059af L |
2667 | do_z80_flags_clear_N |
2668 | ret | |
2669 | ||
80e1fa71 L |
2670 | ;---------------------------------------------------------------- |
2671 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2672 | ;---------------------------------------------------------------- | |
2673 | ;|LDD |--0*0-|Load and Decrement |[DE]=[HL],HL=HL-1,# | | |
2674 | ;|LDDR |--000-|Load, Dec., Repeat |LDD till BC=0 | | |
2675 | ;|LDI |--0*0-|Load and Increment |[DE]=[HL],HL=HL+1,# | | |
2676 | ;|LDIR |--000-|Load, Inc., Repeat |LDI till BC=0 | | |
2677 | ; | |
2678 | ||
2217c855 | 2679 | op_LDxx_common: |
e7a0f403 L |
2680 | ldd zh,y+oz_h ;H |
2681 | ldd zl,y+oz_l ;L | |
e7a0f403 L |
2682 | ldd xh,y+oz_d ;D |
2683 | ldd xl,y+oz_e ;E | |
e7a0f403 L |
2684 | ldd oph,y+oz_b ;B |
2685 | ldd opl,y+oz_c ;C | |
e7a0f403 | 2686 | mem_read_ds temp, z |
e7a0f403 | 2687 | mem_write_ds x, temp |
e7a0f403 L |
2688 | cbr z_flags,(1<<ZFL_H) | (1<<ZFL_P) | (1<<ZFL_N) |
2689 | subi opl,1 | |
2690 | sbci oph,0 | |
2691 | breq PC+2 | |
2692 | sbr z_flags,(1<<ZFL_P) | |
e7a0f403 L |
2693 | std y+oz_c,opl ;C |
2694 | std y+oz_b,oph ;B | |
2695 | ret | |
2696 | ||
2217c855 L |
2697 | do_op_LDI: |
2698 | rcall op_LDxx_common | |
e7a0f403 | 2699 | adiw z,1 |
e7a0f403 | 2700 | adiw x,1 |
2217c855 L |
2701 | std y+oz_e,xl ;E |
2702 | std y+oz_d,xh ;D | |
e7a0f403 L |
2703 | std y+oz_l,zl ;L |
2704 | std y+oz_h,zh ;H | |
2217c855 L |
2705 | ret |
2706 | ||
2707 | do_op_LDD: | |
2708 | rcall op_LDxx_common | |
2709 | sbiw z,1 | |
2710 | sbiw x,1 | |
e7a0f403 L |
2711 | std y+oz_e,xl ;E |
2712 | std y+oz_d,xh ;D | |
2217c855 L |
2713 | std y+oz_l,zl ;L |
2714 | std y+oz_h,zh ;H | |
2715 | ret | |
2716 | ||
2717 | do_op_LDIR: | |
2718 | rcall do_op_LDI | |
2719 | sbrs z_flags,ZFL_P | |
2720 | ret | |
2721 | sbiw z_pcl,2 | |
2722 | ret | |
2723 | ||
2724 | do_op_LDDR: | |
2725 | rcall do_op_LDD | |
2726 | sbrs z_flags,ZFL_P | |
2727 | ret | |
2728 | sbiw z_pcl,2 | |
e7a0f403 L |
2729 | ret |
2730 | ||
2731 | ;---------------------------------------------------------------- | |
2732 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2733 | ;---------------------------------------------------------------- | |
2734 | ;|CPD |****1-|Compare and Decrement|A-[HL],HL=HL-1,BC=BC-1| | |
2735 | ;|CPDR |****1-|Compare, Dec., Repeat|CPD till A=[HL]or BC=0| | |
2736 | ;|CPI |****1-|Compare and Increment|A-[HL],HL=HL+1,BC=BC-1| | |
2737 | ;|CPIR |****1-|Compare, Inc., Repeat|CPI till A=[HL]or BC=0| | |
2738 | ||
2739 | ||
2217c855 L |
2740 | op_CPxx_common: |
2741 | ldd xh,y+oz_h ; H | |
2742 | ldd xl,y+oz_l ; L | |
2743 | ldd zh,y+oz_b ; B | |
2744 | ldd zl,y+oz_c ; C | |
2745 | ||
2746 | cbr z_flags,(1<<ZFL_S)|(1<<ZFL_Z)|(1<<ZFL_H)|(1<<ZFL_P) | |
2747 | sbr z_flags,(1<<ZFL_N) | |
2748 | mem_read ; temp = (HL) | |
2749 | mov temp2,z_a | |
2750 | sub temp2,temp ; A - (HL) | |
2751 | brpl PC+2 | |
2752 | sbr z_flags,(1<<ZFL_S) | |
2753 | brne PC+2 | |
2754 | sbr z_flags,(1<<ZFL_Z) | |
2755 | brhc PC+2 | |
2756 | sbr z_flags,(1<<ZFL_H) | |
2757 | ||
2758 | sbiw z,1 ; BC-- | |
e7a0f403 L |
2759 | breq PC+2 |
2760 | sbr z_flags,(1<<ZFL_P) | |
2217c855 L |
2761 | std y+oz_c,zl ; C |
2762 | std y+oz_b,zh ; B | |
2763 | ret | |
2764 | ||
2765 | do_op_CPI: | |
2766 | rcall op_CPxx_common | |
2767 | adiw x,1 ; HL++ | |
2768 | std y+oz_l,xl ; L | |
2769 | std y+oz_h,xh ; H | |
e7a0f403 L |
2770 | ret |
2771 | ||
2217c855 | 2772 | |
e7a0f403 | 2773 | do_op_CPD: |
2217c855 L |
2774 | rcall op_CPxx_common |
2775 | sbiw x,1 ; HL-- | |
2776 | std y+oz_l,xl ; L | |
2777 | std y+oz_h,xh ; H | |
e7a0f403 L |
2778 | ret |
2779 | ||
2780 | do_op_CPIR: | |
2781 | rcall do_op_CPI | |
2782 | sbrc z_flags,ZFL_Z | |
2783 | ret | |
2784 | sbrs z_flags,ZFL_P | |
2785 | ret | |
2786 | sbiw z_pcl,2 | |
2787 | ret | |
2788 | ||
2789 | do_op_CPDR: | |
2790 | rcall do_op_CPD | |
2791 | sbrc z_flags,ZFL_Z | |
2792 | ret | |
2793 | sbrs z_flags,ZFL_P | |
2794 | ret | |
2795 | sbiw z_pcl,2 | |
2796 | ret | |
2797 | ||
2798 | ||
8fec4e62 L |
2799 | ;---------------------------------------------------------------- |
2800 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2801 | ;---------------------------------------------------------------- | |
2802 | ;|RLC m |**0P0*|Rotate Left Circular |m=m<- | | |
2803 | ;|RRC m |**0P0*|Rotate Right Circular|m=->m | | |
2804 | ;|RL m |**0P0*|Rotate Left |m={CY,m}<- | | |
2805 | ;|RR m |**0P0*|Rotate Right |m=->{CY,m} | | |
2806 | ;|SLA m |**0P0*|Shift Left Arithmetic|m=m*2 | | |
2807 | ;|SRA m |**0P0*|Shift Right Arith. |m=m/2 | | |
2808 | ;|SLL m |**0P0*|Shift Right Logical | | |
2809 | ;|SRL m |**0P0*|Shift Right Logical |m=->{0,m,CY} | | |
2810 | ||
2811 | ||
2812 | do_op_rlc: | |
2813 | ;Rotate Left Cyclical. All bits move 1 to the | |
2814 | ;left, the msb becomes c and lsb. | |
2815 | clr temp | |
2816 | lsl opl | |
2817 | adc temp,_0 | |
2818 | or opl,temp | |
2819 | ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N | |
2820 | or z_flags,temp | |
2821 | ret | |
2822 | ||
2823 | do_op_rrc: | |
2824 | ;Rotate Right Cyclical. All bits move 1 to the | |
2825 | ;right, the lsb becomes c and msb. | |
2826 | lsr opl | |
2827 | brcc PC+2 | |
2828 | ori opl,0x80 | |
2829 | ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N | |
2830 | bmov z_flags,ZFL_C, opl,7 | |
2831 | ret | |
2832 | ||
2833 | ||
2834 | do_op_rl: | |
2835 | ;Rotate Left. All bits move 1 to the left, the msb | |
2836 | ;becomes c, c becomes lsb. | |
2837 | clc | |
2838 | sbrc z_flags,ZFL_C | |
2839 | sec | |
2840 | rol opl | |
2841 | in temp,sreg | |
2842 | ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N | |
2843 | bmov z_flags,ZFL_C, temp,AVR_C | |
2844 | ret | |
2845 | ||
2846 | ||
2847 | do_op_rr: | |
2848 | ;Rotate Right. All bits move 1 to the right, the lsb | |
2849 | ;becomes c, c becomes msb. | |
2850 | ||
2851 | ror opl | |
2852 | in temp,sreg ;CY | |
2853 | bmov opl,7, z_flags,ZFL_C ;old CY --> Bit 7 | |
2854 | ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N | |
2855 | bmov z_flags,ZFL_C, temp,AVR_C ; | |
2856 | ret | |
2857 | ||
2858 | do_op_sla: | |
2859 | lsl opl | |
2860 | in temp,sreg | |
2861 | ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N | |
2862 | bmov z_flags,ZFL_C, temp,AVR_C ; | |
2863 | ret | |
2864 | ||
2865 | do_op_sra: | |
2866 | lsr opl | |
2867 | in temp,sreg | |
2868 | bmov opl,7, opl,6 ;old CY --> Bit 7 | |
2869 | ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N | |
2870 | bmov z_flags,ZFL_C, temp,AVR_C ; | |
2871 | ret | |
2872 | ||
2873 | do_op_sll: | |
2874 | sec | |
2875 | rol opl | |
2876 | in temp,sreg | |
2877 | ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N | |
2878 | bmov z_flags,ZFL_C, temp,AVR_C ; | |
2879 | ret | |
2880 | ||
2881 | do_op_srl: | |
2882 | lsr opl | |
2883 | in temp,sreg | |
2884 | ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N | |
2885 | bmov z_flags,ZFL_C, temp,AVR_C ; | |
2886 | ret | |
2887 | ||
e7a0f403 L |
2888 | ;---------------------------------------------------------------- |
2889 | ;|Mnemonic |SZHPNC|Description |Notes | | |
2890 | ;---------------------------------------------------------------- | |
2891 | ;|BIT b,m |?*1?0-|Test Bit |m&{2^b} | | |
2892 | ;|RES b,m |------|Reset bit |m=m&{~2^b} | | |
2893 | ;|SET b,m |------|Set bit |m=mv{2^b} | | |
2894 | ||
fa9059af | 2895 | |
4c92af0d | 2896 | do_op_BIT7: |
e7a0f403 | 2897 | ldi temp,0x80 |
4c92af0d L |
2898 | rjmp opbit |
2899 | do_op_BIT6: | |
e7a0f403 | 2900 | ldi temp,0x40 |
4c92af0d L |
2901 | rjmp opbit |
2902 | do_op_BIT5: | |
e7a0f403 | 2903 | ldi temp,0x20 |
4c92af0d L |
2904 | rjmp opbit |
2905 | do_op_BIT4: | |
e7a0f403 | 2906 | ldi temp,0x10 |
4c92af0d L |
2907 | rjmp opbit |
2908 | do_op_BIT3: | |
e7a0f403 | 2909 | ldi temp,0x08 |
4c92af0d L |
2910 | rjmp opbit |
2911 | do_op_BIT2: | |
e7a0f403 | 2912 | ldi temp,0x04 |
4c92af0d L |
2913 | rjmp opbit |
2914 | do_op_BIT1: | |
e7a0f403 | 2915 | ldi temp,0x02 |
4c92af0d L |
2916 | rjmp opbit |
2917 | do_op_BIT0: | |
e7a0f403 | 2918 | ldi temp,0x01 |
4c92af0d | 2919 | opbit: |
e7a0f403 | 2920 | and temp,opl |
4c92af0d L |
2921 | in temp,sreg |
2922 | ori z_flags,(1<<ZFL_H) | |
8fec4e62 | 2923 | andi z_flags,~(1<<ZFL_N) |
4c92af0d L |
2924 | bmov z_flags,ZFL_Z, temp,AVR_Z |
2925 | ret | |
2926 | ||
e7a0f403 L |
2927 | |
2928 | .macro m_do_op_RES7 | |
4c92af0d | 2929 | andi opl,~0x80 |
e7a0f403 L |
2930 | .endm |
2931 | .equ do_op_RES7 = 0 | |
2932 | ; andi opl,~0x80 | |
2933 | ; ret | |
2934 | ||
2935 | .macro m_do_op_RES6 | |
4c92af0d | 2936 | andi opl,~0x40 |
e7a0f403 L |
2937 | .endm |
2938 | .equ do_op_RES6 = 0 | |
2939 | ; andi opl,~0x40 | |
2940 | ; ret | |
2941 | ||
2942 | .macro m_do_op_RES5 | |
4c92af0d | 2943 | andi opl,~0x20 |
e7a0f403 L |
2944 | .endm |
2945 | .equ do_op_RES5 = 0 | |
2946 | ; andi opl,~0x20 | |
2947 | ; ret | |
2948 | ||
2949 | .macro m_do_op_RES4 | |
4c92af0d | 2950 | andi opl,~0x10 |
e7a0f403 L |
2951 | .endm |
2952 | .equ do_op_RES4 = 0 | |
2953 | ; andi opl,~0x10 | |
2954 | ; ret | |
2955 | ||
2956 | .macro m_do_op_RES3 | |
4c92af0d | 2957 | andi opl,~0x08 |
e7a0f403 L |
2958 | .endm |
2959 | .equ do_op_RES3 = 0 | |
2960 | ; andi opl,~0x08 | |
2961 | ; ret | |
2962 | ||
2963 | .macro m_do_op_RES2 | |
4c92af0d | 2964 | andi opl,~0x04 |
e7a0f403 L |
2965 | .endm |
2966 | .equ do_op_RES2 = 0 | |
2967 | ; andi opl,~0x04 | |
2968 | ; ret | |
2969 | ||
2970 | .macro m_do_op_RES1 | |
4c92af0d | 2971 | andi opl,~0x02 |
e7a0f403 L |
2972 | .endm |
2973 | .equ do_op_RES1 = 0 | |
2974 | ; andi opl,~0x02 | |
2975 | ; ret | |
2976 | ||
2977 | .macro m_do_op_RES0 | |
4c92af0d | 2978 | andi opl,~0x01 |
e7a0f403 L |
2979 | .endm |
2980 | .equ do_op_RES0 = 0 | |
2981 | ; andi opl,~0x01 | |
2982 | ; ret | |
4c92af0d | 2983 | |
e7a0f403 | 2984 | .macro m_do_op_SET7 |
4c92af0d | 2985 | ori opl,0x80 |
e7a0f403 L |
2986 | .endm |
2987 | .equ do_op_SET7 = 0 | |
2988 | ; ori opl,0x80 | |
2989 | ; ret | |
2990 | ||
2991 | .macro m_do_op_SET6 | |
4c92af0d | 2992 | ori opl,0x40 |
e7a0f403 L |
2993 | .endm |
2994 | .equ do_op_SET6 = 0 | |
2995 | ; ori opl,0x40 | |
2996 | ; ret | |
2997 | ||
2998 | .macro m_do_op_SET5 | |
4c92af0d | 2999 | ori opl,0x20 |
e7a0f403 L |
3000 | .endm |
3001 | .equ do_op_SET5 = 0 | |
3002 | ; ori opl,0x20 | |
3003 | ; ret | |
3004 | ||
3005 | .macro m_do_op_SET4 | |
4c92af0d | 3006 | ori opl,0x10 |
e7a0f403 L |
3007 | .endm |
3008 | .equ do_op_SET4 = 0 | |
3009 | ; ori opl,0x10 | |
3010 | ; ret | |
3011 | ||
3012 | .macro m_do_op_SET3 | |
4c92af0d | 3013 | ori opl,0x08 |
e7a0f403 L |
3014 | .endm |
3015 | .equ do_op_SET3 = 0 | |
3016 | ; ori opl,0x08 | |
3017 | ; ret | |
3018 | ||
3019 | .macro m_do_op_SET2 | |
4c92af0d | 3020 | ori opl,0x04 |
e7a0f403 L |
3021 | .endm |
3022 | .equ do_op_SET2 = 0 | |
3023 | ; ori opl,0x04 | |
3024 | ; ret | |
3025 | ||
3026 | .macro m_do_op_SET1 | |
4c92af0d | 3027 | ori opl,0x02 |
e7a0f403 L |
3028 | .endm |
3029 | .equ do_op_SET1 = 0 | |
3030 | ; ori opl,0x02 | |
3031 | ; ret | |
4c92af0d | 3032 | |
e7a0f403 L |
3033 | .macro m_do_op_SET0 |
3034 | ori opl,0x01 | |
3035 | .endm | |
3036 | .equ do_op_SET0 = 0 | |
3037 | ; ori opl,0x01 | |
3038 | ; ret | |
4c92af0d | 3039 | |
fa9059af L |
3040 | |
3041 | opctable EDjmp | |
3042 | ||
3043 | instr fetch_nop, op_nop, store_nop ;00 ;NOP | |
3044 | instr fetch_nop, op_nop, store_nop ;01 ;NOP | |
3045 | instr fetch_nop, op_nop, store_nop ;02 ;NOP | |
3046 | instr fetch_nop, op_nop, store_nop ;03 ;NOP | |
3047 | instr fetch_nop, op_nop, store_nop ;04 ;NOP | |
3048 | instr fetch_nop, op_nop, store_nop ;05 ;NOP | |
3049 | instr fetch_nop, op_nop, store_nop ;06 ;NOP | |
3050 | instr fetch_nop, op_nop, store_nop ;07 ;NOP | |
3051 | instr fetch_nop, op_nop, store_nop ;08 ;NOP | |
3052 | instr fetch_nop, op_nop, store_nop ;09 ;NOP | |
3053 | instr fetch_nop, op_nop, store_nop ;0A ;NOP | |
3054 | instr fetch_nop, op_nop, store_nop ;0B ;NOP | |
3055 | instr fetch_nop, op_nop, store_nop ;0C ;NOP | |
3056 | instr fetch_nop, op_nop, store_nop ;0D ;NOP | |
3057 | instr fetch_nop, op_nop, store_nop ;0E ;NOP | |
3058 | instr fetch_nop, op_nop, store_nop ;0F ;NOP | |
3059 | instr fetch_nop, op_nop, store_nop ;10 ;NOP | |
3060 | instr fetch_nop, op_nop, store_nop ;11 ;NOP | |
3061 | instr fetch_nop, op_nop, store_nop ;12 ;NOP | |
3062 | instr fetch_nop, op_nop, store_nop ;13 ;NOP | |
3063 | instr fetch_nop, op_nop, store_nop ;14 ;NOP | |
3064 | instr fetch_nop, op_nop, store_nop ;15 ;NOP | |
3065 | instr fetch_nop, op_nop, store_nop ;16 ;NOP | |
3066 | instr fetch_nop, op_nop, store_nop ;17 ;NOP | |
3067 | instr fetch_nop, op_nop, store_nop ;18 ;NOP | |
3068 | instr fetch_nop, op_nop, store_nop ;19 ;NOP | |
3069 | instr fetch_nop, op_nop, store_nop ;1A ;NOP | |
3070 | instr fetch_nop, op_nop, store_nop ;1B ;NOP | |
3071 | instr fetch_nop, op_nop, store_nop ;1C ;NOP | |
3072 | instr fetch_nop, op_nop, store_nop ;1D ;NOP | |
3073 | instr fetch_nop, op_nop, store_nop ;1E ;NOP | |
3074 | instr fetch_nop, op_nop, store_nop ;1F ;NOP | |
3075 | instr fetch_nop, op_nop, store_nop ;20 ;NOP | |
3076 | instr fetch_nop, op_nop, store_nop ;21 ;NOP | |
3077 | instr fetch_nop, op_nop, store_nop ;22 ;NOP | |
3078 | instr fetch_nop, op_nop, store_nop ;23 ;NOP | |
3079 | instr fetch_nop, op_nop, store_nop ;24 ;NOP | |
3080 | instr fetch_nop, op_nop, store_nop ;25 ;NOP | |
3081 | instr fetch_nop, op_nop, store_nop ;26 ;NOP | |
3082 | instr fetch_nop, op_nop, store_nop ;27 ;NOP | |
3083 | instr fetch_nop, op_nop, store_nop ;28 ;NOP | |
3084 | instr fetch_nop, op_nop, store_nop ;29 ;NOP | |
3085 | instr fetch_nop, op_nop, store_nop ;2A ;NOP | |
3086 | instr fetch_nop, op_nop, store_nop ;2B ;NOP | |
3087 | instr fetch_nop, op_nop, store_nop ;2C ;NOP | |
3088 | instr fetch_nop, op_nop, store_nop ;2D ;NOP | |
3089 | instr fetch_nop, op_nop, store_nop ;2E ;NOP | |
3090 | instr fetch_nop, op_nop, store_nop ;2F ;NOP | |
3091 | instr fetch_nop, op_nop, store_nop ;30 ;NOP | |
3092 | instr fetch_nop, op_nop, store_nop ;31 ;NOP | |
3093 | instr fetch_nop, op_nop, store_nop ;32 ;NOP | |
3094 | instr fetch_nop, op_nop, store_nop ;33 ;NOP | |
3095 | instr fetch_nop, op_nop, store_nop ;34 ;NOP | |
3096 | instr fetch_nop, op_nop, store_nop ;35 ;NOP | |
3097 | instr fetch_nop, op_nop, store_nop ;36 ;NOP | |
3098 | instr fetch_nop, op_nop, store_nop ;37 ;NOP | |
3099 | instr fetch_nop, op_nop, store_nop ;38 ;NOP | |
3100 | instr fetch_nop, op_nop, store_nop ;39 ;NOP | |
3101 | instr fetch_nop, op_nop, store_nop ;3A ;NOP | |
3102 | instr fetch_nop, op_nop, store_nop ;3B ;NOP | |
3103 | instr fetch_nop, op_nop, store_nop ;3C ;NOP | |
3104 | instr fetch_nop, op_nop, store_nop ;3D ;NOP | |
3105 | instr fetch_nop, op_nop, store_nop ;3E ;NOP | |
3106 | instr fetch_nop, op_nop, store_nop ;3F ;NOP | |
3107 | instr fetch_C, op_IN, store_B ;40 ;IN B,(C) | |
3108 | instr fetch_B, op_OUT, store_nop ;41 ;OUT (C),B | |
3109 | instr fetch_BC, op_SBCHL, store_nop ;42 ;SBC HL,BC | |
3110 | instr fetch_DIR16, op_STBC, store_nop ;43 ;LD (nn),BC | |
3111 | instr fetch_nop, op_NEG, store_nop ;44 ;NEG | |
8fec4e62 | 3112 | instr fetch_nop, op_RETN, store_nop ;45 ;RETN |
fa9059af L |
3113 | instr fetch_nop, op_IM0, store_nop ;46 ;IM 0 |
3114 | instr fetch_nop, op_ldia, store_nop ;47 ;LD I,A | |
3115 | instr fetch_C, op_IN, store_C ;48 ;IN C,(C) | |
3116 | instr fetch_C, op_OUT, store_nop ;49 ;OUT (C),C | |
3117 | instr fetch_BC, op_ADCHL, store_nop ;4A ;ADC HL,BC | |
3118 | instr fetch_DIR16, op_RMEM16, store_BC ;4B nn nn ;LD BC,(nn) | |
3119 | instr fetch_nop, op_NEG, store_nop ;4C ;NEG | |
8fec4e62 | 3120 | instr fetch_nop, op_RETI, store_nop ;4D ;RETI |
fa9059af L |
3121 | instr fetch_nop, op_IM0, store_nop ;4E ;IM 0 |
3122 | instr fetch_nop, op_ldra, store_nop ;4F ;LD R,A | |
3123 | instr fetch_C, op_IN, store_D ;50 ;IN D,(C) | |
3124 | instr fetch_D, op_OUT, store_nop ;51 ;OUT (C),D | |
3125 | instr fetch_DE, op_SBCHL, store_nop ;52 ;SBC HL,DE | |
3126 | instr fetch_DIR16, op_STDE, store_nop ;53 nn nn ;LD (nn),DE | |
3127 | instr fetch_nop, op_NEG, store_nop ;54 ;NEG | |
8fec4e62 | 3128 | instr fetch_nop, op_RETN, store_nop ;55 ;RETN |
fa9059af L |
3129 | instr fetch_nop, op_IM1, store_nop ;56 ;IM 1 |
3130 | instr fetch_nop, op_ldai, store_nop ;57 ;LD A,I | |
3131 | instr fetch_C, op_IN, store_E ;58 ;IN E,(C) | |
3132 | instr fetch_E, op_OUT, store_nop ;59 ;OUT (C),E | |
3133 | instr fetch_DE, op_ADCHL, store_nop ;5A ;ADC HL,DE | |
3134 | instr fetch_DIR16, op_RMEM16, store_DE ;5B nn nn ;LD DE,(nn) | |
3135 | instr fetch_nop, op_NEG, store_nop ;5C ;NEG | |
8fec4e62 | 3136 | instr fetch_nop, op_RETN, store_nop ;5D ;RETN |
fa9059af L |
3137 | instr fetch_nop, op_IM2, store_nop ;5E ;IM 2 |
3138 | instr fetch_nop, op_ldar, store_nop ;5F ;LD A,R | |
3139 | instr fetch_C, op_IN, store_H ;60 ;IN H,(C) | |
3140 | instr fetch_H, op_OUT, store_nop ;61 ;OUT (C),H | |
3141 | instr fetch_HL, op_SBCHL, store_nop ;62 ;SBC HL,HL | |
3142 | instr fetch_DIR16, op_STHL, store_nop ;63 nn nn ;LD (nn),HL | |
3143 | instr fetch_nop, op_NEG, store_nop ;64 ;NEG | |
8fec4e62 | 3144 | instr fetch_nop, op_RETN, store_nop ;65 ;RETN |
fa9059af L |
3145 | instr fetch_nop, op_IM0, store_nop ;66 ;IM 0 |
3146 | instr fetch_mhl, op_RRD, store_mhl ;67 ;RRD | |
3147 | instr fetch_C, op_IN, store_L ;68 ;IN L,(C) | |
3148 | instr fetch_L, op_OUT, store_nop ;69 ;OUT (C),L | |
3149 | instr fetch_HL, op_ADCHL, store_nop ;6A ;ADC HL,HL | |
3150 | instr fetch_DIR16, op_RMEM16, store_HL ;6B nn nn ;LD HL,(nn) | |
3151 | instr fetch_nop, op_NEG, store_nop ;6C ;NEG | |
8fec4e62 | 3152 | instr fetch_nop, op_RETN, store_nop ;6D ;RETN |
fa9059af L |
3153 | instr fetch_nop, op_IM0, store_nop ;6E ;IM 0 |
3154 | instr fetch_mhl, op_RLD, store_mhl ;6F ;RLD | |
3155 | instr fetch_C, op_IN, store_nop ;70 ;IN (C) | |
3156 | instr fetch_0, op_OUT, store_nop ;71 ;OUT (C),0 | |
3157 | instr fetch_SP, op_SBCHL, store_nop ;72 ;SBC HL,SP | |
3158 | instr fetch_DIR16, op_STSP, store_nop ;73 nn nn ;LD (nn),SP | |
3159 | instr fetch_nop, op_NEG, store_nop ;74 ;NEG | |
8fec4e62 | 3160 | instr fetch_nop, op_RETN, store_nop ;75 ;RETN |
fa9059af L |
3161 | instr fetch_nop, op_IM1, store_nop ;76 ;IM 1 |
3162 | instr fetch_nop, op_nop, store_nop ;77 ;NOP | |
3163 | instr fetch_C, op_IN, store_A ;78 ;IN A,(C) | |
3164 | instr fetch_A, op_OUT, store_nop ;79 ;OUT (C),A | |
3165 | instr fetch_SP, op_ADCHL, store_nop ;7A ;ADC HL,SP | |
3166 | instr fetch_DIR16, op_RMEM16, store_SP ;7B nn nn ;LD SP,(nn) | |
3167 | instr fetch_nop, op_NEG, store_nop ;7C ;NEG | |
8fec4e62 | 3168 | instr fetch_nop, op_RETN, store_nop ;7D ;RETN |
fa9059af L |
3169 | instr fetch_nop, op_IM2, store_nop ;7E ;IM 2 |
3170 | instr fetch_nop, op_nop, store_nop ;7F ;NOP | |
3171 | instr fetch_nop, op_nop, store_nop ;80 ;NOP | |
3172 | instr fetch_nop, op_nop, store_nop ;81 ;NOP | |
3173 | instr fetch_nop, op_nop, store_nop ;82 ;NOP | |
3174 | instr fetch_nop, op_nop, store_nop ;83 ;NOP | |
3175 | instr fetch_nop, op_nop, store_nop ;84 ;NOP | |
3176 | instr fetch_nop, op_nop, store_nop ;85 ;NOP | |
3177 | instr fetch_nop, op_nop, store_nop ;86 ;NOP | |
3178 | instr fetch_nop, op_nop, store_nop ;87 ;NOP | |
3179 | instr fetch_nop, op_nop, store_nop ;88 ;NOP | |
3180 | instr fetch_nop, op_nop, store_nop ;89 ;NOP | |
3181 | instr fetch_nop, op_nop, store_nop ;8A ;NOP | |
3182 | instr fetch_nop, op_nop, store_nop ;8B ;NOP | |
3183 | instr fetch_nop, op_nop, store_nop ;8C ;NOP | |
3184 | instr fetch_nop, op_nop, store_nop ;8D ;NOP | |
3185 | instr fetch_nop, op_nop, store_nop ;8E ;NOP | |
3186 | instr fetch_nop, op_nop, store_nop ;8F ;NOP | |
3187 | instr fetch_nop, op_nop, store_nop ;90 ;NOP | |
3188 | instr fetch_nop, op_nop, store_nop ;91 ;NOP | |
3189 | instr fetch_nop, op_nop, store_nop ;92 ;NOP | |
3190 | instr fetch_nop, op_nop, store_nop ;93 ;NOP | |
3191 | instr fetch_nop, op_nop, store_nop ;94 ;NOP | |
3192 | instr fetch_nop, op_nop, store_nop ;95 ;NOP | |
3193 | instr fetch_nop, op_nop, store_nop ;96 ;NOP | |
3194 | instr fetch_nop, op_nop, store_nop ;97 ;NOP | |
3195 | instr fetch_nop, op_nop, store_nop ;98 ;NOP | |
3196 | instr fetch_nop, op_nop, store_nop ;99 ;NOP | |
3197 | instr fetch_nop, op_nop, store_nop ;9A ;NOP | |
3198 | instr fetch_nop, op_nop, store_nop ;9B ;NOP | |
3199 | instr fetch_nop, op_nop, store_nop ;9C ;NOP | |
3200 | instr fetch_nop, op_nop, store_nop ;9D ;NOP | |
3201 | instr fetch_nop, op_nop, store_nop ;9E ;NOP | |
3202 | instr fetch_nop, op_nop, store_nop ;9F ;NOP | |
e7a0f403 L |
3203 | instr fetch_nop, op_LDI, store_nop ;A0 ;LDI |
3204 | instr fetch_nop, op_CPI, store_nop ;A1 ;CPI | |
3205 | instr fetch_nop, op_nop, store_nop ;A2 ; TODO: | |
fa9059af L |
3206 | instr fetch_nop, op_nop, store_nop ;A3 ; |
3207 | instr fetch_nop, op_nop, store_nop ;A4 ;NOP | |
3208 | instr fetch_nop, op_nop, store_nop ;A5 ;NOP | |
3209 | instr fetch_nop, op_nop, store_nop ;A6 ;NOP | |
3210 | instr fetch_nop, op_nop, store_nop ;A7 ;NOP | |
e7a0f403 L |
3211 | instr fetch_nop, op_LDD, store_nop ;A8 ;LDD |
3212 | instr fetch_nop, op_CPD, store_nop ;A9 ;CPD | |
3213 | instr fetch_nop, op_nop, store_nop ;AA ; TODO: | |
fa9059af L |
3214 | instr fetch_nop, op_nop, store_nop ;AB ; |
3215 | instr fetch_nop, op_nop, store_nop ;AC ;NOP | |
3216 | instr fetch_nop, op_nop, store_nop ;AD ;NOP | |
3217 | instr fetch_nop, op_nop, store_nop ;AE ;NOP | |
3218 | instr fetch_nop, op_nop, store_nop ;AF ;NOP | |
e7a0f403 L |
3219 | instr fetch_nop, op_LDIR, store_nop ;B0 ;LDIR |
3220 | instr fetch_nop, op_CPIR, store_nop ;B1 ;CPIR | |
fa9059af | 3221 | instr fetch_nop, op_nop, store_nop ;B2 ; |
8fec4e62 | 3222 | instr fetch_nop, op_nop, store_nop ;B3 ; TODO: |
fa9059af L |
3223 | instr fetch_nop, op_nop, store_nop ;B4 ;NOP |
3224 | instr fetch_nop, op_nop, store_nop ;B5 ;NOP | |
3225 | instr fetch_nop, op_nop, store_nop ;B6 ;NOP | |
3226 | instr fetch_nop, op_nop, store_nop ;B7 ;NOP | |
80e1fa71 | 3227 | instr fetch_nop, op_LDDR, store_nop ;B8 ;LDDR |
e7a0f403 | 3228 | instr fetch_nop, op_CPDR, store_nop ;B9 ;CPDR |
fa9059af L |
3229 | instr fetch_nop, op_nop, store_nop ;BA ; |
3230 | instr fetch_nop, op_nop, store_nop ;BB ; TODO: | |
3231 | instr fetch_nop, op_nop, store_nop ;BC ;NOP | |
3232 | instr fetch_nop, op_nop, store_nop ;BD ;NOP | |
3233 | instr fetch_nop, op_nop, store_nop ;BE ;NOP | |
3234 | instr fetch_nop, op_nop, store_nop ;BF ;NOP | |
3235 | instr fetch_nop, op_nop, store_nop ;C0 ;NOP | |
3236 | instr fetch_nop, op_nop, store_nop ;C1 ;NOP | |
3237 | instr fetch_nop, op_nop, store_nop ;C2 ;NOP | |
3238 | instr fetch_nop, op_nop, store_nop ;C3 ;NOP | |
3239 | instr fetch_nop, op_nop, store_nop ;C4 ;NOP | |
3240 | instr fetch_nop, op_nop, store_nop ;C5 ;NOP | |
3241 | instr fetch_nop, op_nop, store_nop ;C6 ;NOP | |
3242 | instr fetch_nop, op_nop, store_nop ;C7 ;NOP | |
3243 | instr fetch_nop, op_nop, store_nop ;C8 ;NOP | |
3244 | instr fetch_nop, op_nop, store_nop ;C9 ;NOP | |
3245 | instr fetch_nop, op_nop, store_nop ;CA ;NOP | |
3246 | instr fetch_nop, op_nop, store_nop ;CB ;NOP | |
3247 | instr fetch_nop, op_nop, store_nop ;CC ;NOP | |
3248 | instr fetch_nop, op_nop, store_nop ;CD ;NOP | |
3249 | instr fetch_nop, op_nop, store_nop ;CE ;NOP | |
3250 | instr fetch_nop, op_nop, store_nop ;CF ;NOP | |
3251 | instr fetch_nop, op_nop, store_nop ;D0 ;NOP | |
3252 | instr fetch_nop, op_nop, store_nop ;D1 ;NOP | |
3253 | instr fetch_nop, op_nop, store_nop ;D2 ;NOP | |
3254 | instr fetch_nop, op_nop, store_nop ;D3 ;NOP | |
3255 | instr fetch_nop, op_nop, store_nop ;D4 ;NOP | |
3256 | instr fetch_nop, op_nop, store_nop ;D5 ;NOP | |
3257 | instr fetch_nop, op_nop, store_nop ;D6 ;NOP | |
3258 | instr fetch_nop, op_nop, store_nop ;D7 ;NOP | |
3259 | instr fetch_nop, op_nop, store_nop ;D8 ;NOP | |
3260 | instr fetch_nop, op_nop, store_nop ;D9 ;NOP | |
3261 | instr fetch_nop, op_nop, store_nop ;DA ;NOP | |
3262 | instr fetch_nop, op_nop, store_nop ;DB ;NOP | |
3263 | instr fetch_nop, op_nop, store_nop ;DC ;NOP | |
3264 | instr fetch_nop, op_nop, store_nop ;DD ;NOP | |
3265 | instr fetch_nop, op_nop, store_nop ;DE ;NOP | |
3266 | instr fetch_nop, op_nop, store_nop ;DF ;NOP | |
3267 | instr fetch_nop, op_nop, store_nop ;E0 ;NOP | |
3268 | instr fetch_nop, op_nop, store_nop ;E1 ;NOP | |
3269 | instr fetch_nop, op_nop, store_nop ;E2 ;NOP | |
3270 | instr fetch_nop, op_nop, store_nop ;E3 ;NOP | |
3271 | instr fetch_nop, op_nop, store_nop ;E4 ;NOP | |
3272 | instr fetch_nop, op_nop, store_nop ;E5 ;NOP | |
3273 | instr fetch_nop, op_nop, store_nop ;E6 ;NOP | |
3274 | instr fetch_nop, op_nop, store_nop ;E7 ;NOP | |
3275 | instr fetch_nop, op_nop, store_nop ;E8 ;NOP | |
3276 | instr fetch_nop, op_nop, store_nop ;E9 ;NOP | |
3277 | instr fetch_nop, op_nop, store_nop ;EA ;NOP | |
3278 | instr fetch_nop, op_nop, store_nop ;EB ;NOP | |
3279 | instr fetch_nop, op_nop, store_nop ;EC ;NOP | |
3280 | instr fetch_nop, op_nop, store_nop ;ED ;NOP | |
3281 | instr fetch_nop, op_nop, store_nop ;EE ;NOP | |
3282 | instr fetch_nop, op_nop, store_nop ;EF ;NOP | |
3283 | instr fetch_nop, op_nop, store_nop ;F0 ;NOP | |
3284 | instr fetch_nop, op_nop, store_nop ;F1 ;NOP | |
3285 | instr fetch_nop, op_nop, store_nop ;F2 ;NOP | |
3286 | instr fetch_nop, op_nop, store_nop ;F3 ;NOP | |
3287 | instr fetch_nop, op_nop, store_nop ;F4 ;NOP | |
3288 | instr fetch_nop, op_nop, store_nop ;F5 ;NOP | |
3289 | instr fetch_nop, op_nop, store_nop ;F6 ;NOP | |
3290 | instr fetch_nop, op_nop, store_nop ;F7 ;NOP | |
3291 | instr fetch_nop, op_nop, store_nop ;F8 ;NOP | |
3292 | instr fetch_nop, op_nop, store_nop ;F9 ;NOP | |
3293 | instr fetch_nop, op_nop, store_nop ;FA ;NOP | |
3294 | instr fetch_nop, op_nop, store_nop ;FB ;NOP | |
3295 | instr fetch_nop, op_nop, store_nop ;FC ;NOP | |
3296 | instr fetch_nop, op_nop, store_nop ;FD ;NOP | |
3297 | instr fetch_nop, op_nop, store_nop ;FE ;NOP | |
3298 | instr fetch_nop, op_nop, store_nop ;FF ;NOP | |
3299 | ||
3300 | ||
3301 | opctable DDFDjmp | |
3302 | ||
80e1fa71 L |
3303 | instr fetch_nop, op_nop, store_nop ;00 ; |
3304 | instr fetch_nop, op_nop, store_nop ;01 ; | |
3305 | instr fetch_nop, op_nop, store_nop ;02 ; | |
3306 | instr fetch_nop, op_nop, store_nop ;03 ; | |
3307 | instr fetch_nop, op_nop, store_nop ;04 ; | |
3308 | instr fetch_nop, op_nop, store_nop ;05 ; | |
3309 | instr fetch_nop, op_nop, store_nop ;06 ; | |
3310 | instr fetch_nop, op_nop, store_nop ;07 ; | |
3311 | instr fetch_nop, op_nop, store_nop ;08 ; | |
3312 | instr fetch_BC, op_ADDxx, store_nop ;09 ;ADD xx,BC | |
3313 | instr fetch_nop, op_nop, store_nop ;0A ; | |
3314 | instr fetch_nop, op_nop, store_nop ;0B ; | |
3315 | instr fetch_nop, op_nop, store_nop ;0C ; | |
3316 | instr fetch_nop, op_nop, store_nop ;0D ; | |
3317 | instr fetch_nop, op_nop, store_nop ;0E ; | |
3318 | instr fetch_nop, op_nop, store_nop ;0F ; | |
3319 | instr fetch_nop, op_nop, store_nop ;10 ; | |
3320 | instr fetch_nop, op_nop, store_nop ;11 ; | |
3321 | instr fetch_nop, op_nop, store_nop ;12 ; | |
3322 | instr fetch_nop, op_nop, store_nop ;13 ; | |
3323 | instr fetch_nop, op_nop, store_nop ;14 ; | |
3324 | instr fetch_nop, op_nop, store_nop ;15 ; | |
3325 | instr fetch_nop, op_nop, store_nop ;16 ; | |
3326 | instr fetch_nop, op_nop, store_nop ;17 ; | |
3327 | instr fetch_nop, op_nop, store_nop ;18 ; | |
3328 | instr fetch_DE, op_ADDxx, store_nop ;19 ;ADD xx,DE | |
3329 | instr fetch_nop, op_nop, store_nop ;1A ; | |
3330 | instr fetch_nop, op_nop, store_nop ;1B ; | |
3331 | instr fetch_nop, op_nop, store_nop ;1C ; | |
3332 | instr fetch_nop, op_nop, store_nop ;1D ; | |
3333 | instr fetch_nop, op_nop, store_nop ;1E ; | |
3334 | instr fetch_nop, op_nop, store_nop ;1F ; | |
3335 | instr fetch_nop, op_nop, store_nop ;20 ; | |
3336 | instr fetch_DIR16, op_nop, store_xx ;21 ;LD xx,nn | |
3337 | instr fetch_DIR16, op_STxx, store_nop ;22 ;LD (nn),xx | |
3338 | instr fetch_xx, op_INC16, store_xx ;23 ;INC xx | |
2217c855 L |
3339 | instr fetch_xH, op_INC, store_xH ;24 ;INC xh |
3340 | instr fetch_xH, op_DEC, store_xH ;25 ;DEC xh | |
3341 | instr fetch_DIR8, op_nop, store_xH ;26 ;LD xh,n | |
80e1fa71 L |
3342 | instr fetch_nop, op_nop, store_nop ;27 ; |
3343 | instr fetch_nop, op_nop, store_nop ;28 ; | |
fa9059af | 3344 | instr fetch_xx, op_ADDxx, store_nop ;29 ;ADD xx,xx |
80e1fa71 L |
3345 | instr fetch_DIR16, op_RMEM16, store_xx ;2A ;LD xx,(nn) |
3346 | instr fetch_xx, op_DEC16, store_xx ;2B ;DEC xx | |
2217c855 L |
3347 | instr fetch_xL, op_INC, store_xL ;2C ;INC xl |
3348 | instr fetch_xL, op_DEC, store_xL ;2D ;DEC xl | |
3349 | instr fetch_DIR8, op_nop, store_xL ;2E ;LD xl,n | |
80e1fa71 L |
3350 | instr fetch_nop, op_nop, store_nop ;2F ; |
3351 | instr fetch_nop, op_nop, store_nop ;30 ; | |
3352 | instr fetch_nop, op_nop, store_nop ;31 ; | |
3353 | instr fetch_nop, op_nop, store_nop ;32 ; | |
3354 | instr fetch_nop, op_nop, store_nop ;33 ; | |
3355 | instr fetch_MXX, op_INC, store_MXX ;34 ;INC (xx+d) | |
3356 | instr fetch_MXX, op_DEC, store_MXX ;35 ;DEC (xx+d) | |
8fec4e62 | 3357 | instr fetch_DIR8_2, op_nop, store_MXX_2 ;36 ;LD (xx+d),n |
80e1fa71 L |
3358 | instr fetch_nop, op_nop, store_nop ;37 ; |
3359 | instr fetch_nop, op_nop, store_nop ;38 ; | |
3360 | instr fetch_SP, op_ADDxx, store_nop ;39 ;ADD xx,SP | |
3361 | instr fetch_nop, op_nop, store_nop ;3A ; | |
3362 | instr fetch_nop, op_nop, store_nop ;3B ; | |
3363 | instr fetch_nop, op_nop, store_nop ;3C ; | |
3364 | instr fetch_nop, op_nop, store_nop ;3D ; | |
3365 | instr fetch_nop, op_nop, store_nop ;3E ; | |
3366 | instr fetch_nop, op_nop, store_nop ;3F ; | |
3367 | instr fetch_nop, op_nop, store_nop ;40 ; | |
3368 | instr fetch_nop, op_nop, store_nop ;41 ; | |
3369 | instr fetch_nop, op_nop, store_nop ;42 ; | |
3370 | instr fetch_nop, op_nop, store_nop ;43 ; | |
2217c855 L |
3371 | instr fetch_xH, op_nop, store_B ;44 ;LD B,xh |
3372 | instr fetch_xL, op_nop, store_B ;45 ;LD B,xl | |
80e1fa71 L |
3373 | instr fetch_MXX, op_nop, store_B ;46 ;LD B,(xx+d) |
3374 | instr fetch_nop, op_nop, store_nop ;47 ; | |
3375 | instr fetch_nop, op_nop, store_nop ;48 ; | |
3376 | instr fetch_nop, op_nop, store_nop ;49 ; | |
3377 | instr fetch_nop, op_nop, store_nop ;4A ; | |
3378 | instr fetch_nop, op_nop, store_nop ;4B ; | |
2217c855 L |
3379 | instr fetch_xH, op_nop, store_C ;4C ;LD C,xh |
3380 | instr fetch_xL, op_nop, store_C ;4D ;LD C,xl | |
80e1fa71 L |
3381 | instr fetch_MXX, op_nop, store_C ;4E ;LD C,(xx+d) |
3382 | instr fetch_nop, op_nop, store_nop ;4F ; | |
3383 | instr fetch_nop, op_nop, store_nop ;50 ; | |
3384 | instr fetch_nop, op_nop, store_nop ;51 ; | |
3385 | instr fetch_nop, op_nop, store_nop ;52 ; | |
3386 | instr fetch_nop, op_nop, store_nop ;53 ; | |
2217c855 L |
3387 | instr fetch_xH, op_nop, store_D ;54 ;LD D,xh |
3388 | instr fetch_xL, op_nop, store_D ;55 ;LD D,xl | |
80e1fa71 L |
3389 | instr fetch_MXX, op_nop, store_D ;56 ;LD D,(xx+d) |
3390 | instr fetch_nop, op_nop, store_nop ;57 ; | |
3391 | instr fetch_nop, op_nop, store_nop ;58 ; | |
3392 | instr fetch_nop, op_nop, store_nop ;59 ; | |
3393 | instr fetch_nop, op_nop, store_nop ;5A ; | |
3394 | instr fetch_nop, op_nop, store_nop ;5B ; | |
2217c855 L |
3395 | instr fetch_xH, op_nop, store_E ;5C ;LD E,xh |
3396 | instr fetch_xL, op_nop, store_E ;5D ;LD E,xl | |
80e1fa71 L |
3397 | instr fetch_MXX, op_nop, store_E ;5E ;LD E,(xx+d) |
3398 | instr fetch_nop, op_nop, store_nop ;5F ; | |
2217c855 L |
3399 | instr fetch_B, op_nop, store_xH ;60 ;LD xh,B |
3400 | instr fetch_C, op_nop, store_xH ;61 ;LD xh,C | |
3401 | instr fetch_D, op_nop, store_xH ;62 ;LD xh,D | |
3402 | instr fetch_E, op_nop, store_xH ;63 ;LD xh,E | |
80e1fa71 | 3403 | instr fetch_nop, op_nop, store_nop ;64 ;LD xh,xh |
2217c855 | 3404 | instr fetch_xL, op_nop, store_xH ;65 ;LD xh,xl |
80e1fa71 | 3405 | instr fetch_MXX, op_nop, store_H ;66 ;LD H,(xx+d) |
2217c855 L |
3406 | instr fetch_A, op_nop, store_xH ;67 ;LD xh,A |
3407 | instr fetch_B, op_nop, store_xL ;68 ;LD xl,B | |
3408 | instr fetch_C, op_nop, store_xL ;69 ;LD xl,C | |
3409 | instr fetch_D, op_nop, store_xL ;6A ;LD xl,D | |
3410 | instr fetch_E, op_nop, store_xL ;6B ;LD xl,E | |
3411 | instr fetch_xH, op_nop, store_xL ;6C ;LD xl,xh | |
80e1fa71 L |
3412 | instr fetch_nop, op_nop, store_nop ;6D ;LD xl,xl |
3413 | instr fetch_MXX, op_nop, store_L ;6E ;LD L,(xx+d) | |
2217c855 | 3414 | instr fetch_A, op_nop, store_xL ;6F ;LD xl,A |
80e1fa71 L |
3415 | instr fetch_B, op_nop, store_MXX ;70 ;LD (xx+d),B |
3416 | instr fetch_C, op_nop, store_MXX ;71 ;LD (xx+d),C | |
3417 | instr fetch_D, op_nop, store_MXX ;72 ;LD (xx+d),D | |
3418 | instr fetch_E, op_nop, store_MXX ;73 ;LD (xx+d),E | |
3419 | instr fetch_H, op_nop, store_MXX ;74 ;LD (xx+d),H | |
3420 | instr fetch_L, op_nop, store_MXX ;75 ;LD (xx+d),L | |
3421 | instr fetch_nop, op_nop, store_nop ;76 ; | |
3422 | instr fetch_A, op_nop, store_MXX ;77 ;LD (xx+d),A | |
3423 | instr fetch_nop, op_nop, store_nop ;78 ; | |
3424 | instr fetch_nop, op_nop, store_nop ;79 ; | |
3425 | instr fetch_nop, op_nop, store_nop ;7A ; | |
3426 | instr fetch_nop, op_nop, store_nop ;7B ; | |
2217c855 L |
3427 | instr fetch_xH, op_nop, store_A ;7C ;LD A,xh |
3428 | instr fetch_xL, op_nop, store_A ;7D ;LD A,xl | |
80e1fa71 L |
3429 | instr fetch_MXX, op_nop, store_A ;7E ;LD A,(xx+d) |
3430 | instr fetch_nop, op_nop, store_nop ;7F ; | |
3431 | instr fetch_nop, op_nop, store_nop ;80 ; | |
3432 | instr fetch_nop, op_nop, store_nop ;81 ; | |
3433 | instr fetch_nop, op_nop, store_nop ;82 ; | |
3434 | instr fetch_nop, op_nop, store_nop ;83 ; | |
2217c855 L |
3435 | instr fetch_xH, op_ADDA, store_nop ;84 ;ADD A,xh |
3436 | instr fetch_xL, op_ADDA, store_nop ;85 ;ADD A,xl | |
80e1fa71 L |
3437 | instr fetch_MXX, op_ADDA, store_nop ;86 ;ADD A,(xx) |
3438 | instr fetch_nop, op_nop, store_nop ;87 ; | |
3439 | instr fetch_nop, op_nop, store_nop ;88 ; | |
3440 | instr fetch_nop, op_nop, store_nop ;89 ; | |
3441 | instr fetch_nop, op_nop, store_nop ;8A ; | |
3442 | instr fetch_nop, op_nop, store_nop ;8B ; | |
2217c855 L |
3443 | instr fetch_xH, op_ADCA, store_nop ;8C ;ADC A,xh |
3444 | instr fetch_xL, op_ADCA, store_nop ;8D ;ADC A,xl | |
80e1fa71 L |
3445 | instr fetch_MXX, op_ADCA, store_nop ;8E ;ADC A,(xx) |
3446 | instr fetch_nop, op_nop, store_nop ;8F ; | |
3447 | instr fetch_nop, op_nop, store_nop ;90 ; | |
3448 | instr fetch_nop, op_nop, store_nop ;91 ; | |
3449 | instr fetch_nop, op_nop, store_nop ;92 ; | |
3450 | instr fetch_nop, op_nop, store_nop ;93 ; | |
2217c855 L |
3451 | instr fetch_xH, op_SUBFA, store_nop ;94 ;SUB A,xh |
3452 | instr fetch_xL, op_SUBFA, store_nop ;95 ;SUB A,xl | |
80e1fa71 L |
3453 | instr fetch_MXX, op_SUBFA, store_nop ;96 ;SUB A,(xx) |
3454 | instr fetch_nop, op_nop, store_nop ;97 ; | |
3455 | instr fetch_nop, op_nop, store_nop ;98 ; | |
3456 | instr fetch_nop, op_nop, store_nop ;99 ; | |
3457 | instr fetch_nop, op_nop, store_nop ;9A ; | |
3458 | instr fetch_nop, op_nop, store_nop ;9B ; | |
2217c855 L |
3459 | instr fetch_xH, op_SBCFA, store_nop ;9C ;SBC A,xh |
3460 | instr fetch_xL, op_SBCFA, store_nop ;9D ;SBC A,xl | |
80e1fa71 L |
3461 | instr fetch_MXX, op_SBCFA, store_nop ;9E ;SBC A,(xx) |
3462 | instr fetch_nop, op_nop, store_nop ;9F ; | |
3463 | instr fetch_nop, op_nop, store_nop ;A0 ; | |
3464 | instr fetch_nop, op_nop, store_nop ;A1 ; | |
3465 | instr fetch_nop, op_nop, store_nop ;A2 ; | |
3466 | instr fetch_nop, op_nop, store_nop ;A3 ; | |
2217c855 L |
3467 | instr fetch_xH, op_ANDA, store_nop ;A4 ;AND A,xh |
3468 | instr fetch_xL, op_ANDA, store_nop ;A5 ;AND A,xl | |
80e1fa71 L |
3469 | instr fetch_MXX, op_ANDA, store_nop ;A6 ;AND A,(xx) |
3470 | instr fetch_nop, op_nop, store_nop ;A7 ; | |
3471 | instr fetch_nop, op_nop, store_nop ;A8 ; | |
3472 | instr fetch_nop, op_nop, store_nop ;A9 ; | |
3473 | instr fetch_nop, op_nop, store_nop ;AA ; | |
3474 | instr fetch_nop, op_nop, store_nop ;AB ; | |
2217c855 L |
3475 | instr fetch_xH, op_XORA, store_nop ;AC ;XOR A,xh |
3476 | instr fetch_xL, op_XORA, store_nop ;AD ;XOR A,xl | |
3477 | instr fetch_MXX, op_XORA, store_nop ;AE ;XOR A,(xx) | |
80e1fa71 L |
3478 | instr fetch_nop, op_nop, store_nop ;AF ; |
3479 | instr fetch_nop, op_nop, store_nop ;B0 ; | |
3480 | instr fetch_nop, op_nop, store_nop ;B1 ; | |
3481 | instr fetch_nop, op_nop, store_nop ;B2 ; | |
3482 | instr fetch_nop, op_nop, store_nop ;B3 ; | |
2217c855 L |
3483 | instr fetch_xH, op_ORA, store_nop ;B4 ;OR A,xh |
3484 | instr fetch_xL, op_ORA, store_nop ;B5 ;OR A,xl | |
80e1fa71 L |
3485 | instr fetch_MXX, op_ORA, store_nop ;B6 ;OR A,(xx) |
3486 | instr fetch_nop, op_nop, store_nop ;B7 ; | |
3487 | instr fetch_nop, op_nop, store_nop ;B8 ; | |
3488 | instr fetch_nop, op_nop, store_nop ;B9 ; | |
3489 | instr fetch_nop, op_nop, store_nop ;BA ; | |
3490 | instr fetch_nop, op_nop, store_nop ;BB ; | |
2217c855 L |
3491 | instr fetch_xH, op_CPFA, store_nop ;BC ;CP A,xh |
3492 | instr fetch_xL, op_CPFA, store_nop ;BD ;CP A,xl | |
80e1fa71 L |
3493 | instr fetch_MXX, op_CPFA, store_nop ;BE ;CP A,(xx) |
3494 | instr fetch_nop, op_nop, store_nop ;BF ; | |
3495 | instr fetch_nop, op_nop, store_nop ;C0 ; | |
3496 | instr fetch_nop, op_nop, store_nop ;C1 ; | |
3497 | instr fetch_nop, op_nop, store_nop ;C2 ; | |
3498 | instr fetch_nop, op_nop, store_nop ;C3 ; | |
3499 | instr fetch_nop, op_nop, store_nop ;C4 ; | |
3500 | instr fetch_nop, op_nop, store_nop ;C5 ; | |
3501 | instr fetch_nop, op_nop, store_nop ;C6 ; | |
3502 | instr fetch_nop, op_nop, store_nop ;C7 ; | |
3503 | instr fetch_nop, op_nop, store_nop ;C8 ; | |
3504 | instr fetch_nop, op_nop, store_nop ;C9 ; | |
3505 | instr fetch_nop, op_nop, store_nop ;CA ; | |
e7a0f403 | 3506 | instr fetch_nop, op_prefixDDFDCB,store_nop ;CB ; |
80e1fa71 L |
3507 | instr fetch_nop, op_nop, store_nop ;CC ; |
3508 | instr fetch_nop, op_nop, store_nop ;CD ; | |
3509 | instr fetch_nop, op_nop, store_nop ;CE ; | |
3510 | instr fetch_nop, op_nop, store_nop ;CF ; | |
3511 | instr fetch_nop, op_nop, store_nop ;D0 ; | |
3512 | instr fetch_nop, op_nop, store_nop ;D1 ; | |
3513 | instr fetch_nop, op_nop, store_nop ;D2 ; | |
3514 | instr fetch_nop, op_nop, store_nop ;D3 ; | |
3515 | instr fetch_nop, op_nop, store_nop ;D4 ; | |
3516 | instr fetch_nop, op_nop, store_nop ;D5 ; | |
3517 | instr fetch_nop, op_nop, store_nop ;D6 ; | |
3518 | instr fetch_nop, op_nop, store_nop ;D7 ; | |
3519 | instr fetch_nop, op_nop, store_nop ;D8 ; | |
3520 | instr fetch_nop, op_nop, store_nop ;D9 ; | |
3521 | instr fetch_nop, op_nop, store_nop ;DA ; | |
3522 | instr fetch_nop, op_nop, store_nop ;DB ; | |
3523 | instr fetch_nop, op_nop, store_nop ;DC ; | |
3524 | instr fetch_nop, op_nop, store_nop ;DD ; | |
3525 | instr fetch_nop, op_nop, store_nop ;DE ; | |
3526 | instr fetch_nop, op_nop, store_nop ;DF ; | |
3527 | instr fetch_nop, op_nop, store_nop ;E0 ; | |
3528 | instr fetch_nop, op_POP16, store_xx ;E1 ;POP xx | |
3529 | instr fetch_nop, op_nop, store_nop ;E2 ; | |
3530 | instr fetch_MSP, op_EXxx, store_MSP ;E3 ;EX (SP),xx | |
3531 | instr fetch_nop, op_nop, store_nop ;E4 ; | |
3532 | instr fetch_xx, op_PUSH16, store_nop ;E5 ;PUSH xx | |
3533 | instr fetch_nop, op_nop, store_nop ;E6 ; | |
3534 | instr fetch_nop, op_nop, store_nop ;E7 ; | |
3535 | instr fetch_nop, op_nop, store_nop ;E8 ; | |
3536 | instr fetch_xx, op_nop, store_PC ;E9 ;JP xx | |
3537 | instr fetch_nop, op_nop, store_nop ;EA ; | |
3538 | instr fetch_nop, op_nop, store_nop ;EB ; | |
3539 | instr fetch_nop, op_nop, store_nop ;EC ; | |
3540 | instr fetch_nop, op_nop, store_nop ;ED ; | |
3541 | instr fetch_nop, op_nop, store_nop ;EE ; | |
3542 | instr fetch_nop, op_nop, store_nop ;EF ; | |
3543 | instr fetch_nop, op_nop, store_nop ;F0 ; | |
3544 | instr fetch_nop, op_nop, store_nop ;F1 ; | |
3545 | instr fetch_nop, op_nop, store_nop ;F2 ; | |
3546 | instr fetch_nop, op_nop, store_nop ;F3 ; | |
3547 | instr fetch_nop, op_nop, store_nop ;F4 ; | |
3548 | instr fetch_nop, op_nop, store_nop ;F5 ; | |
3549 | instr fetch_nop, op_nop, store_nop ;F6 ; | |
3550 | instr fetch_nop, op_nop, store_nop ;F7 ; | |
3551 | instr fetch_nop, op_nop, store_nop ;F8 ; | |
3552 | instr fetch_xx, op_nop, store_SP ;F9 ;LD SP,xx | |
3553 | instr fetch_nop, op_nop, store_nop ;FA ; | |
3554 | instr fetch_nop, op_nop, store_nop ;FB ; | |
3555 | instr fetch_nop, op_nop, store_nop ;FC ; | |
3556 | instr fetch_nop, op_nop, store_nop ;FD ; | |
3557 | instr fetch_nop, op_nop, store_nop ;FE ; | |
3558 | instr fetch_nop, op_nop, store_nop ;FF ; | |
fa9059af L |
3559 | |
3560 | ||
3561 | opctable CBjmp | |
3562 | ||
8fec4e62 L |
3563 | instr fetch_B, op_RLC, store_B ;00 ;RLC B |
3564 | instr fetch_C, op_RLC, store_C ;01 ;RLC C | |
3565 | instr fetch_D, op_RLC, store_D ;02 ;RLC D | |
3566 | instr fetch_E, op_RLC, store_E ;03 ;RLC E | |
3567 | instr fetch_H, op_RLC, store_H ;04 ;RLC H | |
3568 | instr fetch_L, op_RLC, store_L ;05 ;RLC L | |
3569 | instr fetch_MHL, op_RLC, store_MHL ;06 ;RLC (HL) | |
3570 | instr fetch_A, op_RLC, store_A ;07 ;RLC A | |
3571 | instr fetch_B, op_RRC, store_B ;08 ;RRC B | |
3572 | instr fetch_C, op_RRC, store_C ;09 ;RRC C | |
3573 | instr fetch_D, op_RRC, store_D ;0A ;RRC D | |
3574 | instr fetch_E, op_RRC, store_E ;0B ;RRC E | |
3575 | instr fetch_H, op_RRC, store_H ;0C ;RRC H | |
3576 | instr fetch_L, op_RRC, store_L ;0D ;RRC L | |
3577 | instr fetch_MHL, op_RRC, store_MHL ;0E ;RRC (HL) | |
3578 | instr fetch_A, op_RRC, store_A ;0F ;RRC A | |
3579 | instr fetch_B, op_RL, store_B ;10 ;RL B | |
3580 | instr fetch_C, op_RL, store_C ;11 ;RL C | |
3581 | instr fetch_D, op_RL, store_D ;12 ;RL D | |
3582 | instr fetch_E, op_RL, store_E ;13 ;RL E | |
3583 | instr fetch_H, op_RL, store_H ;14 ;RL H | |
3584 | instr fetch_L, op_RL, store_L ;15 ;RL L | |
3585 | instr fetch_MHL, op_RL, store_MHL ;16 ;RL (HL) | |
3586 | instr fetch_A, op_RL, store_A ;17 ;RL A | |
3587 | instr fetch_B, op_RR, store_B ;18 ;RR B | |
3588 | instr fetch_C, op_RR, store_C ;19 ;RR C | |
3589 | instr fetch_D, op_RR, store_D ;1A ;RR D | |
3590 | instr fetch_E, op_RR, store_E ;1B ;RR E | |
3591 | instr fetch_H, op_RR, store_H ;1C ;RR H | |
3592 | instr fetch_L, op_RR, store_L ;1D ;RR L | |
3593 | instr fetch_MHL, op_RR, store_MHL ;1E ;RR (HL) | |
3594 | instr fetch_A, op_RR, store_A ;1F ;RR A | |
3595 | instr fetch_B, op_SLA, store_B ;20 ;SLA B | |
3596 | instr fetch_C, op_SLA, store_C ;21 ;SLA C | |
3597 | instr fetch_D, op_SLA, store_D ;22 ;SLA D | |
3598 | instr fetch_E, op_SLA, store_E ;23 ;SLA E | |
3599 | instr fetch_H, op_SLA, store_H ;24 ;SLA H | |
3600 | instr fetch_L, op_SLA, store_L ;25 ;SLA L | |
3601 | instr fetch_MHL, op_SLA, store_MHL ;26 ;SLA (HL) | |
3602 | instr fetch_A, op_SLA, store_A ;27 ;SLA A | |
3603 | instr fetch_B, op_SRA, store_B ;28 ;SRA B | |
3604 | instr fetch_C, op_SRA, store_C ;29 ;SRA C | |
3605 | instr fetch_D, op_SRA, store_D ;2A ;SRA D | |
3606 | instr fetch_E, op_SRA, store_E ;2B ;SRA E | |
3607 | instr fetch_H, op_SRA, store_H ;2C ;SRA H | |
3608 | instr fetch_L, op_SRA, store_L ;2D ;SRA L | |
3609 | instr fetch_MHL, op_SRA, store_MHL ;2E ;SRA (HL) | |
3610 | instr fetch_A, op_SRA, store_A ;2F ;SRA A | |
3611 | instr fetch_B, op_SLL, store_B ;30 ;SLL B | |
3612 | instr fetch_C, op_SLL, store_C ;31 ;SLL C | |
3613 | instr fetch_D, op_SLL, store_D ;32 ;SLL D | |
3614 | instr fetch_E, op_SLL, store_E ;33 ;SLL E | |
3615 | instr fetch_H, op_SLL, store_H ;34 ;SLL H | |
3616 | instr fetch_L, op_SLL, store_L ;35 ;SLL L | |
3617 | instr fetch_MHL, op_SLL, store_MHL ;36 ;SLL (HL) | |
3618 | instr fetch_A, op_SLL, store_A ;37 ;SLL A | |
3619 | instr fetch_B, op_SRL, store_B ;38 ;SRL B | |
3620 | instr fetch_C, op_SRL, store_C ;39 ;SRL C | |
3621 | instr fetch_D, op_SRL, store_D ;3A ;SRL D | |
3622 | instr fetch_E, op_SRL, store_E ;3B ;SRL E | |
3623 | instr fetch_H, op_SRL, store_H ;3C ;SRL H | |
3624 | instr fetch_L, op_SRL, store_L ;3D ;SRL L | |
3625 | instr fetch_MHL, op_SRL, store_MHL ;3E ;SRL (HL) | |
3626 | instr fetch_A, op_SRL, store_A ;3F ;SRL A | |
4c92af0d L |
3627 | instr fetch_B, op_BIT0, store_nop ;40 ;BIT 0,B |
3628 | instr fetch_C, op_BIT0, store_nop ;41 ;BIT 0,C | |
3629 | instr fetch_D, op_BIT0, store_nop ;42 ;BIT 0,D | |
3630 | instr fetch_E, op_BIT0, store_nop ;43 ;BIT 0,E | |
3631 | instr fetch_H, op_BIT0, store_nop ;44 ;BIT 0,H | |
3632 | instr fetch_L, op_BIT0, store_nop ;45 ;BIT 0,L | |
3633 | instr fetch_MHL, op_BIT0, store_nop ;46 ;BIT 0,(HL) | |
3634 | instr fetch_A, op_BIT0, store_nop ;47 ;BIT 0,A | |
3635 | instr fetch_B, op_BIT1, store_nop ;48 ;BIT 1,B | |
3636 | instr fetch_C, op_BIT1, store_nop ;49 ;BIT 1,C | |
3637 | instr fetch_D, op_BIT1, store_nop ;4A ;BIT 1,D | |
3638 | instr fetch_E, op_BIT1, store_nop ;4B ;BIT 1,E | |
3639 | instr fetch_H, op_BIT1, store_nop ;4C ;BIT 1,H | |
3640 | instr fetch_L, op_BIT1, store_nop ;4D ;BIT 1,L | |
3641 | instr fetch_MHL, op_BIT1, store_nop ;4E ;BIT 1,(HL) | |
3642 | instr fetch_A, op_BIT1, store_nop ;4F ;BIT 1,A | |
3643 | instr fetch_B, op_BIT2, store_nop ;50 ;BIT 2,B | |
3644 | instr fetch_C, op_BIT2, store_nop ;51 ;BIT 2,C | |
3645 | instr fetch_D, op_BIT2, store_nop ;52 ;BIT 2,D | |
3646 | instr fetch_E, op_BIT2, store_nop ;53 ;BIT 2,E | |
3647 | instr fetch_H, op_BIT2, store_nop ;54 ;BIT 2,H | |
3648 | instr fetch_L, op_BIT2, store_nop ;55 ;BIT 2,L | |
3649 | instr fetch_MHL, op_BIT2, store_nop ;56 ;BIT 2,(HL) | |
3650 | instr fetch_A, op_BIT2, store_nop ;57 ;BIT 2,A | |
3651 | instr fetch_B, op_BIT3, store_nop ;58 ;BIT 3,B | |
3652 | instr fetch_C, op_BIT3, store_nop ;59 ;BIT 3,C | |
3653 | instr fetch_D, op_BIT3, store_nop ;5A ;BIT 3,D | |
3654 | instr fetch_E, op_BIT3, store_nop ;5B ;BIT 3,E | |
3655 | instr fetch_H, op_BIT3, store_nop ;5C ;BIT 3,H | |
3656 | instr fetch_L, op_BIT3, store_nop ;5D ;BIT 3,L | |
3657 | instr fetch_MHL, op_BIT3, store_nop ;5E ;BIT 3,(HL) | |
3658 | instr fetch_A, op_BIT3, store_nop ;5F ;BIT 3,A | |
3659 | instr fetch_B, op_BIT4, store_nop ;60 ;BIT 4,B | |
3660 | instr fetch_C, op_BIT4, store_nop ;61 ;BIT 4,C | |
3661 | instr fetch_D, op_BIT4, store_nop ;62 ;BIT 4,D | |
3662 | instr fetch_E, op_BIT4, store_nop ;63 ;BIT 4,E | |
3663 | instr fetch_H, op_BIT4, store_nop ;64 ;BIT 4,H | |
3664 | instr fetch_L, op_BIT4, store_nop ;65 ;BIT 4,L | |
3665 | instr fetch_MHL, op_BIT4, store_nop ;66 ;BIT 4,(HL) | |
3666 | instr fetch_A, op_BIT4, store_nop ;67 ;BIT 4,A | |
3667 | instr fetch_B, op_BIT5, store_nop ;68 ;BIT 5,B | |
3668 | instr fetch_C, op_BIT5, store_nop ;69 ;BIT 5,C | |
3669 | instr fetch_D, op_BIT5, store_nop ;6A ;BIT 5,D | |
3670 | instr fetch_E, op_BIT5, store_nop ;6B ;BIT 5,E | |
3671 | instr fetch_H, op_BIT5, store_nop ;6C ;BIT 5,H | |
3672 | instr fetch_L, op_BIT5, store_nop ;6D ;BIT 5,L | |
3673 | instr fetch_MHL, op_BIT5, store_nop ;6E ;BIT 5,(HL) | |
3674 | instr fetch_A, op_BIT5, store_nop ;6F ;BIT 5,A | |
3675 | instr fetch_B, op_BIT6, store_nop ;70 ;BIT 6,B | |
3676 | instr fetch_C, op_BIT6, store_nop ;71 ;BIT 6,C | |
3677 | instr fetch_D, op_BIT6, store_nop ;72 ;BIT 6,D | |
3678 | instr fetch_E, op_BIT6, store_nop ;73 ;BIT 6,E | |
3679 | instr fetch_H, op_BIT6, store_nop ;74 ;BIT 6,H | |
3680 | instr fetch_L, op_BIT6, store_nop ;75 ;BIT 6,L | |
3681 | instr fetch_MHL, op_BIT6, store_nop ;76 ;BIT 6,(HL) | |
3682 | instr fetch_A, op_BIT6, store_nop ;77 ;BIT 6,A | |
3683 | instr fetch_B, op_BIT7, store_nop ;78 ;BIT 7,B | |
3684 | instr fetch_C, op_BIT7, store_nop ;79 ;BIT 7,C | |
3685 | instr fetch_D, op_BIT7, store_nop ;7A ;BIT 7,D | |
3686 | instr fetch_E, op_BIT7, store_nop ;7B ;BIT 7,E | |
3687 | instr fetch_H, op_BIT7, store_nop ;7C ;BIT 7,H | |
3688 | instr fetch_L, op_BIT7, store_nop ;7D ;BIT 7,L | |
3689 | instr fetch_MHL, op_BIT7, store_nop ;7E ;BIT 7,(HL) | |
3690 | instr fetch_A, op_BIT7, store_nop ;7F ;BIT 7,A | |
3691 | instr fetch_B, op_RES0, store_B ;80 ;RES 0,B | |
3692 | instr fetch_C, op_RES0, store_C ;81 ;RES 0,C | |
3693 | instr fetch_D, op_RES0, store_D ;82 ;RES 0,D | |
3694 | instr fetch_E, op_RES0, store_E ;83 ;RES 0,E | |
3695 | instr fetch_H, op_RES0, store_H ;84 ;RES 0,H | |
3696 | instr fetch_L, op_RES0, store_L ;85 ;RES 0,L | |
3697 | instr fetch_MHL, op_RES0, store_MHL ;86 ;RES 0,(HL) | |
3698 | instr fetch_A, op_RES0, store_A ;87 ;RES 0,A | |
3699 | instr fetch_B, op_RES1, store_B ;88 ;RES 1,B | |
3700 | instr fetch_C, op_RES1, store_C ;89 ;RES 1,C | |
3701 | instr fetch_D, op_RES1, store_D ;8A ;RES 1,D | |
3702 | instr fetch_E, op_RES1, store_E ;8B ;RES 1,E | |
3703 | instr fetch_H, op_RES1, store_H ;8C ;RES 1,H | |
3704 | instr fetch_L, op_RES1, store_L ;8D ;RES 1,L | |
3705 | instr fetch_MHL, op_RES1, store_MHL ;8E ;RES 1,(HL) | |
3706 | instr fetch_A, op_RES1, store_A ;8F ;RES 1,A | |
3707 | instr fetch_B, op_RES2, store_B ;90 ;RES 2,B | |
3708 | instr fetch_C, op_RES2, store_C ;91 ;RES 2,C | |
3709 | instr fetch_D, op_RES2, store_D ;92 ;RES 2,D | |
3710 | instr fetch_E, op_RES2, store_E ;93 ;RES 2,E | |
3711 | instr fetch_H, op_RES2, store_H ;94 ;RES 2,H | |
3712 | instr fetch_L, op_RES2, store_L ;95 ;RES 2,L | |
3713 | instr fetch_MHL, op_RES2, store_MHL ;96 ;RES 2,(HL) | |
3714 | instr fetch_A, op_RES2, store_A ;97 ;RES 2,A | |
3715 | instr fetch_B, op_RES3, store_B ;98 ;RES 3,B | |
3716 | instr fetch_C, op_RES3, store_C ;99 ;RES 3,C | |
3717 | instr fetch_D, op_RES3, store_D ;9A ;RES 3,D | |
3718 | instr fetch_E, op_RES3, store_E ;9B ;RES 3,E | |
3719 | instr fetch_H, op_RES3, store_H ;9C ;RES 3,H | |
3720 | instr fetch_L, op_RES3, store_L ;9D ;RES 3,L | |
3721 | instr fetch_MHL, op_RES3, store_MHL ;9E ;RES 3,(HL) | |
3722 | instr fetch_A, op_RES3, store_A ;9F ;RES 3,A | |
3723 | instr fetch_B, op_RES4, store_B ;A0 ;RES 4,B | |
3724 | instr fetch_C, op_RES4, store_C ;A1 ;RES 4,C | |
3725 | instr fetch_D, op_RES4, store_D ;A2 ;RES 4,D | |
3726 | instr fetch_E, op_RES4, store_E ;A3 ;RES 4,E | |
3727 | instr fetch_H, op_RES4, store_H ;A4 ;RES 4,H | |
3728 | instr fetch_L, op_RES4, store_L ;A5 ;RES 4,L | |
3729 | instr fetch_MHL, op_RES4, store_MHL ;A6 ;RES 4,(HL) | |
3730 | instr fetch_A, op_RES4, store_A ;A7 ;RES 4,A | |
3731 | instr fetch_B, op_RES5, store_B ;A8 ;RES 5,B | |
3732 | instr fetch_C, op_RES5, store_C ;A9 ;RES 5,C | |
3733 | instr fetch_D, op_RES5, store_D ;AA ;RES 5,D | |
3734 | instr fetch_E, op_RES5, store_E ;AB ;RES 5,E | |
3735 | instr fetch_H, op_RES5, store_H ;AC ;RES 5,H | |
3736 | instr fetch_L, op_RES5, store_L ;AD ;RES 5,L | |
3737 | instr fetch_MHL, op_RES5, store_MHL ;AE ;RES 5,(HL) | |
3738 | instr fetch_A, op_RES5, store_A ;AF ;RES 5,A | |
3739 | instr fetch_B, op_RES6, store_B ;B0 ;RES 6,B | |
3740 | instr fetch_C, op_RES6, store_C ;B1 ;RES 6,C | |
3741 | instr fetch_D, op_RES6, store_D ;B2 ;RES 6,D | |
3742 | instr fetch_E, op_RES6, store_E ;B3 ;RES 6,E | |
3743 | instr fetch_H, op_RES6, store_H ;B4 ;RES 6,H | |
3744 | instr fetch_L, op_RES6, store_L ;B5 ;RES 6,L | |
3745 | instr fetch_MHL, op_RES6, store_MHL ;B6 ;RES 6,(HL) | |
3746 | instr fetch_A, op_RES6, store_A ;B7 ;RES 6,A | |
3747 | instr fetch_B, op_RES7, store_B ;B8 ;RES 7,B | |
3748 | instr fetch_C, op_RES7, store_C ;B9 ;RES 7,C | |
3749 | instr fetch_D, op_RES7, store_D ;BA ;RES 7,D | |
3750 | instr fetch_E, op_RES7, store_E ;BB ;RES 7,E | |
3751 | instr fetch_H, op_RES7, store_H ;BC ;RES 7,H | |
3752 | instr fetch_L, op_RES7, store_L ;BD ;RES 7,L | |
3753 | instr fetch_MHL, op_RES7, store_MHL ;BE ;RES 7,(HL) | |
3754 | instr fetch_A, op_RES7, store_A ;BF ;RES 7,A | |
3755 | instr fetch_B, op_SET0, store_B ;C0 ;SET 0,B | |
3756 | instr fetch_C, op_SET0, store_C ;C1 ;SET 0,C | |
3757 | instr fetch_D, op_SET0, store_D ;C2 ;SET 0,D | |
3758 | instr fetch_E, op_SET0, store_E ;C3 ;SET 0,E | |
3759 | instr fetch_H, op_SET0, store_H ;C4 ;SET 0,H | |
3760 | instr fetch_L, op_SET0, store_L ;C5 ;SET 0,L | |
3761 | instr fetch_MHL, op_SET0, store_MHL ;C6 ;SET 0,(HL) | |
3762 | instr fetch_A, op_SET0, store_A ;C7 ;SET 0,A | |
3763 | instr fetch_B, op_SET1, store_B ;C8 ;SET 1,B | |
3764 | instr fetch_C, op_SET1, store_C ;C9 ;SET 1,C | |
3765 | instr fetch_D, op_SET1, store_D ;CA ;SET 1,D | |
3766 | instr fetch_E, op_SET1, store_E ;CB ;SET 1,E | |
3767 | instr fetch_H, op_SET1, store_H ;CC ;SET 1,H | |
3768 | instr fetch_L, op_SET1, store_L ;CD ;SET 1,L | |
3769 | instr fetch_MHL, op_SET1, store_MHL ;CE ;SET 1,(HL) | |
3770 | instr fetch_A, op_SET1, store_A ;CF ;SET 1,A | |
3771 | instr fetch_B, op_SET2, store_B ;D0 ;SET 2,B | |
3772 | instr fetch_C, op_SET2, store_C ;D1 ;SET 2,C | |
3773 | instr fetch_D, op_SET2, store_D ;D2 ;SET 2,D | |
3774 | instr fetch_E, op_SET2, store_E ;D3 ;SET 2,E | |
3775 | instr fetch_H, op_SET2, store_H ;D4 ;SET 2,H | |
3776 | instr fetch_L, op_SET2, store_L ;D5 ;SET 2,L | |
3777 | instr fetch_MHL, op_SET2, store_MHL ;D6 ;SET 2,(HL) | |
3778 | instr fetch_A, op_SET2, store_A ;D7 ;SET 2,A | |
3779 | instr fetch_B, op_SET3, store_B ;D8 ;SET 3,B | |
3780 | instr fetch_C, op_SET3, store_C ;D9 ;SET 3,C | |
3781 | instr fetch_D, op_SET3, store_D ;DA ;SET 3,D | |
3782 | instr fetch_E, op_SET3, store_E ;DB ;SET 3,E | |
3783 | instr fetch_H, op_SET3, store_H ;DC ;SET 3,H | |
3784 | instr fetch_L, op_SET3, store_L ;DD ;SET 3,L | |
3785 | instr fetch_MHL, op_SET3, store_MHL ;DE ;SET 3,(HL) | |
3786 | instr fetch_A, op_SET3, store_A ;DF ;SET 3,A | |
3787 | instr fetch_B, op_SET4, store_B ;E0 ;SET 4,B | |
3788 | instr fetch_C, op_SET4, store_C ;E1 ;SET 4,C | |
3789 | instr fetch_D, op_SET4, store_D ;E2 ;SET 4,D | |
3790 | instr fetch_E, op_SET4, store_E ;E3 ;SET 4,E | |
3791 | instr fetch_H, op_SET4, store_H ;E4 ;SET 4,H | |
3792 | instr fetch_L, op_SET4, store_L ;E5 ;SET 4,L | |
3793 | instr fetch_MHL, op_SET4, store_MHL ;E6 ;SET 4,(HL) | |
3794 | instr fetch_A, op_SET4, store_A ;E7 ;SET 4,A | |
3795 | instr fetch_B, op_SET5, store_B ;E8 ;SET 5,B | |
3796 | instr fetch_C, op_SET5, store_C ;E9 ;SET 5,C | |
3797 | instr fetch_D, op_SET5, store_D ;EA ;SET 5,D | |
3798 | instr fetch_E, op_SET5, store_E ;EB ;SET 5,E | |
3799 | instr fetch_H, op_SET5, store_H ;EC ;SET 5,H | |
3800 | instr fetch_L, op_SET5, store_L ;ED ;SET 5,L | |
3801 | instr fetch_MHL, op_SET5, store_MHL ;EE ;SET 5,(HL) | |
3802 | instr fetch_A, op_SET5, store_A ;EF ;SET 5,A | |
3803 | instr fetch_B, op_SET6, store_B ;F0 ;SET 6,B | |
3804 | instr fetch_C, op_SET6, store_C ;F1 ;SET 6,C | |
3805 | instr fetch_D, op_SET6, store_D ;F2 ;SET 6,D | |
3806 | instr fetch_E, op_SET6, store_E ;F3 ;SET 6,E | |
3807 | instr fetch_H, op_SET6, store_H ;F4 ;SET 6,H | |
3808 | instr fetch_L, op_SET6, store_L ;F5 ;SET 6,L | |
3809 | instr fetch_MHL, op_SET6, store_MHL ;F6 ;SET 6,(HL) | |
3810 | instr fetch_A, op_SET6, store_A ;F7 ;SET 6,A | |
3811 | instr fetch_B, op_SET7, store_B ;F8 ;SET 7,B | |
3812 | instr fetch_C, op_SET7, store_C ;F9 ;SET 7,C | |
3813 | instr fetch_D, op_SET7, store_D ;FA ;SET 7,D | |
3814 | instr fetch_E, op_SET7, store_E ;FB ;SET 7,E | |
3815 | instr fetch_H, op_SET7, store_H ;FC ;SET 7,H | |
3816 | instr fetch_L, op_SET7, store_L ;FD ;SET 7,L | |
3817 | instr fetch_MHL, op_SET7, store_MHL ;FE ;SET 7,(HL) | |
3818 | instr fetch_A, op_SET7, store_A ;FF ;SET 7,A | |
fa9059af L |
3819 | |
3820 | ||
3821 | opctable DDFDCBjmp | |
3822 | ||
3823 | instr fetch_nop, op_nop, store_nop ;00 ;NOP | |
3824 | instr fetch_nop, op_nop, store_nop ;01 ;NOP | |
3825 | instr fetch_nop, op_nop, store_nop ;02 ;NOP | |
3826 | instr fetch_nop, op_nop, store_nop ;03 ;NOP | |
3827 | instr fetch_nop, op_nop, store_nop ;04 ;NOP | |
3828 | instr fetch_nop, op_nop, store_nop ;05 ;NOP | |
3829 | instr fetch_nop, op_nop, store_nop ;06 ;NOP | |
3830 | instr fetch_nop, op_nop, store_nop ;07 ;NOP | |
3831 | instr fetch_nop, op_nop, store_nop ;08 ;NOP | |
3832 | instr fetch_nop, op_nop, store_nop ;09 ;NOP | |
3833 | instr fetch_nop, op_nop, store_nop ;0A ;NOP | |
3834 | instr fetch_nop, op_nop, store_nop ;0B ;NOP | |
3835 | instr fetch_nop, op_nop, store_nop ;0C ;NOP | |
3836 | instr fetch_nop, op_nop, store_nop ;0D ;NOP | |
3837 | instr fetch_nop, op_nop, store_nop ;0E ;NOP | |
3838 | instr fetch_nop, op_nop, store_nop ;0F ;NOP | |
3839 | instr fetch_nop, op_nop, store_nop ;10 ;NOP | |
3840 | instr fetch_nop, op_nop, store_nop ;11 ;NOP | |
3841 | instr fetch_nop, op_nop, store_nop ;12 ;NOP | |
3842 | instr fetch_nop, op_nop, store_nop ;13 ;NOP | |
3843 | instr fetch_nop, op_nop, store_nop ;14 ;NOP | |
3844 | instr fetch_nop, op_nop, store_nop ;15 ;NOP | |
3845 | instr fetch_nop, op_nop, store_nop ;16 ;NOP | |
3846 | instr fetch_nop, op_nop, store_nop ;17 ;NOP | |
3847 | instr fetch_nop, op_nop, store_nop ;18 ;NOP | |
3848 | instr fetch_nop, op_nop, store_nop ;19 ;NOP | |
3849 | instr fetch_nop, op_nop, store_nop ;1A ;NOP | |
3850 | instr fetch_nop, op_nop, store_nop ;1B ;NOP | |
3851 | instr fetch_nop, op_nop, store_nop ;1C ;NOP | |
3852 | instr fetch_nop, op_nop, store_nop ;1D ;NOP | |
3853 | instr fetch_nop, op_nop, store_nop ;1E ;NOP | |
3854 | instr fetch_nop, op_nop, store_nop ;1F ;NOP | |
3855 | instr fetch_nop, op_nop, store_nop ;20 ;NOP | |
3856 | instr fetch_nop, op_nop, store_nop ;21 ;NOP | |
3857 | instr fetch_nop, op_nop, store_nop ;22 ;NOP | |
3858 | instr fetch_nop, op_nop, store_nop ;23 ;NOP | |
3859 | instr fetch_nop, op_nop, store_nop ;24 ;NOP | |
3860 | instr fetch_nop, op_nop, store_nop ;25 ;NOP | |
3861 | instr fetch_nop, op_nop, store_nop ;26 ;NOP | |
3862 | instr fetch_nop, op_nop, store_nop ;27 ;NOP | |
3863 | instr fetch_nop, op_nop, store_nop ;28 ;NOP | |
3864 | instr fetch_nop, op_nop, store_nop ;29 ;NOP | |
3865 | instr fetch_nop, op_nop, store_nop ;2A ;NOP | |
3866 | instr fetch_nop, op_nop, store_nop ;2B ;NOP | |
3867 | instr fetch_nop, op_nop, store_nop ;2C ;NOP | |
3868 | instr fetch_nop, op_nop, store_nop ;2D ;NOP | |
3869 | instr fetch_nop, op_nop, store_nop ;2E ;NOP | |
3870 | instr fetch_nop, op_nop, store_nop ;2F ;NOP | |
3871 | instr fetch_nop, op_nop, store_nop ;30 ;NOP | |
3872 | instr fetch_nop, op_nop, store_nop ;31 ;NOP | |
3873 | instr fetch_nop, op_nop, store_nop ;32 ;NOP | |
3874 | instr fetch_nop, op_nop, store_nop ;33 ;NOP | |
3875 | instr fetch_nop, op_nop, store_nop ;34 ;NOP | |
3876 | instr fetch_nop, op_nop, store_nop ;35 ;NOP | |
3877 | instr fetch_nop, op_nop, store_nop ;36 ;NOP | |
3878 | instr fetch_nop, op_nop, store_nop ;37 ;NOP | |
3879 | instr fetch_nop, op_nop, store_nop ;38 ;NOP | |
3880 | instr fetch_nop, op_nop, store_nop ;39 ;NOP | |
3881 | instr fetch_nop, op_nop, store_nop ;3A ;NOP | |
3882 | instr fetch_nop, op_nop, store_nop ;3B ;NOP | |
3883 | instr fetch_nop, op_nop, store_nop ;3C ;NOP | |
3884 | instr fetch_nop, op_nop, store_nop ;3D ;NOP | |
3885 | instr fetch_nop, op_nop, store_nop ;3E ;NOP | |
3886 | instr fetch_nop, op_nop, store_nop ;3F ;NOP | |
e7a0f403 L |
3887 | instr fetch_nop, op_BIT0, store_nop ;40 ;BIT 0,(Ix+d),B |
3888 | instr fetch_nop, op_BIT0, store_nop ;41 ;BIT 0,(Ix+d),C | |
3889 | instr fetch_nop, op_BIT0, store_nop ;42 ;BIT 0,(Ix+d),D | |
3890 | instr fetch_nop, op_BIT0, store_nop ;43 ;BIT 0,(Ix+d),E | |
3891 | instr fetch_nop, op_BIT0, store_nop ;44 ;BIT 0,(Ix+d),H | |
3892 | instr fetch_nop, op_BIT0, store_nop ;45 ;BIT 0,(Ix+d),L | |
3893 | instr fetch_nop, op_BIT0, store_nop ;46 ;BIT 0,(Ix+d) | |
3894 | instr fetch_nop, op_BIT0, store_nop ;47 ;BIT 0,(Ix+d),A | |
3895 | instr fetch_nop, op_BIT1, store_nop ;48 ;BIT 1,(Ix+d),B | |
3896 | instr fetch_nop, op_BIT1, store_nop ;49 ;BIT 1,(Ix+d),C | |
3897 | instr fetch_nop, op_BIT1, store_nop ;4A ;BIT 1,(Ix+d),D | |
3898 | instr fetch_nop, op_BIT1, store_nop ;4B ;BIT 1,(Ix+d),E | |
3899 | instr fetch_nop, op_BIT1, store_nop ;4C ;BIT 1,(Ix+d),H | |
3900 | instr fetch_nop, op_BIT1, store_nop ;4D ;BIT 1,(Ix+d),L | |
3901 | instr fetch_nop, op_BIT1, store_nop ;4E ;BIT 1,(Ix+d) | |
3902 | instr fetch_nop, op_BIT1, store_nop ;4F ;BIT 1,(Ix+d),A | |
3903 | instr fetch_nop, op_BIT2, store_nop ;50 ;BIT 2,(Ix+d),B | |
3904 | instr fetch_nop, op_BIT2, store_nop ;51 ;BIT 2,(Ix+d),C | |
3905 | instr fetch_nop, op_BIT2, store_nop ;52 ;BIT 2,(Ix+d),D | |
3906 | instr fetch_nop, op_BIT2, store_nop ;53 ;BIT 2,(Ix+d),E | |
3907 | instr fetch_nop, op_BIT2, store_nop ;54 ;BIT 2,(Ix+d),H | |
3908 | instr fetch_nop, op_BIT2, store_nop ;55 ;BIT 2,(Ix+d),L | |
3909 | instr fetch_nop, op_BIT2, store_nop ;56 ;BIT 2,(Ix+d) | |
3910 | instr fetch_nop, op_BIT2, store_nop ;57 ;BIT 2,(Ix+d),A | |
3911 | instr fetch_nop, op_BIT3, store_nop ;58 ;BIT 3,(Ix+d),B | |
3912 | instr fetch_nop, op_BIT3, store_nop ;59 ;BIT 3,(Ix+d),C | |
3913 | instr fetch_nop, op_BIT3, store_nop ;5A ;BIT 3,(Ix+d),D | |
3914 | instr fetch_nop, op_BIT3, store_nop ;5B ;BIT 3,(Ix+d),E | |
3915 | instr fetch_nop, op_BIT3, store_nop ;5C ;BIT 3,(Ix+d),H | |
3916 | instr fetch_nop, op_BIT3, store_nop ;5D ;BIT 3,(Ix+d),L | |
3917 | instr fetch_nop, op_BIT3, store_nop ;5E ;BIT 3,(Ix+d) | |
3918 | instr fetch_nop, op_BIT3, store_nop ;5F ;BIT 3,(Ix+d),A | |
3919 | instr fetch_nop, op_BIT4, store_nop ;60 ;BIT 4,(Ix+d),B | |
3920 | instr fetch_nop, op_BIT4, store_nop ;61 ;BIT 4,(Ix+d),C | |
3921 | instr fetch_nop, op_BIT4, store_nop ;62 ;BIT 4,(Ix+d),D | |
3922 | instr fetch_nop, op_BIT4, store_nop ;63 ;BIT 4,(Ix+d),E | |
3923 | instr fetch_nop, op_BIT4, store_nop ;64 ;BIT 4,(Ix+d),H | |
3924 | instr fetch_nop, op_BIT4, store_nop ;65 ;BIT 4,(Ix+d),L | |
3925 | instr fetch_nop, op_BIT4, store_nop ;66 ;BIT 4,(Ix+d) | |
3926 | instr fetch_nop, op_BIT4, store_nop ;67 ;BIT 4,(Ix+d),A | |
3927 | instr fetch_nop, op_BIT5, store_nop ;68 ;BIT 5,(Ix+d),B | |
3928 | instr fetch_nop, op_BIT5, store_nop ;69 ;BIT 5,(Ix+d),C | |
3929 | instr fetch_nop, op_BIT5, store_nop ;6A ;BIT 5,(Ix+d),D | |
3930 | instr fetch_nop, op_BIT5, store_nop ;6B ;BIT 5,(Ix+d),E | |
3931 | instr fetch_nop, op_BIT5, store_nop ;6C ;BIT 5,(Ix+d),H | |
3932 | instr fetch_nop, op_BIT5, store_nop ;6D ;BIT 5,(Ix+d),L | |
3933 | instr fetch_nop, op_BIT5, store_nop ;6E ;BIT 5,(Ix+d) | |
3934 | instr fetch_nop, op_BIT5, store_nop ;6F ;BIT 5,(Ix+d),A | |
3935 | instr fetch_nop, op_BIT6, store_nop ;70 ;BIT 6,(Ix+d),B | |
3936 | instr fetch_nop, op_BIT6, store_nop ;71 ;BIT 6,(Ix+d),C | |
3937 | instr fetch_nop, op_BIT6, store_nop ;72 ;BIT 6,(Ix+d),D | |
3938 | instr fetch_nop, op_BIT6, store_nop ;73 ;BIT 6,(Ix+d),E | |
3939 | instr fetch_nop, op_BIT6, store_nop ;74 ;BIT 6,(Ix+d),H | |
3940 | instr fetch_nop, op_BIT6, store_nop ;75 ;BIT 6,(Ix+d),L | |
3941 | instr fetch_nop, op_BIT6, store_nop ;76 ;BIT 6,(Ix+d) | |
3942 | instr fetch_nop, op_BIT6, store_nop ;77 ;BIT 6,(Ix+d),A | |
3943 | instr fetch_nop, op_BIT7, store_nop ;78 ;BIT 7,(Ix+d),B | |
3944 | instr fetch_nop, op_BIT7, store_nop ;79 ;BIT 7,(Ix+d),C | |
3945 | instr fetch_nop, op_BIT7, store_nop ;7A ;BIT 7,(Ix+d),D | |
3946 | instr fetch_nop, op_BIT7, store_nop ;7B ;BIT 7,(Ix+d),E | |
3947 | instr fetch_nop, op_BIT7, store_nop ;7C ;BIT 7,(Ix+d),H | |
3948 | instr fetch_nop, op_BIT7, store_nop ;7D ;BIT 7,(Ix+d),L | |
3949 | instr fetch_nop, op_BIT7, store_nop ;7E ;BIT 7,(Ix+d) | |
3950 | instr fetch_nop, op_BIT7, store_nop ;7F ;BIT 7,(Ix+d),A | |
3951 | instr fetch_nop, op_RES0, store_B ;80 ;RES 0,(Ix+d),B | |
3952 | instr fetch_nop, op_RES0, store_C ;81 ;RES 0,(Ix+d),C | |
3953 | instr fetch_nop, op_RES0, store_D ;82 ;RES 0,(Ix+d),D | |
3954 | instr fetch_nop, op_RES0, store_E ;83 ;RES 0,(Ix+d),E | |
3955 | instr fetch_nop, op_RES0, store_H ;84 ;RES 0,(Ix+d),H | |
3956 | instr fetch_nop, op_RES0, store_L ;85 ;RES 0,(Ix+d),L | |
3957 | instr fetch_nop, op_RES0, store_nop ;86 ;RES 0,(Ix+d) | |
3958 | instr fetch_nop, op_RES0, store_A ;87 ;RES 0,(Ix+d),A | |
3959 | instr fetch_nop, op_RES1, store_B ;88 ;RES 1,(Ix+d),B | |
3960 | instr fetch_nop, op_RES1, store_C ;89 ;RES 1,(Ix+d),C | |
3961 | instr fetch_nop, op_RES1, store_D ;8A ;RES 1,(Ix+d),D | |
3962 | instr fetch_nop, op_RES1, store_E ;8B ;RES 1,(Ix+d),E | |
3963 | instr fetch_nop, op_RES1, store_H ;8C ;RES 1,(Ix+d),H | |
3964 | instr fetch_nop, op_RES1, store_L ;8D ;RES 1,(Ix+d),L | |
3965 | instr fetch_nop, op_RES1, store_nop ;8E ;RES 1,(Ix+d) | |
3966 | instr fetch_nop, op_RES1, store_A ;8F ;RES 1,(Ix+d),A | |
3967 | instr fetch_nop, op_RES2, store_B ;90 ;RES 2,(Ix+d),B | |
3968 | instr fetch_nop, op_RES2, store_C ;91 ;RES 2,(Ix+d),C | |
3969 | instr fetch_nop, op_RES2, store_D ;92 ;RES 2,(Ix+d),D | |
3970 | instr fetch_nop, op_RES2, store_E ;93 ;RES 2,(Ix+d),E | |
3971 | instr fetch_nop, op_RES2, store_H ;94 ;RES 2,(Ix+d),H | |
3972 | instr fetch_nop, op_RES2, store_L ;95 ;RES 2,(Ix+d),L | |
3973 | instr fetch_nop, op_RES2, store_nop ;96 ;RES 2,(Ix+d) | |
3974 | instr fetch_nop, op_RES2, store_A ;97 ;RES 2,(Ix+d),A | |
3975 | instr fetch_nop, op_RES3, store_B ;98 ;RES 3,(Ix+d),B | |
3976 | instr fetch_nop, op_RES3, store_C ;99 ;RES 3,(Ix+d),C | |
3977 | instr fetch_nop, op_RES3, store_D ;9A ;RES 3,(Ix+d),D | |
3978 | instr fetch_nop, op_RES3, store_E ;9B ;RES 3,(Ix+d),E | |
3979 | instr fetch_nop, op_RES3, store_H ;9C ;RES 3,(Ix+d),H | |
3980 | instr fetch_nop, op_RES3, store_L ;9D ;RES 3,(Ix+d),L | |
3981 | instr fetch_nop, op_RES3, store_nop ;9E ;RES 3,(Ix+d) | |
3982 | instr fetch_nop, op_RES3, store_A ;9F ;RES 3,(Ix+d),A | |
3983 | instr fetch_nop, op_RES4, store_B ;A0 ;RES 4,(Ix+d),B | |
3984 | instr fetch_nop, op_RES4, store_C ;A1 ;RES 4,(Ix+d),C | |
3985 | instr fetch_nop, op_RES4, store_D ;A2 ;RES 4,(Ix+d),D | |
3986 | instr fetch_nop, op_RES4, store_E ;A3 ;RES 4,(Ix+d),E | |
3987 | instr fetch_nop, op_RES4, store_H ;A4 ;RES 4,(Ix+d),H | |
3988 | instr fetch_nop, op_RES4, store_L ;A5 ;RES 4,(Ix+d),L | |
3989 | instr fetch_nop, op_RES4, store_nop ;A6 ;RES 4,(Ix+d) | |
3990 | instr fetch_nop, op_RES4, store_A ;A7 ;RES 4,(Ix+d),A | |
3991 | instr fetch_nop, op_RES5, store_B ;A8 ;RES 5,(Ix+d),B | |
3992 | instr fetch_nop, op_RES5, store_C ;A9 ;RES 5,(Ix+d),C | |
3993 | instr fetch_nop, op_RES5, store_D ;AA ;RES 5,(Ix+d),D | |
3994 | instr fetch_nop, op_RES5, store_E ;AB ;RES 5,(Ix+d),E | |
3995 | instr fetch_nop, op_RES5, store_H ;AC ;RES 5,(Ix+d),H | |
3996 | instr fetch_nop, op_RES5, store_L ;AD ;RES 5,(Ix+d),L | |
3997 | instr fetch_nop, op_RES5, store_nop ;AE ;RES 5,(Ix+d) | |
3998 | instr fetch_nop, op_RES5, store_A ;AF ;RES 5,(Ix+d),A | |
3999 | instr fetch_nop, op_RES6, store_B ;B0 ;RES 6,(Ix+d),B | |
4000 | instr fetch_nop, op_RES6, store_C ;B1 ;RES 6,(Ix+d),C | |
4001 | instr fetch_nop, op_RES6, store_D ;B2 ;RES 6,(Ix+d),D | |
4002 | instr fetch_nop, op_RES6, store_E ;B3 ;RES 6,(Ix+d),E | |
4003 | instr fetch_nop, op_RES6, store_H ;B4 ;RES 6,(Ix+d),H | |
4004 | instr fetch_nop, op_RES6, store_L ;B5 ;RES 6,(Ix+d),L | |
4005 | instr fetch_nop, op_RES6, store_nop ;B6 ;RES 6,(Ix+d) | |
4006 | instr fetch_nop, op_RES6, store_A ;B7 ;RES 6,(Ix+d),A | |
4007 | instr fetch_nop, op_RES7, store_B ;B8 ;RES 7,(Ix+d),B | |
4008 | instr fetch_nop, op_RES7, store_C ;B9 ;RES 7,(Ix+d),C | |
4009 | instr fetch_nop, op_RES7, store_D ;BA ;RES 7,(Ix+d),D | |
4010 | instr fetch_nop, op_RES7, store_E ;BB ;RES 7,(Ix+d),E | |
4011 | instr fetch_nop, op_RES7, store_H ;BC ;RES 7,(Ix+d),H | |
4012 | instr fetch_nop, op_RES7, store_L ;BD ;RES 7,(Ix+d),L | |
4013 | instr fetch_nop, op_RES7, store_nop ;BE ;RES 7,(Ix+d) | |
4014 | instr fetch_nop, op_RES7, store_A ;BF ;RES 7,(Ix+d),A | |
4015 | instr fetch_nop, op_SET0, store_B ;C0 ;SET 0,(Ix+d),B | |
4016 | instr fetch_nop, op_SET0, store_C ;C1 ;SET 0,(Ix+d),C | |
4017 | instr fetch_nop, op_SET0, store_D ;C2 ;SET 0,(Ix+d),D | |
4018 | instr fetch_nop, op_SET0, store_E ;C3 ;SET 0,(Ix+d),E | |
4019 | instr fetch_nop, op_SET0, store_H ;C4 ;SET 0,(Ix+d),H | |
4020 | instr fetch_nop, op_SET0, store_L ;C5 ;SET 0,(Ix+d),L | |
4021 | instr fetch_nop, op_SET0, store_nop ;C6 ;SET 0,(Ix+d) | |
4022 | instr fetch_nop, op_SET0, store_A ;C7 ;SET 0,(Ix+d),A | |
4023 | instr fetch_nop, op_SET1, store_B ;C8 ;SET 1,(Ix+d),B | |
4024 | instr fetch_nop, op_SET1, store_C ;C9 ;SET 1,(Ix+d),C | |
4025 | instr fetch_nop, op_SET1, store_D ;CA ;SET 1,(Ix+d),D | |
4026 | instr fetch_nop, op_SET1, store_E ;CB ;SET 1,(Ix+d),E | |
4027 | instr fetch_nop, op_SET1, store_H ;CC ;SET 1,(Ix+d),H | |
4028 | instr fetch_nop, op_SET1, store_L ;CD ;SET 1,(Ix+d),L | |
4029 | instr fetch_nop, op_SET1, store_nop ;CE ;SET 1,(Ix+d) | |
4030 | instr fetch_nop, op_SET1, store_A ;CF ;SET 1,(Ix+d),A | |
4031 | instr fetch_nop, op_SET2, store_B ;D0 ;SET 2,(Ix+d),B | |
4032 | instr fetch_nop, op_SET2, store_C ;D1 ;SET 2,(Ix+d),C | |
4033 | instr fetch_nop, op_SET2, store_D ;D2 ;SET 2,(Ix+d),D | |
4034 | instr fetch_nop, op_SET2, store_E ;D3 ;SET 2,(Ix+d),E | |
4035 | instr fetch_nop, op_SET2, store_H ;D4 ;SET 2,(Ix+d),H | |
4036 | instr fetch_nop, op_SET2, store_L ;D5 ;SET 2,(Ix+d),L | |
4037 | instr fetch_nop, op_SET2, store_nop ;D6 ;SET 2,(Ix+d) | |
4038 | instr fetch_nop, op_SET2, store_A ;D7 ;SET 2,(Ix+d),A | |
4039 | instr fetch_nop, op_SET3, store_B ;D8 ;SET 3,(Ix+d),B | |
4040 | instr fetch_nop, op_SET3, store_C ;D9 ;SET 3,(Ix+d),C | |
4041 | instr fetch_nop, op_SET3, store_D ;DA ;SET 3,(Ix+d),D | |
4042 | instr fetch_nop, op_SET3, store_E ;DB ;SET 3,(Ix+d),E | |
4043 | instr fetch_nop, op_SET3, store_H ;DC ;SET 3,(Ix+d),H | |
4044 | instr fetch_nop, op_SET3, store_L ;DD ;SET 3,(Ix+d),L | |
4045 | instr fetch_nop, op_SET3, store_nop ;DE ;SET 3,(Ix+d) | |
4046 | instr fetch_nop, op_SET3, store_A ;DF ;SET 3,(Ix+d),A | |
4047 | instr fetch_nop, op_SET4, store_B ;E0 ;SET 4,(Ix+d),B | |
4048 | instr fetch_nop, op_SET4, store_C ;E1 ;SET 4,(Ix+d),C | |
4049 | instr fetch_nop, op_SET4, store_D ;E2 ;SET 4,(Ix+d),D | |
4050 | instr fetch_nop, op_SET4, store_E ;E3 ;SET 4,(Ix+d),E | |
4051 | instr fetch_nop, op_SET4, store_H ;E4 ;SET 4,(Ix+d),H | |
4052 | instr fetch_nop, op_SET4, store_L ;E5 ;SET 4,(Ix+d),L | |
4053 | instr fetch_nop, op_SET4, store_nop ;E6 ;SET 4,(Ix+d) | |
4054 | instr fetch_nop, op_SET4, store_A ;E7 ;SET 4,(Ix+d),A | |
4055 | instr fetch_nop, op_SET5, store_B ;E8 ;SET 5,(Ix+d),B | |
4056 | instr fetch_nop, op_SET5, store_C ;E9 ;SET 5,(Ix+d),C | |
4057 | instr fetch_nop, op_SET5, store_D ;EA ;SET 5,(Ix+d),D | |
4058 | instr fetch_nop, op_SET5, store_E ;EB ;SET 5,(Ix+d),E | |
4059 | instr fetch_nop, op_SET5, store_H ;EC ;SET 5,(Ix+d),H | |
4060 | instr fetch_nop, op_SET5, store_L ;ED ;SET 5,(Ix+d),L | |
4061 | instr fetch_nop, op_SET5, store_nop ;EE ;SET 5,(Ix+d) | |
4062 | instr fetch_nop, op_SET5, store_A ;EF ;SET 5,(Ix+d),A | |
4063 | instr fetch_nop, op_SET6, store_B ;F0 ;SET 6,(Ix+d),B | |
4064 | instr fetch_nop, op_SET6, store_C ;F1 ;SET 6,(Ix+d),C | |
4065 | instr fetch_nop, op_SET6, store_D ;F2 ;SET 6,(Ix+d),D | |
4066 | instr fetch_nop, op_SET6, store_E ;F3 ;SET 6,(Ix+d),E | |
4067 | instr fetch_nop, op_SET6, store_H ;F4 ;SET 6,(Ix+d),H | |
4068 | instr fetch_nop, op_SET6, store_L ;F5 ;SET 6,(Ix+d),L | |
4069 | instr fetch_nop, op_SET6, store_nop ;F6 ;SET 6,(Ix+d) | |
4070 | instr fetch_nop, op_SET6, store_A ;F7 ;SET 6,(Ix+d),A | |
4071 | instr fetch_nop, op_SET7, store_B ;F8 ;SET 7,(Ix+d),B | |
4072 | instr fetch_nop, op_SET7, store_C ;F9 ;SET 7,(Ix+d),C | |
4073 | instr fetch_nop, op_SET7, store_D ;FA ;SET 7,(Ix+d),D | |
4074 | instr fetch_nop, op_SET7, store_E ;FB ;SET 7,(Ix+d),E | |
4075 | instr fetch_nop, op_SET7, store_H ;FC ;SET 7,(Ix+d),H | |
4076 | instr fetch_nop, op_SET7, store_L ;FD ;SET 7,(Ix+d),L | |
4077 | instr fetch_nop, op_SET7, store_nop ;FE ;SET 7,(Ix+d) | |
4078 | instr fetch_nop, op_SET7, store_A ;FF ;SET 7,(Ix+d),A | |
fa9059af L |
4079 | |
4080 | ||
4081 | #endif | |
4082 | ||
4083 | ;---------------------------------------------------------------- | |
4084 | ; Lookup table, stolen from z80ex, Z80 emulation library. | |
4085 | ; http://z80ex.sourceforge.net/ | |
4086 | ||
4087 | ; The S, Z, 5 and 3 bits and the parity of the lookup value | |
4088 | ||
4089 | ; .org (PC+255) & 0xff00 | |
4090 | ; .org opcjmp + 256 | |
e7a0f403 L |
4091 | .org sz53p_table_pos |
4092 | ; .org FLASHEND & 0xff00 | |
4c92af0d | 4093 | ; .org 0x1fff & 0xff00 |
fa9059af L |
4094 | |
4095 | sz53p_tab: | |
4096 | .db 0x44,0x00,0x00,0x04,0x00,0x04,0x04,0x00 | |
4097 | .db 0x08,0x0c,0x0c,0x08,0x0c,0x08,0x08,0x0c | |
4098 | .db 0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04 | |
4099 | .db 0x0c,0x08,0x08,0x0c,0x08,0x0c,0x0c,0x08 | |
4100 | .db 0x20,0x24,0x24,0x20,0x24,0x20,0x20,0x24 | |
4101 | .db 0x2c,0x28,0x28,0x2c,0x28,0x2c,0x2c,0x28 | |
4102 | .db 0x24,0x20,0x20,0x24,0x20,0x24,0x24,0x20 | |
4103 | .db 0x28,0x2c,0x2c,0x28,0x2c,0x28,0x28,0x2c | |
4104 | .db 0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04 | |
4105 | .db 0x0c,0x08,0x08,0x0c,0x08,0x0c,0x0c,0x08 | |
4106 | .db 0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00 | |
4107 | .db 0x08,0x0c,0x0c,0x08,0x0c,0x08,0x08,0x0c | |
4108 | .db 0x24,0x20,0x20,0x24,0x20,0x24,0x24,0x20 | |
4109 | .db 0x28,0x2c,0x2c,0x28,0x2c,0x28,0x28,0x2c | |
4110 | .db 0x20,0x24,0x24,0x20,0x24,0x20,0x20,0x24 | |
4111 | .db 0x2c,0x28,0x28,0x2c,0x28,0x2c,0x2c,0x28 | |
4112 | .db 0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84 | |
4113 | .db 0x8c,0x88,0x88,0x8c,0x88,0x8c,0x8c,0x88 | |
4114 | .db 0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80 | |
4115 | .db 0x88,0x8c,0x8c,0x88,0x8c,0x88,0x88,0x8c | |
4116 | .db 0xa4,0xa0,0xa0,0xa4,0xa0,0xa4,0xa4,0xa0 | |
4117 | .db 0xa8,0xac,0xac,0xa8,0xac,0xa8,0xa8,0xac | |
4118 | .db 0xa0,0xa4,0xa4,0xa0,0xa4,0xa0,0xa0,0xa4 | |
4119 | .db 0xac,0xa8,0xa8,0xac,0xa8,0xac,0xac,0xa8 | |
4120 | .db 0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80 | |
4121 | .db 0x88,0x8c,0x8c,0x88,0x8c,0x88,0x88,0x8c | |
4122 | .db 0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84 | |
4123 | .db 0x8c,0x88,0x88,0x8c,0x88,0x8c,0x8c,0x88 | |
4124 | .db 0xa0,0xa4,0xa4,0xa0,0xa4,0xa0,0xa0,0xa4 | |
4125 | .db 0xac,0xa8,0xa8,0xac,0xa8,0xac,0xac,0xa8 | |
4126 | .db 0xa4,0xa0,0xa0,0xa4,0xa0,0xa4,0xa4,0xa0 | |
4127 | .db 0xa8,0xac,0xac,0xa8,0xac,0xa8,0xa8,0xac | |
4128 | ||
4129 | ; vim:set ts=8 noet nowrap | |
4130 |