]> cloudbase.mooo.com Git - avrcpm.git/blame - avr/Z80int-jmp.asm
* Z80 1-byte opcodes, ED (except blocktransfer and search instructions) and DD/FD...
[avrcpm.git] / avr / Z80int-jmp.asm
CommitLineData
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
29z_b: .byte 1
30z_c: .byte 1
31z_d: .byte 1
32z_e: .byte 1
33z_h: .byte 1
34z_l: .byte 1
35
36#if EM_Z80
80e1fa71
L
37z_flags2: .byte 1
38z_a2: .byte 1
39z_b2: .byte 1
40z_c2: .byte 1
41z_d2: .byte 1
42z_e2: .byte 1
43z_h2: .byte 1
44z_l2: .byte 1
45
fa9059af
L
46z_xh: .byte 1
47z_xl: .byte 1
48z_yh: .byte 1
49z_yl: .byte 1
50
51z_i: .byte 1
52z_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
61z80_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
76main:
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 " "
89noprintpc:
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 97int_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
104int_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
112int_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
120int_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
226fetch_ops:
227do_fetch_nop:
228 ret
229
230do_fetch_a:
231 mov opl,z_a
232 ret
233
234do_fetch_b:
235 lds opl,z_b
236 ret
237
238do_fetch_c:
239 lds opl,z_c
240 ret
241
242do_fetch_d:
243 lds opl,z_d
244 ret
245
246do_fetch_e:
247 lds opl,z_e
248 ret
249
250do_fetch_h:
251 lds opl,z_h
252 ret
253
254do_fetch_l:
255 lds opl,z_l
256 ret
257
258do_fetch_af:
259 mov opl,z_flags
260 mov oph,z_a
261 ret
262
263do_fetch_bc:
264 lds opl,z_c
265 lds oph,z_b
266 ret
267
268do_fetch_de:
269 lds opl,z_e
270 lds oph,z_d
271 ret
272
273do_fetch_hl:
274 lds opl,z_l
275 lds oph,z_h
276 ret
277
278do_fetch_sp:
279 movw opl,z_spl
280 ret
281
282do_fetch_mbc:
283 lds xh,z_b
284 lds xl,z_c
285 mem_read_d z_a
286 ret
287
288do_fetch_mde:
289 lds xh,z_d
290 lds xl,z_e
291 mem_read_d z_a
292 ret
293
294do_fetch_mhl:
295 lds xh,z_h
296 lds xl,z_l
297 mem_read_d opl
298 ret
299
300do_fetch_msp:
301 movw x,z_spl
302 mem_read_d opl
303 adiw x,1
304 mem_read_d oph
305 ret
306
307do_fetch_dir8:
308 mem_read_ds opl, z_pc
309 adiw z_pcl,1
310 ret
311
312do_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
319do_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
330store_ops:
331do_store_nop:
332 ret
333
334do_store_a:
335 mov z_a,opl
336 ret
337
338do_store_b:
339 sts z_b,opl
340 ret
341
342do_store_c:
343 sts z_c,opl
344 ret
345
346do_store_d:
347 sts z_d,opl
348 ret
349
350do_store_e:
351 sts z_e,opl
352 ret
353
354do_store_h:
355 sts z_h,opl
356 ret
357
358do_store_l:
359 sts z_l,opl
360 ret
361
362do_store_af:
363 mov z_a,oph
364 mov z_flags,opl
365 ret
366
367do_store_bc:
368 sts z_b,oph
369 sts z_c,opl
370 ret
371
372do_store_de:
373 sts z_d,oph
374 sts z_e,opl
375 ret
376
377do_store_hl:
378 sts z_h,oph
379 sts z_l,opl
380 ret
381
382do_store_mbc:
383 lds xh,z_b
384 lds xl,z_c
385 mem_write_s z_a
386 ret
387
388do_store_mde:
389 lds xh,z_d
390 lds xl,z_e
391 mem_write_s z_a
392 ret
393
394do_store_mhl:
395 lds xh,z_h
396 lds xl,z_l
397 mem_write_s opl
398 ret
399
400do_store_msp:
401 movw xl,z_spl
402 mem_write_s opl
403 adiw xl,1
404 mem_write_s oph
405 ret
406
407do_store_sp:
408 movw z_spl,opl
409 ret
410
411do_store_pc:
412 movw z_pcl,opl
413 ret
414
80e1fa71
L
415do_store_pcrel: ;add displacement to PC
416 clr oph
417 tst opl ;sign extend
418 brpl stpcr1
419 com oph
420stpcr1:
421 add z_pcl,opl
422 adc z_pch,oph
423 ret
424
425
fa9059af
L
426do_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
446do_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
468do_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
754do_op_inv:
755 sbiw z_pcl,1
756 lcall printregs
757 printstring "Invalid opcode! "
758
759haltinv:
760 rjmp haltinv
761
762do_op_nop:
763 ret
80e1fa71
L
764
765;----------------------------------------------------------------
766;|Mnemonic |SZHPNC|Description |Notes |
767;----------------------------------------------------------------
768;|HALT |------|Halt | |
769
770
771do_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 :)
788do_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 810do_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;
840do_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
851do_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;
873do_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
884do_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;
903do_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;
915do_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;
928do_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)
937do_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;
948do_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)
957do_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;
968do_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;
987do_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;
1006do_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;
1023do_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;
1043do_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;
1061do_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;
1080do_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;
1101do_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;
1116do_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;
1130do_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;
1144do_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;
1163do_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;
1178do_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;
1191do_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
1250do_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
1257op_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 ; |
1265op_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
1270op_da_02: ;
1271 brcc op_da_a10 ; if
1272 ori temp2,(1<<ZFL_C) ; set new H flag
1273op_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 ;
1278op_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
1282op_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
1289op_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
1296do_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
1302op_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 ; |
1314op_da_a02:
1315 ori oph,0x60 ; add 0x60
1316 ori temp2,(1<<ZFL_C) ; set new C flag
1317op_da_a03: ; endif
1318 rjmp op_da_ae
1319op_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 ;
1324op_da_a12:
1325 ori oph,0x60 ; add 0x60
1326 ori temp2,(1<<ZFL_C) ; set new C flag
1327op_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
1338op_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
1344op_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;
1357do_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;
1369do_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;
1384do_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;
1397do_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;
1425do_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;
1452do_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
1465do_op_di:
1466 ret
1467
1468;----------------------------------------------------------------
1469;|Mnemonic |SZHPNC|Description |Notes |
1470;----------------------------------------------------------------
1471;
1472; TODO: Implement IFF1, IFF2
1473do_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;
1484do_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;
1499do_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;
1514do_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;
1529do_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;
1544do_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;
1559do_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;
1574do_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;
1589do_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
1606do_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
1613opdjnze:
1614 ret
1615
1616
1617;----------------------------------------------------------------
1618;|Mnemonic |SZHPNC|Description |Notes |
1619;----------------------------------------------------------------
1620;|EX AF,AF' |------|Exchange |AF<->AF' |
1621
1622do_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
1638do_op_EXX:
1639 ldiw z,z_b
1640 ldi temp3,6
1641opexx_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
1651do_op_djnz:
1652do_op_EXAF:
1653do_op_EXX:
1654 ret
1655#endif
fa9059af
L
1656
1657#if EM_Z80
1658
1659do_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
1666do_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
1674do_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
1681do_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
1688do_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
1699do_op_prefixED:
1700do_op_prefixDD:
1701do_op_prefixFD:
80e1fa71 1702do_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
1715instr fetch_nop, op_nop, store_nop ;00 ;NOP
1716instr fetch_DIR16, op_nop, store_BC ;01 nn nn ;LD BC,nn
1717instr fetch_nop, op_nop, store_MBC ;02 ;LD (BC),A
1718instr fetch_BC, op_INC16, store_BC ;03 ;INC BC
1719instr fetch_B, op_INC, store_B ;04 ;INC B
1720instr fetch_B, op_DEC, store_B ;05 ;DEC B
1721instr fetch_DIR8, op_nop, store_B ;06 ;LD B,n
1722instr fetch_nop, op_RLCA, store_nop ;07 ;RLCA
80e1fa71
L
1723instr fetch_nop, op_EXAF, store_nop ;08 ;EX AF,AF'
1724instr fetch_BC, op_ADDHL, store_nop ;09 ;ADD HL,BC
fa9059af
L
1725instr fetch_MBC, op_nop, store_nop ;0A ;LD A,(BC)
1726instr fetch_BC, op_DEC16, store_BC ;0B ;DEC BC
1727instr fetch_C, op_INC, store_C ;0C ;INC C
1728instr fetch_C, op_DEC, store_C ;0D ;DEC C
1729instr fetch_DIR8, op_nop, store_C ;0E nn ;LD C,n
1730instr fetch_nop, op_RRCA, store_nop ;0F ;RRCA
80e1fa71 1731instr fetch_DIR8, op_DJNZ, store_pcrel ;10 oo ;DJNZ o
fa9059af
L
1732instr fetch_DIR16, op_nop, store_DE ;11 nn nn ;LD DE,nn
1733instr fetch_nop, op_nop, store_MDE ;12 ;LD (DE),A
1734instr fetch_DE, op_INC16, store_DE ;13 ;INC DE
1735instr fetch_D, op_INC, store_D ;14 ;INC D
1736instr fetch_D, op_DEC, store_D ;15 ;DEC D
1737instr fetch_DIR8, op_nop, store_D ;16 nn ;LD D,n
1738instr fetch_nop, op_RLA, store_nop ;17 ;RLA
80e1fa71
L
1739instr fetch_DIR8, op_nop, store_pcrel ;18 oo ;JR o
1740instr fetch_DE, op_ADDHL, store_nop ;19 ;ADD HL,DE
fa9059af
L
1741instr fetch_MDE, op_nop, store_nop ;1A ;LD A,(DE)
1742instr fetch_DE, op_DEC16, store_DE ;1B ;DEC DE
1743instr fetch_E, op_INC, store_E ;1C ;INC E
1744instr fetch_E, op_DEC, store_E ;1D ;DEC E
1745instr fetch_DIR8, op_nop, store_E ;1E nn ;LD E,n
1746instr fetch_nop, op_RRA, store_nop ;1F ;RRA
80e1fa71 1747instr fetch_DIR8, op_IFNZ, store_pcrel ;20 oo ;JR NZ,o
fa9059af
L
1748instr fetch_DIR16, op_nop, store_HL ;21 nn nn ;LD HL,nn
1749instr fetch_DIR16, op_STHL, store_nop ;22 nn nn ;LD (nn),HL
1750instr fetch_HL, op_INC16, store_HL ;23 ;INC HL
1751instr fetch_H, op_INC, store_H ;24 ;INC H
1752instr fetch_H, op_DEC, store_H ;25 ;DEC H
1753instr fetch_DIR8, op_nop, store_H ;26 nn ;LD H,n
1754instr fetch_A, op_DA, store_A ;27 ;DAA
80e1fa71
L
1755instr fetch_DIR8, op_IFZ, store_pcrel ;28 oo ;JR Z,o
1756instr fetch_HL, op_ADDHL, store_nop ;29 ;ADD HL,HL
fa9059af
L
1757instr fetch_DIR16, op_RMEM16, store_HL ;2A nn nn ;LD HL,(nn)
1758instr fetch_HL, op_DEC16, store_HL ;2B ;DEC HL
1759instr fetch_L, op_INC, store_L ;2C ;INC L
1760instr fetch_L, op_DEC, store_L ;2D ;DEC L
1761instr fetch_DIR8, op_nop, store_L ;2E nn ;LD L,n
1762instr fetch_nop, op_CPL, store_nop ;2F ;CPL
80e1fa71 1763instr fetch_DIR8, op_IFNC, store_pcrel ;30 oo ;JR NC,o
fa9059af
L
1764instr fetch_DIR16, op_nop, store_SP ;31 nn nn ;LD SP,nn
1765instr fetch_DIR16, op_nop, store_AM ;32 nn nn ;LD (nn),A
1766instr fetch_SP, op_INC16, store_SP ;33 ;INC SP
1767instr fetch_MHL, op_INC, store_MHL ;34 ;INC (HL)
1768instr fetch_MHL, op_DEC, store_MHL ;35 ;DEC (HL)
1769instr fetch_DIR8, op_nop, store_MHL ;36 nn ;LD (HL),n
1770instr fetch_nop, op_SCF, store_nop ;37 ;SCF
80e1fa71
L
1771instr fetch_DIR8, op_IFC, store_pcrel ;38 oo ;JR C,o
1772instr fetch_SP, op_ADDHL, store_nop ;39 ;ADD HL,SP
fa9059af
L
1773instr fetch_DIR16, op_RMEM8, store_A ;3A nn nn ;LD A,(nn)
1774instr fetch_SP, op_DEC16, store_SP ;3B ;DEC SP
1775instr fetch_nop, op_INCA, store_nop ;3C ;INC A
1776instr fetch_nop, op_DECA, store_nop ;3D ;DEC A
1777instr fetch_DIR8, op_nop, store_A ;3E nn ;LD A,n
1778instr fetch_nop, op_CCF, store_nop ;3F ;CCF (Complement Carry Flag, gvd)
1779instr fetch_nop, op_nop, store_nop ;40 ;LD B,B
1780instr fetch_C, op_nop, store_B ;41 ;LD B,C
1781instr fetch_D, op_nop, store_B ;42 ;LD B,D
1782instr fetch_E, op_nop, store_B ;43 ;LD B,E
1783instr fetch_H, op_nop, store_B ;44 ;LD B,H
1784instr fetch_L, op_nop, store_B ;45 ;LD B,L
1785instr fetch_MHL, op_nop, store_B ;46 ;LD B,(HL)
1786instr fetch_A, op_nop, store_B ;47 ;LD B,A
1787instr fetch_B, op_nop, store_C ;48 ;LD C,B
1788instr fetch_nop, op_nop, store_nop ;49 ;LD C,C
1789instr fetch_D, op_nop, store_C ;4A ;LD C,D
1790instr fetch_E, op_nop, store_C ;4B ;LD C,E
1791instr fetch_H, op_nop, store_C ;4C ;LD C,H
1792instr fetch_L, op_nop, store_C ;4D ;LD C,L
1793instr fetch_MHL, op_nop, store_C ;4E ;LD C,(HL)
1794instr fetch_A, op_nop, store_C ;4F ;LD C,A
1795instr fetch_B, op_nop, store_D ;50 ;LD D,B
1796instr fetch_C, op_nop, store_D ;51 ;LD D,C
1797instr fetch_nop, op_nop, store_nop ;52 ;LD D,D
1798instr fetch_E, op_nop, store_D ;53 ;LD D,E
1799instr fetch_H, op_nop, store_D ;54 ;LD D,H
1800instr fetch_L, op_nop, store_D ;55 ;LD D,L
1801instr fetch_MHL, op_nop, store_D ;56 ;LD D,(HL)
1802instr fetch_A, op_nop, store_D ;57 ;LD D,A
1803instr fetch_B, op_nop, store_E ;58 ;LD E,B
1804instr fetch_C, op_nop, store_E ;59 ;LD E,C
1805instr fetch_D, op_nop, store_E ;5A ;LD E,D
1806instr fetch_nop, op_nop, store_nop ;5B ;LD E,E
1807instr fetch_H, op_nop, store_E ;5C ;LD E,H
1808instr fetch_L, op_nop, store_E ;5D ;LD E,L
1809instr fetch_MHL, op_nop, store_E ;5E ;LD E,(HL)
1810instr fetch_A, op_nop, store_E ;5F ;LD E,A
1811instr fetch_B, op_nop, store_H ;60 ;LD H,B
1812instr fetch_C, op_nop, store_H ;61 ;LD H,C
1813instr fetch_D, op_nop, store_H ;62 ;LD H,D
1814instr fetch_E, op_nop, store_H ;63 ;LD H,E
1815instr fetch_nop, op_nop, store_nop ;64 ;LD H,H
1816instr fetch_L, op_nop, store_H ;65 ;LD H,L
1817instr fetch_MHL, op_nop, store_H ;66 ;LD H,(HL)
1818instr fetch_A, op_nop, store_H ;67 ;LD H,A
1819instr fetch_B, op_nop, store_L ;68 ;LD L,B
1820instr fetch_C, op_nop, store_L ;69 ;LD L,C
1821instr fetch_D, op_nop, store_L ;6A ;LD L,D
1822instr fetch_E, op_nop, store_L ;6B ;LD L,E
1823instr fetch_H, op_nop, store_L ;6C ;LD L,H
1824instr fetch_nop, op_nop, store_nop ;6D ;LD L,L
1825instr fetch_MHL, op_nop, store_L ;6E ;LD L,(HL)
1826instr fetch_A, op_nop, store_L ;6F ;LD L,A
1827instr fetch_B, op_nop, store_MHL ;70 ;LD (HL),B
1828instr fetch_C, op_nop, store_MHL ;71 ;LD (HL),C
1829instr fetch_D, op_nop, store_MHL ;72 ;LD (HL),D
1830instr fetch_E, op_nop, store_MHL ;73 ;LD (HL),E
1831instr fetch_H, op_nop, store_MHL ;74 ;LD (HL),H
1832instr fetch_L, op_nop, store_MHL ;75 ;LD (HL),L
80e1fa71 1833instr fetch_nop, op_HALT, store_nop ;76 ;HALT
fa9059af
L
1834instr fetch_A, op_nop, store_MHL ;77 ;LD (HL),A
1835instr fetch_B, op_nop, store_A ;78 ;LD A,B
1836instr fetch_C, op_nop, store_A ;79 ;LD A,C
1837instr fetch_D, op_nop, store_A ;7A ;LD A,D
1838instr fetch_E, op_nop, store_A ;7B ;LD A,E
1839instr fetch_H, op_nop, store_A ;7C ;LD A,H
1840instr fetch_L, op_nop, store_A ;7D ;LD A,L
1841instr fetch_MHL, op_nop, store_A ;7E ;LD A,(HL)
1842instr fetch_nop, op_nop, store_nop ;7F ;LD A,A
1843instr fetch_B, op_ADDA, store_nop ;80 ;ADD A,B
1844instr fetch_C, op_ADDA, store_nop ;81 ;ADD A,C
1845instr fetch_D, op_ADDA, store_nop ;82 ;ADD A,D
1846instr fetch_E, op_ADDA, store_nop ;83 ;ADD A,E
1847instr fetch_H, op_ADDA, store_nop ;84 ;ADD A,H
1848instr fetch_L, op_ADDA, store_nop ;85 ;ADD A,L
1849instr fetch_MHL, op_ADDA, store_nop ;86 ;ADD A,(HL)
1850instr fetch_A, op_ADDA, store_nop ;87 ;ADD A,A
1851instr fetch_B, op_ADCA, store_nop ;88 ;ADC A,B
1852instr fetch_C, op_ADCA, store_nop ;89 ;ADC A,C
1853instr fetch_D, op_ADCA, store_nop ;8A ;ADC A,D
1854instr fetch_E, op_ADCA, store_nop ;8B ;ADC A,E
1855instr fetch_H, op_ADCA, store_nop ;8C ;ADC A,H
1856instr fetch_L, op_ADCA, store_nop ;8D ;ADC A,L
1857instr fetch_MHL, op_ADCA, store_nop ;8E ;ADC A,(HL)
1858instr fetch_A, op_ADCA, store_nop ;8F ;ADC A,A
1859instr fetch_B, op_SUBFA, store_nop ;90 ;SUB A,B
1860instr fetch_C, op_SUBFA, store_nop ;91 ;SUB A,C
1861instr fetch_D, op_SUBFA, store_nop ;92 ;SUB A,D
1862instr fetch_E, op_SUBFA, store_nop ;93 ;SUB A,E
1863instr fetch_H, op_SUBFA, store_nop ;94 ;SUB A,H
1864instr fetch_L, op_SUBFA, store_nop ;95 ;SUB A,L
1865instr fetch_MHL, op_SUBFA, store_nop ;96 ;SUB A,(HL)
1866instr fetch_A, op_SUBFA, store_nop ;97 ;SUB A,A
1867instr fetch_B, op_SBCFA, store_nop ;98 ;SBC A,B
1868instr fetch_C, op_SBCFA, store_nop ;99 ;SBC A,C
1869instr fetch_D, op_SBCFA, store_nop ;9A ;SBC A,D
1870instr fetch_E, op_SBCFA, store_nop ;9B ;SBC A,E
1871instr fetch_H, op_SBCFA, store_nop ;9C ;SBC A,H
1872instr fetch_L, op_SBCFA, store_nop ;9D ;SBC A,L
1873instr fetch_MHL, op_SBCFA, store_nop ;9E ;SBC A,(HL)
1874instr fetch_A, op_SBCFA, store_nop ;9F ;SBC A,A
1875instr fetch_B, op_ANDA, store_nop ;A0 ;AND A,B
1876instr fetch_C, op_ANDA, store_nop ;A1 ;AND A,C
1877instr fetch_D, op_ANDA, store_nop ;A2 ;AND A,D
1878instr fetch_E, op_ANDA, store_nop ;A3 ;AND A,E
1879instr fetch_H, op_ANDA, store_nop ;A4 ;AND A,H
1880instr fetch_L, op_ANDA, store_nop ;A5 ;AND A,L
1881instr fetch_MHL, op_ANDA, store_nop ;A6 ;AND A,(HL)
1882instr fetch_A, op_ANDA, store_nop ;A7 ;AND A,A
1883instr fetch_B, op_XORA, store_nop ;A8 ;XOR A,B
1884instr fetch_C, op_XORA, store_nop ;A9 ;XOR A,C
1885instr fetch_D, op_XORA, store_nop ;AA ;XOR A,D
1886instr fetch_E, op_XORA, store_nop ;AB ;XOR A,E
1887instr fetch_H, op_XORA, store_nop ;AC ;XOR A,H
1888instr fetch_L, op_XORA, store_nop ;AD ;XOR A,L
1889instr fetch_MHL, op_XORA, store_nop ;AE ;XOR A,(HL)
1890instr fetch_A, op_XORA, store_nop ;AF ;XOR A,A
1891instr fetch_B, op_ORA, store_nop ;B0 ;OR A,B
1892instr fetch_C, op_ORA, store_nop ;B1 ;OR A,C
1893instr fetch_D, op_ORA, store_nop ;B2 ;OR A,D
1894instr fetch_E, op_ORA, store_nop ;B3 ;OR A,E
1895instr fetch_H, op_ORA, store_nop ;B4 ;OR A,H
1896instr fetch_L, op_ORA, store_nop ;B5 ;OR A,L
1897instr fetch_MHL, op_ORA, store_nop ;B6 ;OR A,(HL)
1898instr fetch_A, op_ORA, store_nop ;B7 ;OR A,A
1899instr fetch_B, op_CPFA, store_nop ;B8 ;CP A,B
1900instr fetch_C, op_CPFA, store_nop ;B9 ;CP A,C
1901instr fetch_D, op_CPFA, store_nop ;BA ;CP A,D
1902instr fetch_E, op_CPFA, store_nop ;BB ;CP A,E
1903instr fetch_H, op_CPFA, store_nop ;BC ;CP A,H
1904instr fetch_L, op_CPFA, store_nop ;BD ;CP A,L
1905instr fetch_MHL, op_CPFA, store_nop ;BE ;CP A,(HL)
1906instr fetch_A, op_CPFA, store_nop ;BF ;CP A,A
1907instr fetch_nop, op_IFNZ, store_RET ;C0 ;RET NZ
1908instr fetch_nop, op_POP16, store_BC ;C1 ;POP BC
1909instr fetch_DIR16, op_IFNZ, store_PC ;C2 nn nn ;JP NZ,nn
1910instr fetch_DIR16, op_nop, store_PC ;C3 nn nn ;JP nn
1911instr fetch_DIR16, op_IFNZ, store_CALL ;C4 nn nn ;CALL NZ,nn
1912instr fetch_BC, op_PUSH16, store_nop ;C5 ;PUSH BC
1913instr fetch_DIR8, op_ADDA, store_nop ;C6 nn ;ADD A,n
1914instr fetch_RST, op_nop, store_CALL ;C7 ;RST 0
1915instr fetch_nop, op_IFZ, store_RET ;C8 ;RET Z
1916instr fetch_nop, op_nop, store_RET ;C9 ;RET
1917instr fetch_DIR16, op_IFZ, store_PC ;CA nn nn ;JP Z,nn
80e1fa71 1918instr fetch_nop, op_prefixCB, store_nop ;CB ;(CB opcode prefix)
fa9059af
L
1919instr fetch_DIR16, op_IFZ, store_CALL ;CC nn nn ;CALL Z,nn
1920instr fetch_DIR16, op_nop, store_CALL ;CD nn nn ;CALL nn
1921instr fetch_DIR8, op_ADCA, store_nop ;CE nn ;ADC A,n
1922instr fetch_RST, op_nop, store_CALL ;CF ;RST 8H
1923instr fetch_nop, op_IFNC, store_RET ;D0 ;RET NC
1924instr fetch_nop, op_POP16, store_DE ;D1 ;POP DE
1925instr fetch_DIR16, op_IFNC, store_PC ;D2 nn nn ;JP NC,nn
1926instr fetch_DIR8, op_OUTA, store_nop ;D3 nn ;OUT (n),A
1927instr fetch_DIR16, op_IFNC, store_CALL ;D4 nn nn ;CALL NC,nn
1928instr fetch_DE, op_PUSH16, store_nop ;D5 ;PUSH DE
1929instr fetch_DIR8, op_SUBFA, store_nop ;D6 nn ;SUB n
1930instr fetch_RST, op_nop, store_CALL ;D7 ;RST 10H
1931instr fetch_nop, op_IFC, store_RET ;D8 ;RET C
80e1fa71 1932instr fetch_nop, op_EXX, store_nop ;D9 ;EXX
fa9059af 1933instr fetch_DIR16, op_IFC, store_PC ;DA nn nn ;JP C,nn
80e1fa71 1934instr fetch_DIR8, op_INA, store_nop ;DB nn ;IN A,(n)
fa9059af
L
1935instr fetch_DIR16, op_IFC, store_CALL ;DC nn nn ;CALL C,nn
1936instr fetch_nop, op_prefixDD, store_nop ;DD ;(FD opcode prefix)
1937instr fetch_DIR8, op_SBCFA, store_nop ;DE nn ;SBC A,n
1938instr fetch_RST, op_nop, store_CALL ;DF ;RST 18H
1939instr fetch_nop, op_IFPO, store_RET ;E0 ;RET PO
1940instr fetch_nop, op_POP16, store_HL ;E1 ;POP HL
1941instr fetch_DIR16, op_IFPO, store_PC ;E2 nn nn ;JP PO,nn
1942instr fetch_MSP, op_EXHL, store_MSP ;E3 ;EX (SP),HL
1943instr fetch_DIR16, op_IFPO, store_CALL ;E4 nn nn ;CALL PO,nn
1944instr fetch_HL, op_PUSH16, store_nop ;E5 ;PUSH HL
1945instr fetch_DIR8, op_ANDA, store_nop ;E6 nn ;AND n
1946instr fetch_RST, op_nop, store_CALL ;E7 ;RST 20H
1947instr fetch_nop, op_IFPE, store_RET ;E8 ;RET PE
1948instr fetch_HL, op_nop, store_PC ;E9 ;JP HL
1949instr fetch_DIR16, op_IFPE, store_PC ;EA nn nn ;JP PE,nn
1950instr fetch_DE, op_EXHL, store_DE ;EB ;EX DE,HL
1951instr fetch_DIR16, op_IFPE, store_CALL ;EC nn nn ;CALL PE,nn
1952instr fetch_nop, op_prefixED, store_nop ;ED ;(ED opcode prefix)
1953instr fetch_DIR8, op_XORA, store_nop ;EE nn ;XOR n
1954instr fetch_RST, op_nop, store_CALL ;EF ;RST 28H
1955instr fetch_nop, op_IFP, store_RET ;F0 ;RET P
1956instr fetch_nop, op_POP16, store_AF ;F1 ;POP AF
1957instr fetch_DIR16, op_IFP, store_PC ;F2 nn nn ;JP P,nn
1958instr fetch_nop, op_DI, store_nop ;F3 ;DI
1959instr fetch_DIR16, op_IFP, store_CALL ;F4 nn nn ;CALL P,nn
1960instr fetch_AF, op_PUSH16, store_nop ;F5 ;PUSH AF
1961instr fetch_DIR8, op_ORA, store_nop ;F6 nn ;OR n
1962instr fetch_RST, op_nop, store_CALL ;F7 ;RST 30H
1963instr fetch_nop, op_IFM, store_RET ;F8 ;RET M
1964instr fetch_HL, op_nop, store_SP ;F9 ;LD SP,HL
1965instr fetch_DIR16, op_IFM, store_PC ;FA nn nn ;JP M,nn
1966instr fetch_nop, op_EI, store_nop ;FB ;EI
1967instr fetch_DIR16, op_IFM, store_CALL ;FC nn nn ;CALL M,nn
1968instr fetch_nop, op_prefixFD, store_nop ;FD ;(FD opcode prefix)
1969instr fetch_DIR8, op_CPFA, store_nop ;FE nn ;CP n
1970instr fetch_RST, op_nop, store_CALL ;FF ;RST 38H
1971
1972
1973#if EM_Z80
1974
1975do_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
1985do_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
2013do_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
2025do_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;
2040do_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;
2055do_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
2068do_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;
2095do_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;
2121do_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
2140do_op_reti:
2141do_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
2151do_op_im0:
2152do_op_im1:
2153do_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
2163do_op_ldai:
2164 lds z_a,z_i
2165 rjmp op_ldar1
2166
2167do_op_ldar:
2168 lds z_a,z_r
2169op_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
2176do_op_ldia:
2177 sts z_i,z_a
2178 ret
2179
2180do_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
2190do_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
2207do_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
2225do_fetch_xh:
2226 sbis flags,prefixfd
2227 lds opl,z_xh
2228 sbic flags,prefixfd
2229 lds opl,z_yh
2230 ret
2231
2232do_fetch_xl:
2233 sbis flags,prefixfd
2234 lds opl,z_xl
2235 sbic flags,prefixfd
2236 lds opl,z_yl
2237 ret
2238
2239
2240do_fetch_mxx:
2241 sbic flags,prefixfd
2242 rjmp fetchmxx_fd
2243 lds xh,z_xh
2244 lds xl,z_xl
2245 rjmp fetchmxx1
2246fetchmxx_fd:
2247 lds xh,z_yh
2248 lds xl,z_yl
2249fetchmxx1:
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
2256fetchmxx2:
2257 add xl,opl ;add displacement
2258 adc xh,oph
2259 mem_read_d opl
2260 ret
2261
2262
fa9059af 2263do_fetch_xx:
80e1fa71
L
2264 sbic flags,prefixfd
2265 rjmp fetchxx_fd
2266 lds opl,z_xl
2267 lds oph,z_xh
2268 ret
2269fetchxx_fd:
2270 lds opl,z_yl
2271 lds oph,z_yh
fa9059af
L
2272 ret
2273
80e1fa71
L
2274
2275do_store_xh:
2276 sbis flags,prefixfd
2277 sts z_xh,opl
2278 sbic flags,prefixfd
2279 sts z_yh,opl
2280 ret
2281
2282do_store_xl:
2283 sbis flags,prefixfd
2284 sts z_xl,opl
2285 sbic flags,prefixfd
2286 sts z_yl,opl
2287 ret
2288
2289
2290do_store_mxx:
2291 sbic flags,prefixfd
2292 rjmp storemxx_fd
2293 lds xh,z_xh
2294 lds xl,z_xl
2295 rjmp storemxx1
2296storemxx_fd:
2297 lds xh,z_yh
2298 lds xl,z_yl
2299storemxx1:
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
2306storemxx2:
2307 add xl,temp ;add displacement
2308 adc xh,temp2
2309 mem_read_d opl
2310 ret
2311
2312do_store_xx:
2313 sbic flags,prefixfd
2314 rjmp storexx_fd
2315 sts z_xl,opl
2316 sts z_xh,oph
2317 ret
2318storexx_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;
2330do_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;
2353do_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
2361opexxx_fd:
2362 lds temp,z_yl
2363 lds temp2,z_yh
2364 sts z_yl,opl
2365 sts z_yh,oph
2366opexxxe:
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;
2377do_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
2387opadx_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
2394opadx_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
2410do_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
2418oplddr_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
2439instr fetch_nop, op_nop, store_nop ;00 ;NOP
2440instr fetch_nop, op_nop, store_nop ;01 ;NOP
2441instr fetch_nop, op_nop, store_nop ;02 ;NOP
2442instr fetch_nop, op_nop, store_nop ;03 ;NOP
2443instr fetch_nop, op_nop, store_nop ;04 ;NOP
2444instr fetch_nop, op_nop, store_nop ;05 ;NOP
2445instr fetch_nop, op_nop, store_nop ;06 ;NOP
2446instr fetch_nop, op_nop, store_nop ;07 ;NOP
2447instr fetch_nop, op_nop, store_nop ;08 ;NOP
2448instr fetch_nop, op_nop, store_nop ;09 ;NOP
2449instr fetch_nop, op_nop, store_nop ;0A ;NOP
2450instr fetch_nop, op_nop, store_nop ;0B ;NOP
2451instr fetch_nop, op_nop, store_nop ;0C ;NOP
2452instr fetch_nop, op_nop, store_nop ;0D ;NOP
2453instr fetch_nop, op_nop, store_nop ;0E ;NOP
2454instr fetch_nop, op_nop, store_nop ;0F ;NOP
2455instr fetch_nop, op_nop, store_nop ;10 ;NOP
2456instr fetch_nop, op_nop, store_nop ;11 ;NOP
2457instr fetch_nop, op_nop, store_nop ;12 ;NOP
2458instr fetch_nop, op_nop, store_nop ;13 ;NOP
2459instr fetch_nop, op_nop, store_nop ;14 ;NOP
2460instr fetch_nop, op_nop, store_nop ;15 ;NOP
2461instr fetch_nop, op_nop, store_nop ;16 ;NOP
2462instr fetch_nop, op_nop, store_nop ;17 ;NOP
2463instr fetch_nop, op_nop, store_nop ;18 ;NOP
2464instr fetch_nop, op_nop, store_nop ;19 ;NOP
2465instr fetch_nop, op_nop, store_nop ;1A ;NOP
2466instr fetch_nop, op_nop, store_nop ;1B ;NOP
2467instr fetch_nop, op_nop, store_nop ;1C ;NOP
2468instr fetch_nop, op_nop, store_nop ;1D ;NOP
2469instr fetch_nop, op_nop, store_nop ;1E ;NOP
2470instr fetch_nop, op_nop, store_nop ;1F ;NOP
2471instr fetch_nop, op_nop, store_nop ;20 ;NOP
2472instr fetch_nop, op_nop, store_nop ;21 ;NOP
2473instr fetch_nop, op_nop, store_nop ;22 ;NOP
2474instr fetch_nop, op_nop, store_nop ;23 ;NOP
2475instr fetch_nop, op_nop, store_nop ;24 ;NOP
2476instr fetch_nop, op_nop, store_nop ;25 ;NOP
2477instr fetch_nop, op_nop, store_nop ;26 ;NOP
2478instr fetch_nop, op_nop, store_nop ;27 ;NOP
2479instr fetch_nop, op_nop, store_nop ;28 ;NOP
2480instr fetch_nop, op_nop, store_nop ;29 ;NOP
2481instr fetch_nop, op_nop, store_nop ;2A ;NOP
2482instr fetch_nop, op_nop, store_nop ;2B ;NOP
2483instr fetch_nop, op_nop, store_nop ;2C ;NOP
2484instr fetch_nop, op_nop, store_nop ;2D ;NOP
2485instr fetch_nop, op_nop, store_nop ;2E ;NOP
2486instr fetch_nop, op_nop, store_nop ;2F ;NOP
2487instr fetch_nop, op_nop, store_nop ;30 ;NOP
2488instr fetch_nop, op_nop, store_nop ;31 ;NOP
2489instr fetch_nop, op_nop, store_nop ;32 ;NOP
2490instr fetch_nop, op_nop, store_nop ;33 ;NOP
2491instr fetch_nop, op_nop, store_nop ;34 ;NOP
2492instr fetch_nop, op_nop, store_nop ;35 ;NOP
2493instr fetch_nop, op_nop, store_nop ;36 ;NOP
2494instr fetch_nop, op_nop, store_nop ;37 ;NOP
2495instr fetch_nop, op_nop, store_nop ;38 ;NOP
2496instr fetch_nop, op_nop, store_nop ;39 ;NOP
2497instr fetch_nop, op_nop, store_nop ;3A ;NOP
2498instr fetch_nop, op_nop, store_nop ;3B ;NOP
2499instr fetch_nop, op_nop, store_nop ;3C ;NOP
2500instr fetch_nop, op_nop, store_nop ;3D ;NOP
2501instr fetch_nop, op_nop, store_nop ;3E ;NOP
2502instr fetch_nop, op_nop, store_nop ;3F ;NOP
2503instr fetch_C, op_IN, store_B ;40 ;IN B,(C)
2504instr fetch_B, op_OUT, store_nop ;41 ;OUT (C),B
2505instr fetch_BC, op_SBCHL, store_nop ;42 ;SBC HL,BC
2506instr fetch_DIR16, op_STBC, store_nop ;43 ;LD (nn),BC
2507instr fetch_nop, op_NEG, store_nop ;44 ;NEG
2508instr fetch_nop, op_retn, store_nop ;45 ;RETN
2509instr fetch_nop, op_IM0, store_nop ;46 ;IM 0
2510instr fetch_nop, op_ldia, store_nop ;47 ;LD I,A
2511instr fetch_C, op_IN, store_C ;48 ;IN C,(C)
2512instr fetch_C, op_OUT, store_nop ;49 ;OUT (C),C
2513instr fetch_BC, op_ADCHL, store_nop ;4A ;ADC HL,BC
2514instr fetch_DIR16, op_RMEM16, store_BC ;4B nn nn ;LD BC,(nn)
2515instr fetch_nop, op_NEG, store_nop ;4C ;NEG
2516instr fetch_nop, op_reti, store_nop ;4D ;RETI
2517instr fetch_nop, op_IM0, store_nop ;4E ;IM 0
2518instr fetch_nop, op_ldra, store_nop ;4F ;LD R,A
2519instr fetch_C, op_IN, store_D ;50 ;IN D,(C)
2520instr fetch_D, op_OUT, store_nop ;51 ;OUT (C),D
2521instr fetch_DE, op_SBCHL, store_nop ;52 ;SBC HL,DE
2522instr fetch_DIR16, op_STDE, store_nop ;53 nn nn ;LD (nn),DE
2523instr fetch_nop, op_NEG, store_nop ;54 ;NEG
2524instr fetch_nop, op_retn, store_nop ;55 ;RETN
2525instr fetch_nop, op_IM1, store_nop ;56 ;IM 1
2526instr fetch_nop, op_ldai, store_nop ;57 ;LD A,I
2527instr fetch_C, op_IN, store_E ;58 ;IN E,(C)
2528instr fetch_E, op_OUT, store_nop ;59 ;OUT (C),E
2529instr fetch_DE, op_ADCHL, store_nop ;5A ;ADC HL,DE
2530instr fetch_DIR16, op_RMEM16, store_DE ;5B nn nn ;LD DE,(nn)
2531instr fetch_nop, op_NEG, store_nop ;5C ;NEG
2532instr fetch_nop, op_retn, store_nop ;5D ;RETN
2533instr fetch_nop, op_IM2, store_nop ;5E ;IM 2
2534instr fetch_nop, op_ldar, store_nop ;5F ;LD A,R
2535instr fetch_C, op_IN, store_H ;60 ;IN H,(C)
2536instr fetch_H, op_OUT, store_nop ;61 ;OUT (C),H
2537instr fetch_HL, op_SBCHL, store_nop ;62 ;SBC HL,HL
2538instr fetch_DIR16, op_STHL, store_nop ;63 nn nn ;LD (nn),HL
2539instr fetch_nop, op_NEG, store_nop ;64 ;NEG
2540instr fetch_nop, op_retn, store_nop ;65 ;RETN
2541instr fetch_nop, op_IM0, store_nop ;66 ;IM 0
2542instr fetch_mhl, op_RRD, store_mhl ;67 ;RRD
2543instr fetch_C, op_IN, store_L ;68 ;IN L,(C)
2544instr fetch_L, op_OUT, store_nop ;69 ;OUT (C),L
2545instr fetch_HL, op_ADCHL, store_nop ;6A ;ADC HL,HL
2546instr fetch_DIR16, op_RMEM16, store_HL ;6B nn nn ;LD HL,(nn)
2547instr fetch_nop, op_NEG, store_nop ;6C ;NEG
2548instr fetch_nop, op_retn, store_nop ;6D ;RETN
2549instr fetch_nop, op_IM0, store_nop ;6E ;IM 0
2550instr fetch_mhl, op_RLD, store_mhl ;6F ;RLD
2551instr fetch_C, op_IN, store_nop ;70 ;IN (C)
2552instr fetch_0, op_OUT, store_nop ;71 ;OUT (C),0
2553instr fetch_SP, op_SBCHL, store_nop ;72 ;SBC HL,SP
2554instr fetch_DIR16, op_STSP, store_nop ;73 nn nn ;LD (nn),SP
2555instr fetch_nop, op_NEG, store_nop ;74 ;NEG
2556instr fetch_nop, op_retn, store_nop ;75 ;RETN
2557instr fetch_nop, op_IM1, store_nop ;76 ;IM 1
2558instr fetch_nop, op_nop, store_nop ;77 ;NOP
2559instr fetch_C, op_IN, store_A ;78 ;IN A,(C)
2560instr fetch_A, op_OUT, store_nop ;79 ;OUT (C),A
2561instr fetch_SP, op_ADCHL, store_nop ;7A ;ADC HL,SP
2562instr fetch_DIR16, op_RMEM16, store_SP ;7B nn nn ;LD SP,(nn)
2563instr fetch_nop, op_NEG, store_nop ;7C ;NEG
2564instr fetch_nop, op_retn, store_nop ;7D ;RETN
2565instr fetch_nop, op_IM2, store_nop ;7E ;IM 2
2566instr fetch_nop, op_nop, store_nop ;7F ;NOP
2567instr fetch_nop, op_nop, store_nop ;80 ;NOP
2568instr fetch_nop, op_nop, store_nop ;81 ;NOP
2569instr fetch_nop, op_nop, store_nop ;82 ;NOP
2570instr fetch_nop, op_nop, store_nop ;83 ;NOP
2571instr fetch_nop, op_nop, store_nop ;84 ;NOP
2572instr fetch_nop, op_nop, store_nop ;85 ;NOP
2573instr fetch_nop, op_nop, store_nop ;86 ;NOP
2574instr fetch_nop, op_nop, store_nop ;87 ;NOP
2575instr fetch_nop, op_nop, store_nop ;88 ;NOP
2576instr fetch_nop, op_nop, store_nop ;89 ;NOP
2577instr fetch_nop, op_nop, store_nop ;8A ;NOP
2578instr fetch_nop, op_nop, store_nop ;8B ;NOP
2579instr fetch_nop, op_nop, store_nop ;8C ;NOP
2580instr fetch_nop, op_nop, store_nop ;8D ;NOP
2581instr fetch_nop, op_nop, store_nop ;8E ;NOP
2582instr fetch_nop, op_nop, store_nop ;8F ;NOP
2583instr fetch_nop, op_nop, store_nop ;90 ;NOP
2584instr fetch_nop, op_nop, store_nop ;91 ;NOP
2585instr fetch_nop, op_nop, store_nop ;92 ;NOP
2586instr fetch_nop, op_nop, store_nop ;93 ;NOP
2587instr fetch_nop, op_nop, store_nop ;94 ;NOP
2588instr fetch_nop, op_nop, store_nop ;95 ;NOP
2589instr fetch_nop, op_nop, store_nop ;96 ;NOP
2590instr fetch_nop, op_nop, store_nop ;97 ;NOP
2591instr fetch_nop, op_nop, store_nop ;98 ;NOP
2592instr fetch_nop, op_nop, store_nop ;99 ;NOP
2593instr fetch_nop, op_nop, store_nop ;9A ;NOP
2594instr fetch_nop, op_nop, store_nop ;9B ;NOP
2595instr fetch_nop, op_nop, store_nop ;9C ;NOP
2596instr fetch_nop, op_nop, store_nop ;9D ;NOP
2597instr fetch_nop, op_nop, store_nop ;9E ;NOP
2598instr fetch_nop, op_nop, store_nop ;9F ;NOP
2599instr fetch_nop, op_nop, store_nop ;A0 ; TODO:
2600instr fetch_nop, op_nop, store_nop ;A1 ;
2601instr fetch_nop, op_nop, store_nop ;A2 ;
2602instr fetch_nop, op_nop, store_nop ;A3 ;
2603instr fetch_nop, op_nop, store_nop ;A4 ;NOP
2604instr fetch_nop, op_nop, store_nop ;A5 ;NOP
2605instr fetch_nop, op_nop, store_nop ;A6 ;NOP
2606instr fetch_nop, op_nop, store_nop ;A7 ;NOP
2607instr fetch_nop, op_nop, store_nop ;A8 ;
2608instr fetch_nop, op_nop, store_nop ;A9 ;
2609instr fetch_nop, op_nop, store_nop ;AA ;
2610instr fetch_nop, op_nop, store_nop ;AB ;
2611instr fetch_nop, op_nop, store_nop ;AC ;NOP
2612instr fetch_nop, op_nop, store_nop ;AD ;NOP
2613instr fetch_nop, op_nop, store_nop ;AE ;NOP
2614instr fetch_nop, op_nop, store_nop ;AF ;NOP
2615instr fetch_nop, op_nop, store_nop ;B0 ;
2616instr fetch_nop, op_nop, store_nop ;B1 ;
2617instr fetch_nop, op_nop, store_nop ;B2 ;
2618instr fetch_nop, op_nop, store_nop ;B3 ;
2619instr fetch_nop, op_nop, store_nop ;B4 ;NOP
2620instr fetch_nop, op_nop, store_nop ;B5 ;NOP
2621instr fetch_nop, op_nop, store_nop ;B6 ;NOP
2622instr fetch_nop, op_nop, store_nop ;B7 ;NOP
80e1fa71 2623instr fetch_nop, op_LDDR, store_nop ;B8 ;LDDR
fa9059af
L
2624instr fetch_nop, op_nop, store_nop ;B9 ;
2625instr fetch_nop, op_nop, store_nop ;BA ;
2626instr fetch_nop, op_nop, store_nop ;BB ; TODO:
2627instr fetch_nop, op_nop, store_nop ;BC ;NOP
2628instr fetch_nop, op_nop, store_nop ;BD ;NOP
2629instr fetch_nop, op_nop, store_nop ;BE ;NOP
2630instr fetch_nop, op_nop, store_nop ;BF ;NOP
2631instr fetch_nop, op_nop, store_nop ;C0 ;NOP
2632instr fetch_nop, op_nop, store_nop ;C1 ;NOP
2633instr fetch_nop, op_nop, store_nop ;C2 ;NOP
2634instr fetch_nop, op_nop, store_nop ;C3 ;NOP
2635instr fetch_nop, op_nop, store_nop ;C4 ;NOP
2636instr fetch_nop, op_nop, store_nop ;C5 ;NOP
2637instr fetch_nop, op_nop, store_nop ;C6 ;NOP
2638instr fetch_nop, op_nop, store_nop ;C7 ;NOP
2639instr fetch_nop, op_nop, store_nop ;C8 ;NOP
2640instr fetch_nop, op_nop, store_nop ;C9 ;NOP
2641instr fetch_nop, op_nop, store_nop ;CA ;NOP
2642instr fetch_nop, op_nop, store_nop ;CB ;NOP
2643instr fetch_nop, op_nop, store_nop ;CC ;NOP
2644instr fetch_nop, op_nop, store_nop ;CD ;NOP
2645instr fetch_nop, op_nop, store_nop ;CE ;NOP
2646instr fetch_nop, op_nop, store_nop ;CF ;NOP
2647instr fetch_nop, op_nop, store_nop ;D0 ;NOP
2648instr fetch_nop, op_nop, store_nop ;D1 ;NOP
2649instr fetch_nop, op_nop, store_nop ;D2 ;NOP
2650instr fetch_nop, op_nop, store_nop ;D3 ;NOP
2651instr fetch_nop, op_nop, store_nop ;D4 ;NOP
2652instr fetch_nop, op_nop, store_nop ;D5 ;NOP
2653instr fetch_nop, op_nop, store_nop ;D6 ;NOP
2654instr fetch_nop, op_nop, store_nop ;D7 ;NOP
2655instr fetch_nop, op_nop, store_nop ;D8 ;NOP
2656instr fetch_nop, op_nop, store_nop ;D9 ;NOP
2657instr fetch_nop, op_nop, store_nop ;DA ;NOP
2658instr fetch_nop, op_nop, store_nop ;DB ;NOP
2659instr fetch_nop, op_nop, store_nop ;DC ;NOP
2660instr fetch_nop, op_nop, store_nop ;DD ;NOP
2661instr fetch_nop, op_nop, store_nop ;DE ;NOP
2662instr fetch_nop, op_nop, store_nop ;DF ;NOP
2663instr fetch_nop, op_nop, store_nop ;E0 ;NOP
2664instr fetch_nop, op_nop, store_nop ;E1 ;NOP
2665instr fetch_nop, op_nop, store_nop ;E2 ;NOP
2666instr fetch_nop, op_nop, store_nop ;E3 ;NOP
2667instr fetch_nop, op_nop, store_nop ;E4 ;NOP
2668instr fetch_nop, op_nop, store_nop ;E5 ;NOP
2669instr fetch_nop, op_nop, store_nop ;E6 ;NOP
2670instr fetch_nop, op_nop, store_nop ;E7 ;NOP
2671instr fetch_nop, op_nop, store_nop ;E8 ;NOP
2672instr fetch_nop, op_nop, store_nop ;E9 ;NOP
2673instr fetch_nop, op_nop, store_nop ;EA ;NOP
2674instr fetch_nop, op_nop, store_nop ;EB ;NOP
2675instr fetch_nop, op_nop, store_nop ;EC ;NOP
2676instr fetch_nop, op_nop, store_nop ;ED ;NOP
2677instr fetch_nop, op_nop, store_nop ;EE ;NOP
2678instr fetch_nop, op_nop, store_nop ;EF ;NOP
2679instr fetch_nop, op_nop, store_nop ;F0 ;NOP
2680instr fetch_nop, op_nop, store_nop ;F1 ;NOP
2681instr fetch_nop, op_nop, store_nop ;F2 ;NOP
2682instr fetch_nop, op_nop, store_nop ;F3 ;NOP
2683instr fetch_nop, op_nop, store_nop ;F4 ;NOP
2684instr fetch_nop, op_nop, store_nop ;F5 ;NOP
2685instr fetch_nop, op_nop, store_nop ;F6 ;NOP
2686instr fetch_nop, op_nop, store_nop ;F7 ;NOP
2687instr fetch_nop, op_nop, store_nop ;F8 ;NOP
2688instr fetch_nop, op_nop, store_nop ;F9 ;NOP
2689instr fetch_nop, op_nop, store_nop ;FA ;NOP
2690instr fetch_nop, op_nop, store_nop ;FB ;NOP
2691instr fetch_nop, op_nop, store_nop ;FC ;NOP
2692instr fetch_nop, op_nop, store_nop ;FD ;NOP
2693instr fetch_nop, op_nop, store_nop ;FE ;NOP
2694instr fetch_nop, op_nop, store_nop ;FF ;NOP
2695
2696
2697 opctable DDFDjmp
2698
80e1fa71
L
2699instr fetch_nop, op_nop, store_nop ;00 ;
2700instr fetch_nop, op_nop, store_nop ;01 ;
2701instr fetch_nop, op_nop, store_nop ;02 ;
2702instr fetch_nop, op_nop, store_nop ;03 ;
2703instr fetch_nop, op_nop, store_nop ;04 ;
2704instr fetch_nop, op_nop, store_nop ;05 ;
2705instr fetch_nop, op_nop, store_nop ;06 ;
2706instr fetch_nop, op_nop, store_nop ;07 ;
2707instr fetch_nop, op_nop, store_nop ;08 ;
2708instr fetch_BC, op_ADDxx, store_nop ;09 ;ADD xx,BC
2709instr fetch_nop, op_nop, store_nop ;0A ;
2710instr fetch_nop, op_nop, store_nop ;0B ;
2711instr fetch_nop, op_nop, store_nop ;0C ;
2712instr fetch_nop, op_nop, store_nop ;0D ;
2713instr fetch_nop, op_nop, store_nop ;0E ;
2714instr fetch_nop, op_nop, store_nop ;0F ;
2715instr fetch_nop, op_nop, store_nop ;10 ;
2716instr fetch_nop, op_nop, store_nop ;11 ;
2717instr fetch_nop, op_nop, store_nop ;12 ;
2718instr fetch_nop, op_nop, store_nop ;13 ;
2719instr fetch_nop, op_nop, store_nop ;14 ;
2720instr fetch_nop, op_nop, store_nop ;15 ;
2721instr fetch_nop, op_nop, store_nop ;16 ;
2722instr fetch_nop, op_nop, store_nop ;17 ;
2723instr fetch_nop, op_nop, store_nop ;18 ;
2724instr fetch_DE, op_ADDxx, store_nop ;19 ;ADD xx,DE
2725instr fetch_nop, op_nop, store_nop ;1A ;
2726instr fetch_nop, op_nop, store_nop ;1B ;
2727instr fetch_nop, op_nop, store_nop ;1C ;
2728instr fetch_nop, op_nop, store_nop ;1D ;
2729instr fetch_nop, op_nop, store_nop ;1E ;
2730instr fetch_nop, op_nop, store_nop ;1F ;
2731instr fetch_nop, op_nop, store_nop ;20 ;
2732instr fetch_DIR16, op_nop, store_xx ;21 ;LD xx,nn
2733instr fetch_DIR16, op_STxx, store_nop ;22 ;LD (nn),xx
2734instr fetch_xx, op_INC16, store_xx ;23 ;INC xx
2735instr fetch_xh, op_INC, store_xh ;24 ;INC xh
2736instr fetch_xh, op_DEC, store_xh ;25 ;DEC xh
2737instr fetch_DIR8, op_nop, store_xh ;26 ;LD xh,n
2738instr fetch_nop, op_nop, store_nop ;27 ;
2739instr fetch_nop, op_nop, store_nop ;28 ;
fa9059af 2740instr fetch_xx, op_ADDxx, store_nop ;29 ;ADD xx,xx
80e1fa71
L
2741instr fetch_DIR16, op_RMEM16, store_xx ;2A ;LD xx,(nn)
2742instr fetch_xx, op_DEC16, store_xx ;2B ;DEC xx
2743instr fetch_xl, op_INC, store_xl ;2C ;INC xl
2744instr fetch_xl, op_DEC, store_xl ;2D ;DEC xl
2745instr fetch_DIR8, op_nop, store_xl ;2E ;LD xl,n
2746instr fetch_nop, op_nop, store_nop ;2F ;
2747instr fetch_nop, op_nop, store_nop ;30 ;
2748instr fetch_nop, op_nop, store_nop ;31 ;
2749instr fetch_nop, op_nop, store_nop ;32 ;
2750instr fetch_nop, op_nop, store_nop ;33 ;
2751instr fetch_MXX, op_INC, store_MXX ;34 ;INC (xx+d)
2752instr fetch_MXX, op_DEC, store_MXX ;35 ;DEC (xx+d)
2753instr fetch_DIR8, op_nop, store_MXX ;36 ;LD (xx+d),n
2754instr fetch_nop, op_nop, store_nop ;37 ;
2755instr fetch_nop, op_nop, store_nop ;38 ;
2756instr fetch_SP, op_ADDxx, store_nop ;39 ;ADD xx,SP
2757instr fetch_nop, op_nop, store_nop ;3A ;
2758instr fetch_nop, op_nop, store_nop ;3B ;
2759instr fetch_nop, op_nop, store_nop ;3C ;
2760instr fetch_nop, op_nop, store_nop ;3D ;
2761instr fetch_nop, op_nop, store_nop ;3E ;
2762instr fetch_nop, op_nop, store_nop ;3F ;
2763instr fetch_nop, op_nop, store_nop ;40 ;
2764instr fetch_nop, op_nop, store_nop ;41 ;
2765instr fetch_nop, op_nop, store_nop ;42 ;
2766instr fetch_nop, op_nop, store_nop ;43 ;
2767instr fetch_xh, op_nop, store_B ;44 ;LD B,xh
2768instr fetch_xl, op_nop, store_B ;45 ;LD B,xl
2769instr fetch_MXX, op_nop, store_B ;46 ;LD B,(xx+d)
2770instr fetch_nop, op_nop, store_nop ;47 ;
2771instr fetch_nop, op_nop, store_nop ;48 ;
2772instr fetch_nop, op_nop, store_nop ;49 ;
2773instr fetch_nop, op_nop, store_nop ;4A ;
2774instr fetch_nop, op_nop, store_nop ;4B ;
2775instr fetch_xh, op_nop, store_C ;4C ;LD C,xh
2776instr fetch_xl, op_nop, store_C ;4D ;LD C,xl
2777instr fetch_MXX, op_nop, store_C ;4E ;LD C,(xx+d)
2778instr fetch_nop, op_nop, store_nop ;4F ;
2779instr fetch_nop, op_nop, store_nop ;50 ;
2780instr fetch_nop, op_nop, store_nop ;51 ;
2781instr fetch_nop, op_nop, store_nop ;52 ;
2782instr fetch_nop, op_nop, store_nop ;53 ;
2783instr fetch_xh, op_nop, store_D ;54 ;LD D,xh
2784instr fetch_xl, op_nop, store_D ;55 ;LD D,xl
2785instr fetch_MXX, op_nop, store_D ;56 ;LD D,(xx+d)
2786instr fetch_nop, op_nop, store_nop ;57 ;
2787instr fetch_nop, op_nop, store_nop ;58 ;
2788instr fetch_nop, op_nop, store_nop ;59 ;
2789instr fetch_nop, op_nop, store_nop ;5A ;
2790instr fetch_nop, op_nop, store_nop ;5B ;
2791instr fetch_xh, op_nop, store_E ;5C ;LD E,xh
2792instr fetch_xl, op_nop, store_E ;5D ;LD E,xl
2793instr fetch_MXX, op_nop, store_E ;5E ;LD E,(xx+d)
2794instr fetch_nop, op_nop, store_nop ;5F ;
2795instr fetch_B, op_nop, store_xh ;60 ;LD xh,B
2796instr fetch_C, op_nop, store_xh ;61 ;LD xh,C
2797instr fetch_D, op_nop, store_xh ;62 ;LD xh,D
2798instr fetch_E, op_nop, store_xh ;63 ;LD xh,E
2799instr fetch_nop, op_nop, store_nop ;64 ;LD xh,xh
2800instr fetch_xl, op_nop, store_xh ;65 ;LD xh,xl
2801instr fetch_MXX, op_nop, store_H ;66 ;LD H,(xx+d)
2802instr fetch_A, op_nop, store_xh ;67 ;LD xh,A
2803instr fetch_B, op_nop, store_xl ;68 ;LD xl,B
2804instr fetch_C, op_nop, store_xl ;69 ;LD xl,C
2805instr fetch_D, op_nop, store_xl ;6A ;LD xl,D
2806instr fetch_E, op_nop, store_xl ;6B ;LD xl,E
2807instr fetch_xh, op_nop, store_xl ;6C ;LD xl,xh
2808instr fetch_nop, op_nop, store_nop ;6D ;LD xl,xl
2809instr fetch_MXX, op_nop, store_L ;6E ;LD L,(xx+d)
2810instr fetch_A, op_nop, store_xl ;6F ;LD xl,A
2811instr fetch_B, op_nop, store_MXX ;70 ;LD (xx+d),B
2812instr fetch_C, op_nop, store_MXX ;71 ;LD (xx+d),C
2813instr fetch_D, op_nop, store_MXX ;72 ;LD (xx+d),D
2814instr fetch_E, op_nop, store_MXX ;73 ;LD (xx+d),E
2815instr fetch_H, op_nop, store_MXX ;74 ;LD (xx+d),H
2816instr fetch_L, op_nop, store_MXX ;75 ;LD (xx+d),L
2817instr fetch_nop, op_nop, store_nop ;76 ;
2818instr fetch_A, op_nop, store_MXX ;77 ;LD (xx+d),A
2819instr fetch_nop, op_nop, store_nop ;78 ;
2820instr fetch_nop, op_nop, store_nop ;79 ;
2821instr fetch_nop, op_nop, store_nop ;7A ;
2822instr fetch_nop, op_nop, store_nop ;7B ;
2823instr fetch_xh, op_nop, store_A ;7C ;LD A,xh
2824instr fetch_xl, op_nop, store_A ;7D ;LD A,xl
2825instr fetch_MXX, op_nop, store_A ;7E ;LD A,(xx+d)
2826instr fetch_nop, op_nop, store_nop ;7F ;
2827instr fetch_nop, op_nop, store_nop ;80 ;
2828instr fetch_nop, op_nop, store_nop ;81 ;
2829instr fetch_nop, op_nop, store_nop ;82 ;
2830instr fetch_nop, op_nop, store_nop ;83 ;
2831instr fetch_xh, op_ADDA, store_nop ;84 ;ADD A,xh
2832instr fetch_xl, op_ADDA, store_nop ;85 ;ADD A,xl
2833instr fetch_MXX, op_ADDA, store_nop ;86 ;ADD A,(xx)
2834instr fetch_nop, op_nop, store_nop ;87 ;
2835instr fetch_nop, op_nop, store_nop ;88 ;
2836instr fetch_nop, op_nop, store_nop ;89 ;
2837instr fetch_nop, op_nop, store_nop ;8A ;
2838instr fetch_nop, op_nop, store_nop ;8B ;
2839instr fetch_xh, op_ADCA, store_nop ;8C ;ADC A,xh
2840instr fetch_xl, op_ADCA, store_nop ;8D ;ADC A,xl
2841instr fetch_MXX, op_ADCA, store_nop ;8E ;ADC A,(xx)
2842instr fetch_nop, op_nop, store_nop ;8F ;
2843instr fetch_nop, op_nop, store_nop ;90 ;
2844instr fetch_nop, op_nop, store_nop ;91 ;
2845instr fetch_nop, op_nop, store_nop ;92 ;
2846instr fetch_nop, op_nop, store_nop ;93 ;
2847instr fetch_xh, op_SUBFA, store_nop ;94 ;SUB A,xh
2848instr fetch_xl, op_SUBFA, store_nop ;95 ;SUB A,xl
2849instr fetch_MXX, op_SUBFA, store_nop ;96 ;SUB A,(xx)
2850instr fetch_nop, op_nop, store_nop ;97 ;
2851instr fetch_nop, op_nop, store_nop ;98 ;
2852instr fetch_nop, op_nop, store_nop ;99 ;
2853instr fetch_nop, op_nop, store_nop ;9A ;
2854instr fetch_nop, op_nop, store_nop ;9B ;
2855instr fetch_xh, op_SBCFA, store_nop ;9C ;SBC A,xh
2856instr fetch_xl, op_SBCFA, store_nop ;9D ;SBC A,xl
2857instr fetch_MXX, op_SBCFA, store_nop ;9E ;SBC A,(xx)
2858instr fetch_nop, op_nop, store_nop ;9F ;
2859instr fetch_nop, op_nop, store_nop ;A0 ;
2860instr fetch_nop, op_nop, store_nop ;A1 ;
2861instr fetch_nop, op_nop, store_nop ;A2 ;
2862instr fetch_nop, op_nop, store_nop ;A3 ;
2863instr fetch_xh, op_ANDA, store_nop ;A4 ;AND A,xh
2864instr fetch_xl, op_ANDA, store_nop ;A5 ;AND A,xl
2865instr fetch_MXX, op_ANDA, store_nop ;A6 ;AND A,(xx)
2866instr fetch_nop, op_nop, store_nop ;A7 ;
2867instr fetch_nop, op_nop, store_nop ;A8 ;
2868instr fetch_nop, op_nop, store_nop ;A9 ;
2869instr fetch_nop, op_nop, store_nop ;AA ;
2870instr fetch_nop, op_nop, store_nop ;AB ;
2871instr fetch_xh, op_ANDA, store_nop ;AC ;XOR A,xh
2872instr fetch_xl, op_ANDA, store_nop ;AD ;XOR A,xl
2873instr fetch_MXX, op_ANDA, store_nop ;AE ;XOR A,(xx)
2874instr fetch_nop, op_nop, store_nop ;AF ;
2875instr fetch_nop, op_nop, store_nop ;B0 ;
2876instr fetch_nop, op_nop, store_nop ;B1 ;
2877instr fetch_nop, op_nop, store_nop ;B2 ;
2878instr fetch_nop, op_nop, store_nop ;B3 ;
2879instr fetch_xh, op_ORA, store_nop ;B4 ;OR A,xh
2880instr fetch_xl, op_ORA, store_nop ;B5 ;OR A,xl
2881instr fetch_MXX, op_ORA, store_nop ;B6 ;OR A,(xx)
2882instr fetch_nop, op_nop, store_nop ;B7 ;
2883instr fetch_nop, op_nop, store_nop ;B8 ;
2884instr fetch_nop, op_nop, store_nop ;B9 ;
2885instr fetch_nop, op_nop, store_nop ;BA ;
2886instr fetch_nop, op_nop, store_nop ;BB ;
2887instr fetch_xh, op_CPFA, store_nop ;BC ;CP A,xh
2888instr fetch_xl, op_CPFA, store_nop ;BD ;CP A,xl
2889instr fetch_MXX, op_CPFA, store_nop ;BE ;CP A,(xx)
2890instr fetch_nop, op_nop, store_nop ;BF ;
2891instr fetch_nop, op_nop, store_nop ;C0 ;
2892instr fetch_nop, op_nop, store_nop ;C1 ;
2893instr fetch_nop, op_nop, store_nop ;C2 ;
2894instr fetch_nop, op_nop, store_nop ;C3 ;
2895instr fetch_nop, op_nop, store_nop ;C4 ;
2896instr fetch_nop, op_nop, store_nop ;C5 ;
2897instr fetch_nop, op_nop, store_nop ;C6 ;
2898instr fetch_nop, op_nop, store_nop ;C7 ;
2899instr fetch_nop, op_nop, store_nop ;C8 ;
2900instr fetch_nop, op_nop, store_nop ;C9 ;
2901instr fetch_nop, op_nop, store_nop ;CA ;
2902instr fetch_nop, op_nop, store_nop ;CB ;
2903instr fetch_nop, op_nop, store_nop ;CC ;
2904instr fetch_nop, op_nop, store_nop ;CD ;
2905instr fetch_nop, op_nop, store_nop ;CE ;
2906instr fetch_nop, op_nop, store_nop ;CF ;
2907instr fetch_nop, op_nop, store_nop ;D0 ;
2908instr fetch_nop, op_nop, store_nop ;D1 ;
2909instr fetch_nop, op_nop, store_nop ;D2 ;
2910instr fetch_nop, op_nop, store_nop ;D3 ;
2911instr fetch_nop, op_nop, store_nop ;D4 ;
2912instr fetch_nop, op_nop, store_nop ;D5 ;
2913instr fetch_nop, op_nop, store_nop ;D6 ;
2914instr fetch_nop, op_nop, store_nop ;D7 ;
2915instr fetch_nop, op_nop, store_nop ;D8 ;
2916instr fetch_nop, op_nop, store_nop ;D9 ;
2917instr fetch_nop, op_nop, store_nop ;DA ;
2918instr fetch_nop, op_nop, store_nop ;DB ;
2919instr fetch_nop, op_nop, store_nop ;DC ;
2920instr fetch_nop, op_nop, store_nop ;DD ;
2921instr fetch_nop, op_nop, store_nop ;DE ;
2922instr fetch_nop, op_nop, store_nop ;DF ;
2923instr fetch_nop, op_nop, store_nop ;E0 ;
2924instr fetch_nop, op_POP16, store_xx ;E1 ;POP xx
2925instr fetch_nop, op_nop, store_nop ;E2 ;
2926instr fetch_MSP, op_EXxx, store_MSP ;E3 ;EX (SP),xx
2927instr fetch_nop, op_nop, store_nop ;E4 ;
2928instr fetch_xx, op_PUSH16, store_nop ;E5 ;PUSH xx
2929instr fetch_nop, op_nop, store_nop ;E6 ;
2930instr fetch_nop, op_nop, store_nop ;E7 ;
2931instr fetch_nop, op_nop, store_nop ;E8 ;
2932instr fetch_xx, op_nop, store_PC ;E9 ;JP xx
2933instr fetch_nop, op_nop, store_nop ;EA ;
2934instr fetch_nop, op_nop, store_nop ;EB ;
2935instr fetch_nop, op_nop, store_nop ;EC ;
2936instr fetch_nop, op_nop, store_nop ;ED ;
2937instr fetch_nop, op_nop, store_nop ;EE ;
2938instr fetch_nop, op_nop, store_nop ;EF ;
2939instr fetch_nop, op_nop, store_nop ;F0 ;
2940instr fetch_nop, op_nop, store_nop ;F1 ;
2941instr fetch_nop, op_nop, store_nop ;F2 ;
2942instr fetch_nop, op_nop, store_nop ;F3 ;
2943instr fetch_nop, op_nop, store_nop ;F4 ;
2944instr fetch_nop, op_nop, store_nop ;F5 ;
2945instr fetch_nop, op_nop, store_nop ;F6 ;
2946instr fetch_nop, op_nop, store_nop ;F7 ;
2947instr fetch_nop, op_nop, store_nop ;F8 ;
2948instr fetch_xx, op_nop, store_SP ;F9 ;LD SP,xx
2949instr fetch_nop, op_nop, store_nop ;FA ;
2950instr fetch_nop, op_nop, store_nop ;FB ;
2951instr fetch_nop, op_nop, store_nop ;FC ;
2952instr fetch_nop, op_nop, store_nop ;FD ;
2953instr fetch_nop, op_nop, store_nop ;FE ;
2954instr fetch_nop, op_nop, store_nop ;FF ;
fa9059af
L
2955
2956
2957 opctable CBjmp
2958
2959instr fetch_nop, op_nop, store_nop ;00 ;NOP
2960instr fetch_nop, op_nop, store_nop ;01 ;NOP
2961instr fetch_nop, op_nop, store_nop ;02 ;NOP
2962instr fetch_nop, op_nop, store_nop ;03 ;NOP
2963instr fetch_nop, op_nop, store_nop ;04 ;NOP
2964instr fetch_nop, op_nop, store_nop ;05 ;NOP
2965instr fetch_nop, op_nop, store_nop ;06 ;NOP
2966instr fetch_nop, op_nop, store_nop ;07 ;NOP
2967instr fetch_nop, op_nop, store_nop ;08 ;NOP
2968instr fetch_nop, op_nop, store_nop ;09 ;NOP
2969instr fetch_nop, op_nop, store_nop ;0A ;NOP
2970instr fetch_nop, op_nop, store_nop ;0B ;NOP
2971instr fetch_nop, op_nop, store_nop ;0C ;NOP
2972instr fetch_nop, op_nop, store_nop ;0D ;NOP
2973instr fetch_nop, op_nop, store_nop ;0E ;NOP
2974instr fetch_nop, op_nop, store_nop ;0F ;NOP
2975instr fetch_nop, op_nop, store_nop ;10 ;NOP
2976instr fetch_nop, op_nop, store_nop ;11 ;NOP
2977instr fetch_nop, op_nop, store_nop ;12 ;NOP
2978instr fetch_nop, op_nop, store_nop ;13 ;NOP
2979instr fetch_nop, op_nop, store_nop ;14 ;NOP
2980instr fetch_nop, op_nop, store_nop ;15 ;NOP
2981instr fetch_nop, op_nop, store_nop ;16 ;NOP
2982instr fetch_nop, op_nop, store_nop ;17 ;NOP
2983instr fetch_nop, op_nop, store_nop ;18 ;NOP
2984instr fetch_nop, op_nop, store_nop ;19 ;NOP
2985instr fetch_nop, op_nop, store_nop ;1A ;NOP
2986instr fetch_nop, op_nop, store_nop ;1B ;NOP
2987instr fetch_nop, op_nop, store_nop ;1C ;NOP
2988instr fetch_nop, op_nop, store_nop ;1D ;NOP
2989instr fetch_nop, op_nop, store_nop ;1E ;NOP
2990instr fetch_nop, op_nop, store_nop ;1F ;NOP
2991instr fetch_nop, op_nop, store_nop ;20 ;NOP
2992instr fetch_nop, op_nop, store_nop ;21 ;NOP
2993instr fetch_nop, op_nop, store_nop ;22 ;NOP
2994instr fetch_nop, op_nop, store_nop ;23 ;NOP
2995instr fetch_nop, op_nop, store_nop ;24 ;NOP
2996instr fetch_nop, op_nop, store_nop ;25 ;NOP
2997instr fetch_nop, op_nop, store_nop ;26 ;NOP
2998instr fetch_nop, op_nop, store_nop ;27 ;NOP
2999instr fetch_nop, op_nop, store_nop ;28 ;NOP
3000instr fetch_nop, op_nop, store_nop ;29 ;NOP
3001instr fetch_nop, op_nop, store_nop ;2A ;NOP
3002instr fetch_nop, op_nop, store_nop ;2B ;NOP
3003instr fetch_nop, op_nop, store_nop ;2C ;NOP
3004instr fetch_nop, op_nop, store_nop ;2D ;NOP
3005instr fetch_nop, op_nop, store_nop ;2E ;NOP
3006instr fetch_nop, op_nop, store_nop ;2F ;NOP
3007instr fetch_nop, op_nop, store_nop ;30 ;NOP
3008instr fetch_nop, op_nop, store_nop ;31 ;NOP
3009instr fetch_nop, op_nop, store_nop ;32 ;NOP
3010instr fetch_nop, op_nop, store_nop ;33 ;NOP
3011instr fetch_nop, op_nop, store_nop ;34 ;NOP
3012instr fetch_nop, op_nop, store_nop ;35 ;NOP
3013instr fetch_nop, op_nop, store_nop ;36 ;NOP
3014instr fetch_nop, op_nop, store_nop ;37 ;NOP
3015instr fetch_nop, op_nop, store_nop ;38 ;NOP
3016instr fetch_nop, op_nop, store_nop ;39 ;NOP
3017instr fetch_nop, op_nop, store_nop ;3A ;NOP
3018instr fetch_nop, op_nop, store_nop ;3B ;NOP
3019instr fetch_nop, op_nop, store_nop ;3C ;NOP
3020instr fetch_nop, op_nop, store_nop ;3D ;NOP
3021instr fetch_nop, op_nop, store_nop ;3E ;NOP
3022instr fetch_nop, op_nop, store_nop ;3F ;NOP
3023instr fetch_nop, op_nop, store_nop ;40 ;NOP
3024instr fetch_nop, op_nop, store_nop ;41 ;NOP
3025instr fetch_nop, op_nop, store_nop ;42 ;NOP
3026instr fetch_nop, op_nop, store_nop ;43 ;NOP
3027instr fetch_nop, op_nop, store_nop ;44 ;NOP
3028instr fetch_nop, op_nop, store_nop ;45 ;NOP
3029instr fetch_nop, op_nop, store_nop ;46 ;NOP
3030instr fetch_nop, op_nop, store_nop ;47 ;NOP
3031instr fetch_nop, op_nop, store_nop ;48 ;NOP
3032instr fetch_nop, op_nop, store_nop ;49 ;NOP
3033instr fetch_nop, op_nop, store_nop ;4A ;NOP
3034instr fetch_nop, op_nop, store_nop ;4B ;NOP
3035instr fetch_nop, op_nop, store_nop ;4C ;NOP
3036instr fetch_nop, op_nop, store_nop ;4D ;NOP
3037instr fetch_nop, op_nop, store_nop ;4E ;NOP
3038instr fetch_nop, op_nop, store_nop ;4F ;NOP
3039instr fetch_nop, op_nop, store_nop ;50 ;NOP
3040instr fetch_nop, op_nop, store_nop ;51 ;NOP
3041instr fetch_nop, op_nop, store_nop ;52 ;NOP
3042instr fetch_nop, op_nop, store_nop ;53 ;NOP
3043instr fetch_nop, op_nop, store_nop ;54 ;NOP
3044instr fetch_nop, op_nop, store_nop ;55 ;NOP
3045instr fetch_nop, op_nop, store_nop ;56 ;NOP
3046instr fetch_nop, op_nop, store_nop ;57 ;NOP
3047instr fetch_nop, op_nop, store_nop ;58 ;NOP
3048instr fetch_nop, op_nop, store_nop ;59 ;NOP
3049instr fetch_nop, op_nop, store_nop ;5A ;NOP
3050instr fetch_nop, op_nop, store_nop ;5B ;NOP
3051instr fetch_nop, op_nop, store_nop ;5C ;NOP
3052instr fetch_nop, op_nop, store_nop ;5D ;NOP
3053instr fetch_nop, op_nop, store_nop ;5E ;NOP
3054instr fetch_nop, op_nop, store_nop ;5F ;NOP
3055instr fetch_nop, op_nop, store_nop ;60 ;NOP
3056instr fetch_nop, op_nop, store_nop ;61 ;NOP
3057instr fetch_nop, op_nop, store_nop ;62 ;NOP
3058instr fetch_nop, op_nop, store_nop ;63 ;NOP
3059instr fetch_nop, op_nop, store_nop ;64 ;NOP
3060instr fetch_nop, op_nop, store_nop ;65 ;NOP
3061instr fetch_nop, op_nop, store_nop ;66 ;NOP
3062instr fetch_nop, op_nop, store_nop ;67 ;NOP
3063instr fetch_nop, op_nop, store_nop ;68 ;NOP
3064instr fetch_nop, op_nop, store_nop ;69 ;NOP
3065instr fetch_nop, op_nop, store_nop ;6A ;NOP
3066instr fetch_nop, op_nop, store_nop ;6B ;NOP
3067instr fetch_nop, op_nop, store_nop ;6C ;NOP
3068instr fetch_nop, op_nop, store_nop ;6D ;NOP
3069instr fetch_nop, op_nop, store_nop ;6E ;NOP
3070instr fetch_nop, op_nop, store_nop ;6F ;NOP
3071instr fetch_nop, op_nop, store_nop ;70 ;NOP
3072instr fetch_nop, op_nop, store_nop ;71 ;NOP
3073instr fetch_nop, op_nop, store_nop ;72 ;NOP
3074instr fetch_nop, op_nop, store_nop ;73 ;NOP
3075instr fetch_nop, op_nop, store_nop ;74 ;NOP
3076instr fetch_nop, op_nop, store_nop ;75 ;NOP
3077instr fetch_nop, op_nop, store_nop ;76 ;NOP
3078instr fetch_nop, op_nop, store_nop ;77 ;NOP
3079instr fetch_nop, op_nop, store_nop ;78 ;NOP
3080instr fetch_nop, op_nop, store_nop ;79 ;NOP
3081instr fetch_nop, op_nop, store_nop ;7A ;NOP
3082instr fetch_nop, op_nop, store_nop ;7B ;NOP
3083instr fetch_nop, op_nop, store_nop ;7C ;NOP
3084instr fetch_nop, op_nop, store_nop ;7D ;NOP
3085instr fetch_nop, op_nop, store_nop ;7E ;NOP
3086instr fetch_nop, op_nop, store_nop ;7F ;NOP
3087instr fetch_nop, op_nop, store_nop ;80 ;NOP
3088instr fetch_nop, op_nop, store_nop ;81 ;NOP
3089instr fetch_nop, op_nop, store_nop ;82 ;NOP
3090instr fetch_nop, op_nop, store_nop ;83 ;NOP
3091instr fetch_nop, op_nop, store_nop ;84 ;NOP
3092instr fetch_nop, op_nop, store_nop ;85 ;NOP
3093instr fetch_nop, op_nop, store_nop ;86 ;NOP
3094instr fetch_nop, op_nop, store_nop ;87 ;NOP
3095instr fetch_nop, op_nop, store_nop ;88 ;NOP
3096instr fetch_nop, op_nop, store_nop ;89 ;NOP
3097instr fetch_nop, op_nop, store_nop ;8A ;NOP
3098instr fetch_nop, op_nop, store_nop ;8B ;NOP
3099instr fetch_nop, op_nop, store_nop ;8C ;NOP
3100instr fetch_nop, op_nop, store_nop ;8D ;NOP
3101instr fetch_nop, op_nop, store_nop ;8E ;NOP
3102instr fetch_nop, op_nop, store_nop ;8F ;NOP
3103instr fetch_nop, op_nop, store_nop ;90 ;NOP
3104instr fetch_nop, op_nop, store_nop ;91 ;NOP
3105instr fetch_nop, op_nop, store_nop ;92 ;NOP
3106instr fetch_nop, op_nop, store_nop ;93 ;NOP
3107instr fetch_nop, op_nop, store_nop ;94 ;NOP
3108instr fetch_nop, op_nop, store_nop ;95 ;NOP
3109instr fetch_nop, op_nop, store_nop ;96 ;NOP
3110instr fetch_nop, op_nop, store_nop ;97 ;NOP
3111instr fetch_nop, op_nop, store_nop ;98 ;NOP
3112instr fetch_nop, op_nop, store_nop ;99 ;NOP
3113instr fetch_nop, op_nop, store_nop ;9A ;NOP
3114instr fetch_nop, op_nop, store_nop ;9B ;NOP
3115instr fetch_nop, op_nop, store_nop ;9C ;NOP
3116instr fetch_nop, op_nop, store_nop ;9D ;NOP
3117instr fetch_nop, op_nop, store_nop ;9E ;NOP
3118instr fetch_nop, op_nop, store_nop ;9F ;NOP
3119instr fetch_nop, op_nop, store_nop ;A0 ;NOP
3120instr fetch_nop, op_nop, store_nop ;A1 ;NOP
3121instr fetch_nop, op_nop, store_nop ;A2 ;NOP
3122instr fetch_nop, op_nop, store_nop ;A3 ;NOP
3123instr fetch_nop, op_nop, store_nop ;A4 ;NOP
3124instr fetch_nop, op_nop, store_nop ;A5 ;NOP
3125instr fetch_nop, op_nop, store_nop ;A6 ;NOP
3126instr fetch_nop, op_nop, store_nop ;A7 ;NOP
3127instr fetch_nop, op_nop, store_nop ;A8 ;NOP
3128instr fetch_nop, op_nop, store_nop ;A9 ;NOP
3129instr fetch_nop, op_nop, store_nop ;AA ;NOP
3130instr fetch_nop, op_nop, store_nop ;AB ;NOP
3131instr fetch_nop, op_nop, store_nop ;AC ;NOP
3132instr fetch_nop, op_nop, store_nop ;AD ;NOP
3133instr fetch_nop, op_nop, store_nop ;AE ;NOP
3134instr fetch_nop, op_nop, store_nop ;AF ;NOP
3135instr fetch_nop, op_nop, store_nop ;B0 ;NOP
3136instr fetch_nop, op_nop, store_nop ;B1 ;NOP
3137instr fetch_nop, op_nop, store_nop ;B2 ;NOP
3138instr fetch_nop, op_nop, store_nop ;B3 ;NOP
3139instr fetch_nop, op_nop, store_nop ;B4 ;NOP
3140instr fetch_nop, op_nop, store_nop ;B5 ;NOP
3141instr fetch_nop, op_nop, store_nop ;B6 ;NOP
3142instr fetch_nop, op_nop, store_nop ;B7 ;NOP
3143instr fetch_nop, op_nop, store_nop ;B8 ;NOP
3144instr fetch_nop, op_nop, store_nop ;B9 ;NOP
3145instr fetch_nop, op_nop, store_nop ;BA ;NOP
3146instr fetch_nop, op_nop, store_nop ;BB ;NOP
3147instr fetch_nop, op_nop, store_nop ;BC ;NOP
3148instr fetch_nop, op_nop, store_nop ;BD ;NOP
3149instr fetch_nop, op_nop, store_nop ;BE ;NOP
3150instr fetch_nop, op_nop, store_nop ;BF ;NOP
3151instr fetch_nop, op_nop, store_nop ;C0 ;NOP
3152instr fetch_nop, op_nop, store_nop ;C1 ;NOP
3153instr fetch_nop, op_nop, store_nop ;C2 ;NOP
3154instr fetch_nop, op_nop, store_nop ;C3 ;NOP
3155instr fetch_nop, op_nop, store_nop ;C4 ;NOP
3156instr fetch_nop, op_nop, store_nop ;C5 ;NOP
3157instr fetch_nop, op_nop, store_nop ;C6 ;NOP
3158instr fetch_nop, op_nop, store_nop ;C7 ;NOP
3159instr fetch_nop, op_nop, store_nop ;C8 ;NOP
3160instr fetch_nop, op_nop, store_nop ;C9 ;NOP
3161instr fetch_nop, op_nop, store_nop ;CA ;NOP
3162instr fetch_nop, op_nop, store_nop ;CB ;NOP
3163instr fetch_nop, op_nop, store_nop ;CC ;NOP
3164instr fetch_nop, op_nop, store_nop ;CD ;NOP
3165instr fetch_nop, op_nop, store_nop ;CE ;NOP
3166instr fetch_nop, op_nop, store_nop ;CF ;NOP
3167instr fetch_nop, op_nop, store_nop ;D0 ;NOP
3168instr fetch_nop, op_nop, store_nop ;D1 ;NOP
3169instr fetch_nop, op_nop, store_nop ;D2 ;NOP
3170instr fetch_nop, op_nop, store_nop ;D3 ;NOP
3171instr fetch_nop, op_nop, store_nop ;D4 ;NOP
3172instr fetch_nop, op_nop, store_nop ;D5 ;NOP
3173instr fetch_nop, op_nop, store_nop ;D6 ;NOP
3174instr fetch_nop, op_nop, store_nop ;D7 ;NOP
3175instr fetch_nop, op_nop, store_nop ;D8 ;NOP
3176instr fetch_nop, op_nop, store_nop ;D9 ;NOP
3177instr fetch_nop, op_nop, store_nop ;DA ;NOP
3178instr fetch_nop, op_nop, store_nop ;DB ;NOP
3179instr fetch_nop, op_nop, store_nop ;DC ;NOP
3180instr fetch_nop, op_nop, store_nop ;DD ;NOP
3181instr fetch_nop, op_nop, store_nop ;DE ;NOP
3182instr fetch_nop, op_nop, store_nop ;DF ;NOP
3183instr fetch_nop, op_nop, store_nop ;E0 ;NOP
3184instr fetch_nop, op_nop, store_nop ;E1 ;NOP
3185instr fetch_nop, op_nop, store_nop ;E2 ;NOP
3186instr fetch_nop, op_nop, store_nop ;E3 ;NOP
3187instr fetch_nop, op_nop, store_nop ;E4 ;NOP
3188instr fetch_nop, op_nop, store_nop ;E5 ;NOP
3189instr fetch_nop, op_nop, store_nop ;E6 ;NOP
3190instr fetch_nop, op_nop, store_nop ;E7 ;NOP
3191instr fetch_nop, op_nop, store_nop ;E8 ;NOP
3192instr fetch_nop, op_nop, store_nop ;E9 ;NOP
3193instr fetch_nop, op_nop, store_nop ;EA ;NOP
3194instr fetch_nop, op_nop, store_nop ;EB ;NOP
3195instr fetch_nop, op_nop, store_nop ;EC ;NOP
3196instr fetch_nop, op_nop, store_nop ;ED ;NOP
3197instr fetch_nop, op_nop, store_nop ;EE ;NOP
3198instr fetch_nop, op_nop, store_nop ;EF ;NOP
3199instr fetch_nop, op_nop, store_nop ;F0 ;NOP
3200instr fetch_nop, op_nop, store_nop ;F1 ;NOP
3201instr fetch_nop, op_nop, store_nop ;F2 ;NOP
3202instr fetch_nop, op_nop, store_nop ;F3 ;NOP
3203instr fetch_nop, op_nop, store_nop ;F4 ;NOP
3204instr fetch_nop, op_nop, store_nop ;F5 ;NOP
3205instr fetch_nop, op_nop, store_nop ;F6 ;NOP
3206instr fetch_nop, op_nop, store_nop ;F7 ;NOP
3207instr fetch_nop, op_nop, store_nop ;F8 ;NOP
3208instr fetch_nop, op_nop, store_nop ;F9 ;NOP
3209instr fetch_nop, op_nop, store_nop ;FA ;NOP
3210instr fetch_nop, op_nop, store_nop ;FB ;NOP
3211instr fetch_nop, op_nop, store_nop ;FC ;NOP
3212instr fetch_nop, op_nop, store_nop ;FD ;NOP
3213instr fetch_nop, op_nop, store_nop ;FE ;NOP
3214instr fetch_nop, op_nop, store_nop ;FF ;NOP
3215
3216
3217 opctable DDFDCBjmp
3218
3219instr fetch_nop, op_nop, store_nop ;00 ;NOP
3220instr fetch_nop, op_nop, store_nop ;01 ;NOP
3221instr fetch_nop, op_nop, store_nop ;02 ;NOP
3222instr fetch_nop, op_nop, store_nop ;03 ;NOP
3223instr fetch_nop, op_nop, store_nop ;04 ;NOP
3224instr fetch_nop, op_nop, store_nop ;05 ;NOP
3225instr fetch_nop, op_nop, store_nop ;06 ;NOP
3226instr fetch_nop, op_nop, store_nop ;07 ;NOP
3227instr fetch_nop, op_nop, store_nop ;08 ;NOP
3228instr fetch_nop, op_nop, store_nop ;09 ;NOP
3229instr fetch_nop, op_nop, store_nop ;0A ;NOP
3230instr fetch_nop, op_nop, store_nop ;0B ;NOP
3231instr fetch_nop, op_nop, store_nop ;0C ;NOP
3232instr fetch_nop, op_nop, store_nop ;0D ;NOP
3233instr fetch_nop, op_nop, store_nop ;0E ;NOP
3234instr fetch_nop, op_nop, store_nop ;0F ;NOP
3235instr fetch_nop, op_nop, store_nop ;10 ;NOP
3236instr fetch_nop, op_nop, store_nop ;11 ;NOP
3237instr fetch_nop, op_nop, store_nop ;12 ;NOP
3238instr fetch_nop, op_nop, store_nop ;13 ;NOP
3239instr fetch_nop, op_nop, store_nop ;14 ;NOP
3240instr fetch_nop, op_nop, store_nop ;15 ;NOP
3241instr fetch_nop, op_nop, store_nop ;16 ;NOP
3242instr fetch_nop, op_nop, store_nop ;17 ;NOP
3243instr fetch_nop, op_nop, store_nop ;18 ;NOP
3244instr fetch_nop, op_nop, store_nop ;19 ;NOP
3245instr fetch_nop, op_nop, store_nop ;1A ;NOP
3246instr fetch_nop, op_nop, store_nop ;1B ;NOP
3247instr fetch_nop, op_nop, store_nop ;1C ;NOP
3248instr fetch_nop, op_nop, store_nop ;1D ;NOP
3249instr fetch_nop, op_nop, store_nop ;1E ;NOP
3250instr fetch_nop, op_nop, store_nop ;1F ;NOP
3251instr fetch_nop, op_nop, store_nop ;20 ;NOP
3252instr fetch_nop, op_nop, store_nop ;21 ;NOP
3253instr fetch_nop, op_nop, store_nop ;22 ;NOP
3254instr fetch_nop, op_nop, store_nop ;23 ;NOP
3255instr fetch_nop, op_nop, store_nop ;24 ;NOP
3256instr fetch_nop, op_nop, store_nop ;25 ;NOP
3257instr fetch_nop, op_nop, store_nop ;26 ;NOP
3258instr fetch_nop, op_nop, store_nop ;27 ;NOP
3259instr fetch_nop, op_nop, store_nop ;28 ;NOP
3260instr fetch_nop, op_nop, store_nop ;29 ;NOP
3261instr fetch_nop, op_nop, store_nop ;2A ;NOP
3262instr fetch_nop, op_nop, store_nop ;2B ;NOP
3263instr fetch_nop, op_nop, store_nop ;2C ;NOP
3264instr fetch_nop, op_nop, store_nop ;2D ;NOP
3265instr fetch_nop, op_nop, store_nop ;2E ;NOP
3266instr fetch_nop, op_nop, store_nop ;2F ;NOP
3267instr fetch_nop, op_nop, store_nop ;30 ;NOP
3268instr fetch_nop, op_nop, store_nop ;31 ;NOP
3269instr fetch_nop, op_nop, store_nop ;32 ;NOP
3270instr fetch_nop, op_nop, store_nop ;33 ;NOP
3271instr fetch_nop, op_nop, store_nop ;34 ;NOP
3272instr fetch_nop, op_nop, store_nop ;35 ;NOP
3273instr fetch_nop, op_nop, store_nop ;36 ;NOP
3274instr fetch_nop, op_nop, store_nop ;37 ;NOP
3275instr fetch_nop, op_nop, store_nop ;38 ;NOP
3276instr fetch_nop, op_nop, store_nop ;39 ;NOP
3277instr fetch_nop, op_nop, store_nop ;3A ;NOP
3278instr fetch_nop, op_nop, store_nop ;3B ;NOP
3279instr fetch_nop, op_nop, store_nop ;3C ;NOP
3280instr fetch_nop, op_nop, store_nop ;3D ;NOP
3281instr fetch_nop, op_nop, store_nop ;3E ;NOP
3282instr fetch_nop, op_nop, store_nop ;3F ;NOP
3283instr fetch_nop, op_nop, store_nop ;40 ;NOP
3284instr fetch_nop, op_nop, store_nop ;41 ;NOP
3285instr fetch_nop, op_nop, store_nop ;42 ;NOP
3286instr fetch_nop, op_nop, store_nop ;43 ;NOP
3287instr fetch_nop, op_nop, store_nop ;44 ;NOP
3288instr fetch_nop, op_nop, store_nop ;45 ;NOP
3289instr fetch_nop, op_nop, store_nop ;46 ;NOP
3290instr fetch_nop, op_nop, store_nop ;47 ;NOP
3291instr fetch_nop, op_nop, store_nop ;48 ;NOP
3292instr fetch_nop, op_nop, store_nop ;49 ;NOP
3293instr fetch_nop, op_nop, store_nop ;4A ;NOP
3294instr fetch_nop, op_nop, store_nop ;4B ;NOP
3295instr fetch_nop, op_nop, store_nop ;4C ;NOP
3296instr fetch_nop, op_nop, store_nop ;4D ;NOP
3297instr fetch_nop, op_nop, store_nop ;4E ;NOP
3298instr fetch_nop, op_nop, store_nop ;4F ;NOP
3299instr fetch_nop, op_nop, store_nop ;50 ;NOP
3300instr fetch_nop, op_nop, store_nop ;51 ;NOP
3301instr fetch_nop, op_nop, store_nop ;52 ;NOP
3302instr fetch_nop, op_nop, store_nop ;53 ;NOP
3303instr fetch_nop, op_nop, store_nop ;54 ;NOP
3304instr fetch_nop, op_nop, store_nop ;55 ;NOP
3305instr fetch_nop, op_nop, store_nop ;56 ;NOP
3306instr fetch_nop, op_nop, store_nop ;57 ;NOP
3307instr fetch_nop, op_nop, store_nop ;58 ;NOP
3308instr fetch_nop, op_nop, store_nop ;59 ;NOP
3309instr fetch_nop, op_nop, store_nop ;5A ;NOP
3310instr fetch_nop, op_nop, store_nop ;5B ;NOP
3311instr fetch_nop, op_nop, store_nop ;5C ;NOP
3312instr fetch_nop, op_nop, store_nop ;5D ;NOP
3313instr fetch_nop, op_nop, store_nop ;5E ;NOP
3314instr fetch_nop, op_nop, store_nop ;5F ;NOP
3315instr fetch_nop, op_nop, store_nop ;60 ;NOP
3316instr fetch_nop, op_nop, store_nop ;61 ;NOP
3317instr fetch_nop, op_nop, store_nop ;62 ;NOP
3318instr fetch_nop, op_nop, store_nop ;63 ;NOP
3319instr fetch_nop, op_nop, store_nop ;64 ;NOP
3320instr fetch_nop, op_nop, store_nop ;65 ;NOP
3321instr fetch_nop, op_nop, store_nop ;66 ;NOP
3322instr fetch_nop, op_nop, store_nop ;67 ;NOP
3323instr fetch_nop, op_nop, store_nop ;68 ;NOP
3324instr fetch_nop, op_nop, store_nop ;69 ;NOP
3325instr fetch_nop, op_nop, store_nop ;6A ;NOP
3326instr fetch_nop, op_nop, store_nop ;6B ;NOP
3327instr fetch_nop, op_nop, store_nop ;6C ;NOP
3328instr fetch_nop, op_nop, store_nop ;6D ;NOP
3329instr fetch_nop, op_nop, store_nop ;6E ;NOP
3330instr fetch_nop, op_nop, store_nop ;6F ;NOP
3331instr fetch_nop, op_nop, store_nop ;70 ;NOP
3332instr fetch_nop, op_nop, store_nop ;71 ;NOP
3333instr fetch_nop, op_nop, store_nop ;72 ;NOP
3334instr fetch_nop, op_nop, store_nop ;73 ;NOP
3335instr fetch_nop, op_nop, store_nop ;74 ;NOP
3336instr fetch_nop, op_nop, store_nop ;75 ;NOP
3337instr fetch_nop, op_nop, store_nop ;76 ;NOP
3338instr fetch_nop, op_nop, store_nop ;77 ;NOP
3339instr fetch_nop, op_nop, store_nop ;78 ;NOP
3340instr fetch_nop, op_nop, store_nop ;79 ;NOP
3341instr fetch_nop, op_nop, store_nop ;7A ;NOP
3342instr fetch_nop, op_nop, store_nop ;7B ;NOP
3343instr fetch_nop, op_nop, store_nop ;7C ;NOP
3344instr fetch_nop, op_nop, store_nop ;7D ;NOP
3345instr fetch_nop, op_nop, store_nop ;7E ;NOP
3346instr fetch_nop, op_nop, store_nop ;7F ;NOP
3347instr fetch_nop, op_nop, store_nop ;80 ;NOP
3348instr fetch_nop, op_nop, store_nop ;81 ;NOP
3349instr fetch_nop, op_nop, store_nop ;82 ;NOP
3350instr fetch_nop, op_nop, store_nop ;83 ;NOP
3351instr fetch_nop, op_nop, store_nop ;84 ;NOP
3352instr fetch_nop, op_nop, store_nop ;85 ;NOP
3353instr fetch_nop, op_nop, store_nop ;86 ;NOP
3354instr fetch_nop, op_nop, store_nop ;87 ;NOP
3355instr fetch_nop, op_nop, store_nop ;88 ;NOP
3356instr fetch_nop, op_nop, store_nop ;89 ;NOP
3357instr fetch_nop, op_nop, store_nop ;8A ;NOP
3358instr fetch_nop, op_nop, store_nop ;8B ;NOP
3359instr fetch_nop, op_nop, store_nop ;8C ;NOP
3360instr fetch_nop, op_nop, store_nop ;8D ;NOP
3361instr fetch_nop, op_nop, store_nop ;8E ;NOP
3362instr fetch_nop, op_nop, store_nop ;8F ;NOP
3363instr fetch_nop, op_nop, store_nop ;90 ;NOP
3364instr fetch_nop, op_nop, store_nop ;91 ;NOP
3365instr fetch_nop, op_nop, store_nop ;92 ;NOP
3366instr fetch_nop, op_nop, store_nop ;93 ;NOP
3367instr fetch_nop, op_nop, store_nop ;94 ;NOP
3368instr fetch_nop, op_nop, store_nop ;95 ;NOP
3369instr fetch_nop, op_nop, store_nop ;96 ;NOP
3370instr fetch_nop, op_nop, store_nop ;97 ;NOP
3371instr fetch_nop, op_nop, store_nop ;98 ;NOP
3372instr fetch_nop, op_nop, store_nop ;99 ;NOP
3373instr fetch_nop, op_nop, store_nop ;9A ;NOP
3374instr fetch_nop, op_nop, store_nop ;9B ;NOP
3375instr fetch_nop, op_nop, store_nop ;9C ;NOP
3376instr fetch_nop, op_nop, store_nop ;9D ;NOP
3377instr fetch_nop, op_nop, store_nop ;9E ;NOP
3378instr fetch_nop, op_nop, store_nop ;9F ;NOP
3379instr fetch_nop, op_nop, store_nop ;A0 ;NOP
3380instr fetch_nop, op_nop, store_nop ;A1 ;NOP
3381instr fetch_nop, op_nop, store_nop ;A2 ;NOP
3382instr fetch_nop, op_nop, store_nop ;A3 ;NOP
3383instr fetch_nop, op_nop, store_nop ;A4 ;NOP
3384instr fetch_nop, op_nop, store_nop ;A5 ;NOP
3385instr fetch_nop, op_nop, store_nop ;A6 ;NOP
3386instr fetch_nop, op_nop, store_nop ;A7 ;NOP
3387instr fetch_nop, op_nop, store_nop ;A8 ;NOP
3388instr fetch_nop, op_nop, store_nop ;A9 ;NOP
3389instr fetch_nop, op_nop, store_nop ;AA ;NOP
3390instr fetch_nop, op_nop, store_nop ;AB ;NOP
3391instr fetch_nop, op_nop, store_nop ;AC ;NOP
3392instr fetch_nop, op_nop, store_nop ;AD ;NOP
3393instr fetch_nop, op_nop, store_nop ;AE ;NOP
3394instr fetch_nop, op_nop, store_nop ;AF ;NOP
3395instr fetch_nop, op_nop, store_nop ;B0 ;NOP
3396instr fetch_nop, op_nop, store_nop ;B1 ;NOP
3397instr fetch_nop, op_nop, store_nop ;B2 ;NOP
3398instr fetch_nop, op_nop, store_nop ;B3 ;NOP
3399instr fetch_nop, op_nop, store_nop ;B4 ;NOP
3400instr fetch_nop, op_nop, store_nop ;B5 ;NOP
3401instr fetch_nop, op_nop, store_nop ;B6 ;NOP
3402instr fetch_nop, op_nop, store_nop ;B7 ;NOP
3403instr fetch_nop, op_nop, store_nop ;B8 ;NOP
3404instr fetch_nop, op_nop, store_nop ;B9 ;NOP
3405instr fetch_nop, op_nop, store_nop ;BA ;NOP
3406instr fetch_nop, op_nop, store_nop ;BB ;NOP
3407instr fetch_nop, op_nop, store_nop ;BC ;NOP
3408instr fetch_nop, op_nop, store_nop ;BD ;NOP
3409instr fetch_nop, op_nop, store_nop ;BE ;NOP
3410instr fetch_nop, op_nop, store_nop ;BF ;NOP
3411instr fetch_nop, op_nop, store_nop ;C0 ;NOP
3412instr fetch_nop, op_nop, store_nop ;C1 ;NOP
3413instr fetch_nop, op_nop, store_nop ;C2 ;NOP
3414instr fetch_nop, op_nop, store_nop ;C3 ;NOP
3415instr fetch_nop, op_nop, store_nop ;C4 ;NOP
3416instr fetch_nop, op_nop, store_nop ;C5 ;NOP
3417instr fetch_nop, op_nop, store_nop ;C6 ;NOP
3418instr fetch_nop, op_nop, store_nop ;C7 ;NOP
3419instr fetch_nop, op_nop, store_nop ;C8 ;NOP
3420instr fetch_nop, op_nop, store_nop ;C9 ;NOP
3421instr fetch_nop, op_nop, store_nop ;CA ;NOP
3422instr fetch_nop, op_nop, store_nop ;CB ;NOP
3423instr fetch_nop, op_nop, store_nop ;CC ;NOP
3424instr fetch_nop, op_nop, store_nop ;CD ;NOP
3425instr fetch_nop, op_nop, store_nop ;CE ;NOP
3426instr fetch_nop, op_nop, store_nop ;CF ;NOP
3427instr fetch_nop, op_nop, store_nop ;D0 ;NOP
3428instr fetch_nop, op_nop, store_nop ;D1 ;NOP
3429instr fetch_nop, op_nop, store_nop ;D2 ;NOP
3430instr fetch_nop, op_nop, store_nop ;D3 ;NOP
3431instr fetch_nop, op_nop, store_nop ;D4 ;NOP
3432instr fetch_nop, op_nop, store_nop ;D5 ;NOP
3433instr fetch_nop, op_nop, store_nop ;D6 ;NOP
3434instr fetch_nop, op_nop, store_nop ;D7 ;NOP
3435instr fetch_nop, op_nop, store_nop ;D8 ;NOP
3436instr fetch_nop, op_nop, store_nop ;D9 ;NOP
3437instr fetch_nop, op_nop, store_nop ;DA ;NOP
3438instr fetch_nop, op_nop, store_nop ;DB ;NOP
3439instr fetch_nop, op_nop, store_nop ;DC ;NOP
3440instr fetch_nop, op_nop, store_nop ;DD ;NOP
3441instr fetch_nop, op_nop, store_nop ;DE ;NOP
3442instr fetch_nop, op_nop, store_nop ;DF ;NOP
3443instr fetch_nop, op_nop, store_nop ;E0 ;NOP
3444instr fetch_nop, op_nop, store_nop ;E1 ;NOP
3445instr fetch_nop, op_nop, store_nop ;E2 ;NOP
3446instr fetch_nop, op_nop, store_nop ;E3 ;NOP
3447instr fetch_nop, op_nop, store_nop ;E4 ;NOP
3448instr fetch_nop, op_nop, store_nop ;E5 ;NOP
3449instr fetch_nop, op_nop, store_nop ;E6 ;NOP
3450instr fetch_nop, op_nop, store_nop ;E7 ;NOP
3451instr fetch_nop, op_nop, store_nop ;E8 ;NOP
3452instr fetch_nop, op_nop, store_nop ;E9 ;NOP
3453instr fetch_nop, op_nop, store_nop ;EA ;NOP
3454instr fetch_nop, op_nop, store_nop ;EB ;NOP
3455instr fetch_nop, op_nop, store_nop ;EC ;NOP
3456instr fetch_nop, op_nop, store_nop ;ED ;NOP
3457instr fetch_nop, op_nop, store_nop ;EE ;NOP
3458instr fetch_nop, op_nop, store_nop ;EF ;NOP
3459instr fetch_nop, op_nop, store_nop ;F0 ;NOP
3460instr fetch_nop, op_nop, store_nop ;F1 ;NOP
3461instr fetch_nop, op_nop, store_nop ;F2 ;NOP
3462instr fetch_nop, op_nop, store_nop ;F3 ;NOP
3463instr fetch_nop, op_nop, store_nop ;F4 ;NOP
3464instr fetch_nop, op_nop, store_nop ;F5 ;NOP
3465instr fetch_nop, op_nop, store_nop ;F6 ;NOP
3466instr fetch_nop, op_nop, store_nop ;F7 ;NOP
3467instr fetch_nop, op_nop, store_nop ;F8 ;NOP
3468instr fetch_nop, op_nop, store_nop ;F9 ;NOP
3469instr fetch_nop, op_nop, store_nop ;FA ;NOP
3470instr fetch_nop, op_nop, store_nop ;FB ;NOP
3471instr fetch_nop, op_nop, store_nop ;FC ;NOP
3472instr fetch_nop, op_nop, store_nop ;FD ;NOP
3473instr fetch_nop, op_nop, store_nop ;FE ;NOP
3474instr 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
3491sz53p_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