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