annotate z80inst.c @ 1378:71c8b97eb962

Get H32 in sync with H40 with regards to borders and test register support. Minor cleanup to H40 border rendering
author Michael Pavone <pavone@retrodev.com>
date Mon, 29 May 2017 17:30:40 -0700
parents 8519b54f9413
children e29ff59192ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
467
140af5509ce7 Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents: 314
diff changeset
1 /*
140af5509ce7 Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents: 314
diff changeset
2 Copyright 2013 Michael Pavone
651
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
3 This file is part of BlastEm.
467
140af5509ce7 Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents: 314
diff changeset
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
140af5509ce7 Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents: 314
diff changeset
5 */
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6 #include "z80inst.h"
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
7 #include <string.h>
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8 #include <stdio.h>
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
9 #include <stddef.h>
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
10
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
11 #define NOP {Z80_NOP, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0}
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
12 #define USE_MAIN {Z80_USE_MAIN, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0}
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
13
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
14 z80inst z80_tbl_a[256] = {
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15 //0
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
16 NOP,
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
17 {Z80_LD, Z80_BC, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
18 {Z80_LD, Z80_A, Z80_REG_INDIRECT | Z80_DIR, Z80_BC, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
19 {Z80_INC, Z80_BC, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
20 {Z80_INC, Z80_B, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
21 {Z80_DEC, Z80_B, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
22 {Z80_LD, Z80_B, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
23 {Z80_RLC, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
24 {Z80_EX, Z80_AF, Z80_REG, Z80_AF, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
25 {Z80_ADD, Z80_HL, Z80_REG, Z80_BC, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
26 {Z80_LD, Z80_A, Z80_REG_INDIRECT, Z80_BC, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
27 {Z80_DEC, Z80_BC, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
28 {Z80_INC, Z80_C, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
29 {Z80_DEC, Z80_C, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
30 {Z80_LD, Z80_C, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
31 {Z80_RRC, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
32 //1
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
33 {Z80_DJNZ, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
34 {Z80_LD, Z80_DE, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
35 {Z80_LD, Z80_A, Z80_REG_INDIRECT | Z80_DIR, Z80_DE, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
36 {Z80_INC, Z80_DE, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
37 {Z80_INC, Z80_D, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
38 {Z80_DEC, Z80_D, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
39 {Z80_LD, Z80_D, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
40 {Z80_RL, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
41 {Z80_JR, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
42 {Z80_ADD, Z80_HL, Z80_REG, Z80_DE, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
43 {Z80_LD, Z80_A, Z80_REG_INDIRECT, Z80_DE, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
44 {Z80_DEC, Z80_DE, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
45 {Z80_INC, Z80_E, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
46 {Z80_DEC, Z80_E, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
47 {Z80_LD, Z80_E, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
48 {Z80_RR, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
49 //2
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
50 {Z80_JRCC, Z80_CC_NZ, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
51 {Z80_LD, Z80_HL, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
52 {Z80_LD, Z80_HL, Z80_IMMED_INDIRECT | Z80_DIR, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
53 {Z80_INC, Z80_HL, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
54 {Z80_INC, Z80_H, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
55 {Z80_DEC, Z80_H, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
56 {Z80_LD, Z80_H, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
57 {Z80_DAA, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
58 {Z80_JRCC, Z80_CC_Z, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
59 {Z80_ADD, Z80_HL, Z80_REG, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
60 {Z80_LD, Z80_HL, Z80_IMMED_INDIRECT, Z80_IMMED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
61 {Z80_DEC, Z80_HL, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
62 {Z80_INC, Z80_L, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
63 {Z80_DEC, Z80_L, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
64 {Z80_LD, Z80_L, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
65 {Z80_CPL, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
66 //3
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
67 {Z80_JRCC, Z80_CC_NC, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
68 {Z80_LD, Z80_SP, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
69 {Z80_LD, Z80_A, Z80_IMMED_INDIRECT | Z80_DIR, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
70 {Z80_INC, Z80_SP, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
71 {Z80_INC, Z80_UNUSED, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
72 {Z80_DEC, Z80_UNUSED, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
73 {Z80_LD, Z80_USE_IMMED, Z80_REG_INDIRECT | Z80_DIR, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
74 {Z80_SCF, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
75 {Z80_JRCC, Z80_CC_C, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
76 {Z80_ADD, Z80_HL, Z80_REG, Z80_SP, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
77 {Z80_LD, Z80_A, Z80_IMMED_INDIRECT, Z80_IMMED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
78 {Z80_DEC, Z80_SP, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
79 {Z80_INC, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
80 {Z80_DEC, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
81 {Z80_LD, Z80_A, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
82 {Z80_CCF, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
83 //4
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
84 {Z80_LD, Z80_B, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
85 {Z80_LD, Z80_B, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
86 {Z80_LD, Z80_B, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
87 {Z80_LD, Z80_B, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
88 {Z80_LD, Z80_B, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
89 {Z80_LD, Z80_B, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
90 {Z80_LD, Z80_B, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
91 {Z80_LD, Z80_B, Z80_REG, Z80_A, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
92 {Z80_LD, Z80_C, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
93 {Z80_LD, Z80_C, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
94 {Z80_LD, Z80_C, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
95 {Z80_LD, Z80_C, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
96 {Z80_LD, Z80_C, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
97 {Z80_LD, Z80_C, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
98 {Z80_LD, Z80_C, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
99 {Z80_LD, Z80_C, Z80_REG, Z80_A, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
100 //5
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
101 {Z80_LD, Z80_D, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
102 {Z80_LD, Z80_D, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
103 {Z80_LD, Z80_D, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
104 {Z80_LD, Z80_D, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
105 {Z80_LD, Z80_D, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
106 {Z80_LD, Z80_D, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
107 {Z80_LD, Z80_D, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
108 {Z80_LD, Z80_D, Z80_REG, Z80_A, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
109 {Z80_LD, Z80_E, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
110 {Z80_LD, Z80_E, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
111 {Z80_LD, Z80_E, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
112 {Z80_LD, Z80_E, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
113 {Z80_LD, Z80_E, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
114 {Z80_LD, Z80_E, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
115 {Z80_LD, Z80_E, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
116 {Z80_LD, Z80_E, Z80_REG, Z80_A, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
117 //6
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
118 {Z80_LD, Z80_H, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
119 {Z80_LD, Z80_H, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
120 {Z80_LD, Z80_H, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
121 {Z80_LD, Z80_H, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
122 {Z80_LD, Z80_H, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
123 {Z80_LD, Z80_H, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
124 {Z80_LD, Z80_H, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
125 {Z80_LD, Z80_H, Z80_REG, Z80_A, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
126 {Z80_LD, Z80_L, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
127 {Z80_LD, Z80_L, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
128 {Z80_LD, Z80_L, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
129 {Z80_LD, Z80_L, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
130 {Z80_LD, Z80_L, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
131 {Z80_LD, Z80_L, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
132 {Z80_LD, Z80_L, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
133 {Z80_LD, Z80_L, Z80_REG, Z80_A, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
134 //7
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
135 {Z80_LD, Z80_B, Z80_REG_INDIRECT | Z80_DIR, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
136 {Z80_LD, Z80_C, Z80_REG_INDIRECT | Z80_DIR, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
137 {Z80_LD, Z80_D, Z80_REG_INDIRECT | Z80_DIR, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
138 {Z80_LD, Z80_E, Z80_REG_INDIRECT | Z80_DIR, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
139 {Z80_LD, Z80_H, Z80_REG_INDIRECT | Z80_DIR, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
140 {Z80_LD, Z80_L, Z80_REG_INDIRECT | Z80_DIR, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
141 {Z80_HALT, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
142 {Z80_LD, Z80_A, Z80_REG_INDIRECT | Z80_DIR, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
143 {Z80_LD, Z80_A, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
144 {Z80_LD, Z80_A, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
145 {Z80_LD, Z80_A, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
146 {Z80_LD, Z80_A, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
147 {Z80_LD, Z80_A, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
148 {Z80_LD, Z80_A, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
149 {Z80_LD, Z80_A, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
150 {Z80_LD, Z80_A, Z80_REG, Z80_A, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
151 //8
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
152 {Z80_ADD, Z80_A, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
153 {Z80_ADD, Z80_A, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
154 {Z80_ADD, Z80_A, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
155 {Z80_ADD, Z80_A, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
156 {Z80_ADD, Z80_A, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
157 {Z80_ADD, Z80_A, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
158 {Z80_ADD, Z80_A, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
159 {Z80_ADD, Z80_A, Z80_REG, Z80_A, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
160 {Z80_ADC, Z80_A, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
161 {Z80_ADC, Z80_A, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
162 {Z80_ADC, Z80_A, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
163 {Z80_ADC, Z80_A, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
164 {Z80_ADC, Z80_A, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
165 {Z80_ADC, Z80_A, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
166 {Z80_ADC, Z80_A, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
167 {Z80_ADC, Z80_A, Z80_REG, Z80_A, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
168 //9
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
169 {Z80_SUB, Z80_A, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
170 {Z80_SUB, Z80_A, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
171 {Z80_SUB, Z80_A, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
172 {Z80_SUB, Z80_A, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
173 {Z80_SUB, Z80_A, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
174 {Z80_SUB, Z80_A, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
175 {Z80_SUB, Z80_A, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
176 {Z80_SUB, Z80_A, Z80_REG, Z80_A, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
177 {Z80_SBC, Z80_A, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
178 {Z80_SBC, Z80_A, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
179 {Z80_SBC, Z80_A, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
180 {Z80_SBC, Z80_A, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
181 {Z80_SBC, Z80_A, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
182 {Z80_SBC, Z80_A, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
183 {Z80_SBC, Z80_A, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
184 {Z80_SBC, Z80_A, Z80_REG, Z80_A, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
185 //A
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
186 {Z80_AND, Z80_A, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
187 {Z80_AND, Z80_A, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
188 {Z80_AND, Z80_A, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
189 {Z80_AND, Z80_A, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
190 {Z80_AND, Z80_A, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
191 {Z80_AND, Z80_A, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
192 {Z80_AND, Z80_A, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
193 {Z80_AND, Z80_A, Z80_REG, Z80_A, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
194 {Z80_XOR, Z80_A, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
195 {Z80_XOR, Z80_A, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
196 {Z80_XOR, Z80_A, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
197 {Z80_XOR, Z80_A, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
198 {Z80_XOR, Z80_A, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
199 {Z80_XOR, Z80_A, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
200 {Z80_XOR, Z80_A, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
201 {Z80_XOR, Z80_A, Z80_REG, Z80_A, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
202 //B
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
203 {Z80_OR, Z80_A, Z80_REG, Z80_B, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
204 {Z80_OR, Z80_A, Z80_REG, Z80_C, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
205 {Z80_OR, Z80_A, Z80_REG, Z80_D, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
206 {Z80_OR, Z80_A, Z80_REG, Z80_E, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
207 {Z80_OR, Z80_A, Z80_REG, Z80_H, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
208 {Z80_OR, Z80_A, Z80_REG, Z80_L, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
209 {Z80_OR, Z80_A, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
210 {Z80_OR, Z80_A, Z80_REG, Z80_A, 0},
270
df5bf4c113dc Fix decoding of CP.
Mike Pavone <pavone@retrodev.com>
parents: 256
diff changeset
211 {Z80_CP, Z80_A, Z80_REG, Z80_B, 0},
df5bf4c113dc Fix decoding of CP.
Mike Pavone <pavone@retrodev.com>
parents: 256
diff changeset
212 {Z80_CP, Z80_A, Z80_REG, Z80_C, 0},
df5bf4c113dc Fix decoding of CP.
Mike Pavone <pavone@retrodev.com>
parents: 256
diff changeset
213 {Z80_CP, Z80_A, Z80_REG, Z80_D, 0},
df5bf4c113dc Fix decoding of CP.
Mike Pavone <pavone@retrodev.com>
parents: 256
diff changeset
214 {Z80_CP, Z80_A, Z80_REG, Z80_E, 0},
df5bf4c113dc Fix decoding of CP.
Mike Pavone <pavone@retrodev.com>
parents: 256
diff changeset
215 {Z80_CP, Z80_A, Z80_REG, Z80_H, 0},
df5bf4c113dc Fix decoding of CP.
Mike Pavone <pavone@retrodev.com>
parents: 256
diff changeset
216 {Z80_CP, Z80_A, Z80_REG, Z80_L, 0},
df5bf4c113dc Fix decoding of CP.
Mike Pavone <pavone@retrodev.com>
parents: 256
diff changeset
217 {Z80_CP, Z80_A, Z80_REG_INDIRECT, Z80_HL, 0},
df5bf4c113dc Fix decoding of CP.
Mike Pavone <pavone@retrodev.com>
parents: 256
diff changeset
218 {Z80_CP, Z80_A, Z80_REG, Z80_A, 0},
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
219 //C
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
220 {Z80_RETCC, Z80_CC_NZ, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
221 {Z80_POP, Z80_BC, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
222 {Z80_JPCC, Z80_CC_NZ, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
223 {Z80_JP, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
224 {Z80_CALLCC, Z80_CC_NZ, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
225 {Z80_PUSH, Z80_BC, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
226 {Z80_ADD, Z80_A, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
227 {Z80_RST, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0x0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
228 {Z80_RETCC, Z80_CC_Z, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
229 {Z80_RET, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
230 {Z80_JPCC, Z80_CC_Z, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
231 {0, 0, 0, 0, 0},//BITS Prefix
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
232 {Z80_CALLCC, Z80_CC_Z, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
233 {Z80_CALL, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
234 {Z80_ADC, Z80_A, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
235 {Z80_RST, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0x8},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
236 //D
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
237 {Z80_RETCC, Z80_CC_NC, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
238 {Z80_POP, Z80_DE, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
239 {Z80_JPCC, Z80_CC_NC, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
240 {Z80_OUT, Z80_A, Z80_IMMED_INDIRECT, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
241 {Z80_CALLCC, Z80_CC_NC, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
242 {Z80_PUSH, Z80_DE, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
243 {Z80_SUB, Z80_A, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
244 {Z80_RST, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0x10},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
245 {Z80_RETCC, Z80_CC_C, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
246 {Z80_EXX, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
247 {Z80_JPCC, Z80_CC_C, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
248 {Z80_IN, Z80_A, Z80_IMMED_INDIRECT, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
249 {Z80_CALLCC, Z80_CC_C, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
250 {0, 0, 0, 0, 0},//IX Prefix
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
251 {Z80_SBC, Z80_A, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
252 {Z80_RST, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0x18},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
253 //E
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
254 {Z80_RETCC, Z80_CC_PO, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
255 {Z80_POP, Z80_HL, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
256 {Z80_JPCC, Z80_CC_PO, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
257 {Z80_EX, Z80_HL, Z80_REG_INDIRECT | Z80_DIR, Z80_SP, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
258 {Z80_CALLCC, Z80_CC_PO, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
259 {Z80_PUSH, Z80_HL, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
260 {Z80_AND, Z80_A, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
261 {Z80_RST, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0x20},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
262 {Z80_RETCC, Z80_CC_PE, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
263 {Z80_JP, Z80_UNUSED, Z80_REG_INDIRECT, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
264 {Z80_JPCC, Z80_CC_PE, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
265 {Z80_EX, Z80_DE, Z80_REG, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
266 {Z80_CALLCC, Z80_CC_PE, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
267 {0, 0, 0, 0, 0},//EXTD Prefix
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
268 {Z80_XOR, Z80_A, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
269 {Z80_RST, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0x28},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
270 //F
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
271 {Z80_RETCC, Z80_CC_P, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
272 {Z80_POP, Z80_AF, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
273 {Z80_JPCC, Z80_CC_P, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
274 {Z80_DI, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
275 {Z80_CALLCC, Z80_CC_P, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
276 {Z80_PUSH, Z80_AF, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
277 {Z80_OR, Z80_A, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
278 {Z80_RST, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0x30},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
279 {Z80_RETCC, Z80_CC_M, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
280 {Z80_LD, Z80_SP, Z80_REG, Z80_HL, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
281 {Z80_JPCC, Z80_CC_M, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
282 {Z80_EI, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
283 {Z80_CALLCC, Z80_CC_M, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
284 {0, 0, 0, 0, 0},//IY Prefix
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
285 {Z80_CP, Z80_A, Z80_IMMED, Z80_UNUSED, 0},
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
286 {Z80_RST, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0x38}
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
287 };
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
288
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
289 z80inst z80_tbl_extd[0xC0-0x40] = {
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
290 //4
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
291 {Z80_IN, Z80_B, Z80_REG_INDIRECT, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
292 {Z80_OUT, Z80_B, Z80_REG_INDIRECT | Z80_DIR, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
293 {Z80_SBC, Z80_HL, Z80_REG, Z80_BC, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
294 {Z80_LD, Z80_BC, Z80_IMMED_INDIRECT | Z80_DIR, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
295 {Z80_NEG, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
296 {Z80_RETN, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
297 {Z80_IM, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
298 {Z80_LD, Z80_I, Z80_REG, Z80_A, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
299 {Z80_IN, Z80_C, Z80_REG_INDIRECT, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
300 {Z80_OUT, Z80_C, Z80_REG_INDIRECT | Z80_DIR, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
301 {Z80_ADC, Z80_HL, Z80_REG, Z80_BC, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
302 {Z80_LD, Z80_BC, Z80_IMMED_INDIRECT, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
303 {Z80_NEG, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
304 {Z80_RETI, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
305 {Z80_IM, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 3},//Set undocumented mode 0/1
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
306 {Z80_LD, Z80_R, Z80_REG, Z80_A, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
307 //5
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
308 {Z80_IN, Z80_D, Z80_REG_INDIRECT, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
309 {Z80_OUT, Z80_D, Z80_REG_INDIRECT | Z80_DIR, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
310 {Z80_SBC, Z80_HL, Z80_REG, Z80_DE, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
311 {Z80_LD, Z80_DE, Z80_IMMED_INDIRECT | Z80_DIR, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
312 {Z80_NEG, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
313 {Z80_RETN, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
314 {Z80_IM, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 1},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
315 {Z80_LD, Z80_A, Z80_REG, Z80_I, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
316 {Z80_IN, Z80_E, Z80_REG_INDIRECT, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
317 {Z80_OUT, Z80_E, Z80_REG_INDIRECT | Z80_DIR, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
318 {Z80_ADC, Z80_HL, Z80_REG, Z80_DE, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
319 {Z80_LD, Z80_DE, Z80_IMMED_INDIRECT, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
320 {Z80_NEG, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
321 {Z80_RETN, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
322 {Z80_IM, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 2},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
323 {Z80_LD, Z80_A, Z80_REG, Z80_R, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
324 //6
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
325 {Z80_IN, Z80_H, Z80_REG_INDIRECT, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
326 {Z80_OUT, Z80_H, Z80_REG_INDIRECT | Z80_DIR, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
327 {Z80_SBC, Z80_HL, Z80_REG, Z80_HL, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
328 {Z80_LD, Z80_HL, Z80_IMMED_INDIRECT | Z80_DIR, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
329 {Z80_NEG, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
330 {Z80_RETN, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
331 {Z80_IM, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
332 {Z80_RRD, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
333 {Z80_IN, Z80_L, Z80_REG_INDIRECT, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
334 {Z80_OUT, Z80_L, Z80_REG_INDIRECT | Z80_DIR, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
335 {Z80_ADC, Z80_HL, Z80_REG, Z80_HL, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
336 {Z80_LD, Z80_HL, Z80_IMMED_INDIRECT, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
337 {Z80_NEG, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
338 {Z80_RETN, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
339 {Z80_IM, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 3},//Set undocumented mode 0/1
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
340 {Z80_RLD, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
341 //7
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
342 {Z80_IN, Z80_UNUSED, Z80_REG_INDIRECT, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
343 {Z80_OUT, Z80_USE_IMMED, Z80_REG_INDIRECT | Z80_DIR, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
344 {Z80_SBC, Z80_HL, Z80_REG, Z80_SP, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
345 {Z80_LD, Z80_SP, Z80_IMMED_INDIRECT | Z80_DIR, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
346 {Z80_NEG, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
347 {Z80_RETN, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
348 {Z80_IM, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 1},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
349 NOP,
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
350 {Z80_IN, Z80_A, Z80_REG_INDIRECT, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
351 {Z80_OUT, Z80_A, Z80_REG_INDIRECT | Z80_DIR, Z80_C, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
352 {Z80_ADC, Z80_HL, Z80_REG, Z80_SP, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
353 {Z80_LD, Z80_SP, Z80_IMMED_INDIRECT, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
354 {Z80_NEG, Z80_A, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
355 {Z80_RETN, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
356 {Z80_IM, Z80_UNUSED, Z80_IMMED, Z80_UNUSED, 2},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
357 NOP,
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
358 //8
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
359 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
360 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
361 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
362 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
363 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
364 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
365 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
366 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
367 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
368 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
369 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
370 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
371 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
372 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
373 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
374 NOP,
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
375 //9
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
376 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
377 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
378 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
379 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
380 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
381 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
382 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
383 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
384 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
385 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
386 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
387 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
388 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
389 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
390 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
391 NOP,
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
392 //A
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
393 {Z80_LDI, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
394 {Z80_CPI, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
395 {Z80_INI, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
396 {Z80_OUTI, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
397 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
398 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
399 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
400 NOP,
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
401 {Z80_LDD, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
402 {Z80_CPD, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
403 {Z80_IND, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
404 {Z80_OUTD, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
405 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
406 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
407 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
408 NOP,
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
409 //B
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
410 {Z80_LDIR, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
411 {Z80_CPIR, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
412 {Z80_INIR, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
413 {Z80_OTIR, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
414 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
415 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
416 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
417 NOP,
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
418 {Z80_LDDR, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
419 {Z80_CPDR, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
420 {Z80_INDR, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
421 {Z80_OTDR, Z80_UNUSED, Z80_UNUSED, Z80_UNUSED, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
422 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
423 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
424 NOP,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
425 NOP
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
426 };
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
427
201
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
428 #define SHIFT_BLOCK(op) \
247
682e505f5757 Implement rotation and bit set/reset instructions (untested).
Mike Pavone <pavone@retrodev.com>
parents: 235
diff changeset
429 {op, Z80_B, Z80_UNUSED, Z80_UNUSED, 1},\
682e505f5757 Implement rotation and bit set/reset instructions (untested).
Mike Pavone <pavone@retrodev.com>
parents: 235
diff changeset
430 {op, Z80_C, Z80_UNUSED, Z80_UNUSED, 1},\
682e505f5757 Implement rotation and bit set/reset instructions (untested).
Mike Pavone <pavone@retrodev.com>
parents: 235
diff changeset
431 {op, Z80_D, Z80_UNUSED, Z80_UNUSED, 1},\
682e505f5757 Implement rotation and bit set/reset instructions (untested).
Mike Pavone <pavone@retrodev.com>
parents: 235
diff changeset
432 {op, Z80_E, Z80_UNUSED, Z80_UNUSED, 1},\
682e505f5757 Implement rotation and bit set/reset instructions (untested).
Mike Pavone <pavone@retrodev.com>
parents: 235
diff changeset
433 {op, Z80_H, Z80_UNUSED, Z80_UNUSED, 1},\
682e505f5757 Implement rotation and bit set/reset instructions (untested).
Mike Pavone <pavone@retrodev.com>
parents: 235
diff changeset
434 {op, Z80_L, Z80_UNUSED, Z80_UNUSED, 1},\
682e505f5757 Implement rotation and bit set/reset instructions (untested).
Mike Pavone <pavone@retrodev.com>
parents: 235
diff changeset
435 {op, Z80_UNUSED, Z80_REG_INDIRECT, Z80_HL, 1},\
682e505f5757 Implement rotation and bit set/reset instructions (untested).
Mike Pavone <pavone@retrodev.com>
parents: 235
diff changeset
436 {op, Z80_A, Z80_UNUSED, Z80_UNUSED, 1}
651
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
437
201
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
438 #define BIT_BLOCK(op, bit) \
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
439 {op, Z80_USE_IMMED, Z80_REG, Z80_B, bit},\
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
440 {op, Z80_USE_IMMED, Z80_REG, Z80_C, bit},\
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
441 {op, Z80_USE_IMMED, Z80_REG, Z80_D, bit},\
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
442 {op, Z80_USE_IMMED, Z80_REG, Z80_E, bit},\
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
443 {op, Z80_USE_IMMED, Z80_REG, Z80_H, bit},\
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
444 {op, Z80_USE_IMMED, Z80_REG, Z80_L, bit},\
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
445 {op, Z80_USE_IMMED, Z80_REG_INDIRECT, Z80_HL, bit},\
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
446 {op, Z80_USE_IMMED, Z80_REG, Z80_A, bit}
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
447
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
448 z80inst z80_tbl_bit[256] = {
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
449 //0
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
450 SHIFT_BLOCK(Z80_RLC),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
451 SHIFT_BLOCK(Z80_RRC),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
452 //1
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
453 SHIFT_BLOCK(Z80_RL),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
454 SHIFT_BLOCK(Z80_RR),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
455 //2
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
456 SHIFT_BLOCK(Z80_SLA),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
457 SHIFT_BLOCK(Z80_SRA),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
458 //3
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
459 SHIFT_BLOCK(Z80_SLL),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
460 SHIFT_BLOCK(Z80_SRL),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
461 //4
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
462 BIT_BLOCK(Z80_BIT, 0),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
463 BIT_BLOCK(Z80_BIT, 1),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
464 //5
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
465 BIT_BLOCK(Z80_BIT, 2),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
466 BIT_BLOCK(Z80_BIT, 3),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
467 //6
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
468 BIT_BLOCK(Z80_BIT, 4),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
469 BIT_BLOCK(Z80_BIT, 5),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
470 //7
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
471 BIT_BLOCK(Z80_BIT, 6),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
472 BIT_BLOCK(Z80_BIT, 7),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
473 //8
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
474 BIT_BLOCK(Z80_RES, 0),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
475 BIT_BLOCK(Z80_RES, 1),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
476 //9
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
477 BIT_BLOCK(Z80_RES, 2),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
478 BIT_BLOCK(Z80_RES, 3),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
479 //A
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
480 BIT_BLOCK(Z80_RES, 4),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
481 BIT_BLOCK(Z80_RES, 5),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
482 //B
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
483 BIT_BLOCK(Z80_RES, 6),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
484 BIT_BLOCK(Z80_RES, 7),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
485 //C
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
486 BIT_BLOCK(Z80_SET, 0),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
487 BIT_BLOCK(Z80_SET, 1),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
488 //D
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
489 BIT_BLOCK(Z80_SET, 2),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
490 BIT_BLOCK(Z80_SET, 3),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
491 //E
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
492 BIT_BLOCK(Z80_SET, 4),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
493 BIT_BLOCK(Z80_SET, 5),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
494 //F
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
495 BIT_BLOCK(Z80_SET, 6),
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
496 BIT_BLOCK(Z80_SET, 7)
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
497 };
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
498
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
499 z80inst z80_tbl_ix[256] = {
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
500 //0
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
501 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
502 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
503 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
504 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
505 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
506 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
507 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
508 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
509 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
510 {Z80_ADD, Z80_IX, Z80_REG, Z80_BC, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
511 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
512 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
513 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
514 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
515 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
516 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
517 //1
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
518 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
519 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
520 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
521 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
522 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
523 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
524 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
525 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
526 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
527 {Z80_ADD, Z80_IX, Z80_REG, Z80_DE, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
528 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
529 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
530 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
531 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
532 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
533 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
534 //2
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
535 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
536 {Z80_LD, Z80_IX, Z80_IMMED, Z80_UNUSED, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
537 {Z80_LD, Z80_IX, Z80_IMMED_INDIRECT | Z80_DIR, Z80_UNUSED, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
538 {Z80_INC, Z80_IX, Z80_UNUSED, Z80_UNUSED, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
539 {Z80_INC, Z80_IXH, Z80_UNUSED, Z80_UNUSED, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
540 {Z80_DEC, Z80_IXH, Z80_UNUSED, Z80_UNUSED, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
541 {Z80_LD, Z80_IXH, Z80_IMMED, Z80_UNUSED, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
542 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
543 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
544 {Z80_ADD, Z80_IX, Z80_REG, Z80_IX, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
545 {Z80_LD, Z80_IX, Z80_IMMED_INDIRECT, Z80_UNUSED, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
546 {Z80_DEC, Z80_IX, Z80_UNUSED, Z80_UNUSED, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
547 {Z80_INC, Z80_IXL, Z80_UNUSED, Z80_UNUSED, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
548 {Z80_DEC, Z80_IXL, Z80_UNUSED, Z80_UNUSED, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
549 {Z80_LD, Z80_IXL, Z80_IMMED, Z80_UNUSED, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
550 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
551 //3
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
552 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
553 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
554 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
555 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
556 {Z80_INC, Z80_UNUSED, Z80_IX_DISPLACE, 0, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
557 {Z80_DEC, Z80_UNUSED, Z80_IX_DISPLACE, 0, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
558 {Z80_LD, Z80_USE_IMMED, Z80_IX_DISPLACE | Z80_DIR, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
559 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
560 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
561 {Z80_ADD, Z80_IX, Z80_REG, Z80_SP, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
562 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
563 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
564 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
565 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
566 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
567 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
568 //4
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
569 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
570 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
571 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
572 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
573 {Z80_LD, Z80_B, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
574 {Z80_LD, Z80_B, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
575 {Z80_LD, Z80_B, Z80_IX_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
576 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
577 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
578 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
579 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
580 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
581 {Z80_LD, Z80_C, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
582 {Z80_LD, Z80_C, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
583 {Z80_LD, Z80_C, Z80_IX_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
584 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
585 //5
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
586 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
587 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
588 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
589 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
590 {Z80_LD, Z80_D, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
591 {Z80_LD, Z80_D, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
592 {Z80_LD, Z80_D, Z80_IX_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
593 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
594 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
595 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
596 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
597 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
598 {Z80_LD, Z80_E, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
599 {Z80_LD, Z80_E, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
600 {Z80_LD, Z80_E, Z80_IX_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
601 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
602 //6
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
603 {Z80_LD, Z80_IXH, Z80_REG, Z80_B, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
604 {Z80_LD, Z80_IXH, Z80_REG, Z80_C, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
605 {Z80_LD, Z80_IXH, Z80_REG, Z80_D, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
606 {Z80_LD, Z80_IXH, Z80_REG, Z80_E, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
607 {Z80_LD, Z80_IXH, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
608 {Z80_LD, Z80_IXH, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
609 {Z80_LD, Z80_H, Z80_IX_DISPLACE, 0, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
610 {Z80_LD, Z80_IXH, Z80_REG, Z80_A, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
611 {Z80_LD, Z80_IXL, Z80_REG, Z80_B, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
612 {Z80_LD, Z80_IXL, Z80_REG, Z80_C, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
613 {Z80_LD, Z80_IXL, Z80_REG, Z80_D, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
614 {Z80_LD, Z80_IXL, Z80_REG, Z80_E, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
615 {Z80_LD, Z80_IXL, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
616 {Z80_LD, Z80_IXL, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
617 {Z80_LD, Z80_L, Z80_IX_DISPLACE, 0, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
618 {Z80_LD, Z80_IXL, Z80_REG, Z80_A, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
619 //7
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
620 {Z80_LD, Z80_B, Z80_IX_DISPLACE | Z80_DIR, 0, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
621 {Z80_LD, Z80_C, Z80_IX_DISPLACE | Z80_DIR, 0, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
622 {Z80_LD, Z80_D, Z80_IX_DISPLACE | Z80_DIR, 0, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
623 {Z80_LD, Z80_E, Z80_IX_DISPLACE | Z80_DIR, 0, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
624 {Z80_LD, Z80_H, Z80_IX_DISPLACE | Z80_DIR, 0, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
625 {Z80_LD, Z80_L, Z80_IX_DISPLACE | Z80_DIR, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
626 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
627 {Z80_LD, Z80_A, Z80_IX_DISPLACE | Z80_DIR, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
628 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
629 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
630 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
631 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
632 {Z80_LD, Z80_A, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
633 {Z80_LD, Z80_A, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
634 {Z80_LD, Z80_A, Z80_IX_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
635 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
636 //8
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
637 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
638 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
639 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
640 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
641 {Z80_ADD, Z80_A, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
642 {Z80_ADD, Z80_A, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
643 {Z80_ADD, Z80_A, Z80_IX_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
644 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
645 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
646 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
647 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
648 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
649 {Z80_ADC, Z80_A, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
650 {Z80_ADC, Z80_A, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
651 {Z80_ADC, Z80_A, Z80_IX_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
652 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
653 //9
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
654 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
655 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
656 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
657 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
658 {Z80_SUB, Z80_A, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
659 {Z80_SUB, Z80_A, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
660 {Z80_SUB, Z80_A, Z80_IX_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
661 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
662 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
663 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
664 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
665 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
666 {Z80_SBC, Z80_A, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
667 {Z80_SBC, Z80_A, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
668 {Z80_SBC, Z80_A, Z80_IX_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
669 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
670 //A
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
671 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
672 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
673 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
674 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
675 {Z80_AND, Z80_A, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
676 {Z80_AND, Z80_A, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
677 {Z80_AND, Z80_A, Z80_IX_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
678 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
679 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
680 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
681 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
682 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
683 {Z80_XOR, Z80_A, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
684 {Z80_XOR, Z80_A, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
685 {Z80_XOR, Z80_A, Z80_IX_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
686 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
687 //B
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
688 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
689 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
690 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
691 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
692 {Z80_OR, Z80_A, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
693 {Z80_OR, Z80_A, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
694 {Z80_OR, Z80_A, Z80_IX_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
695 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
696 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
697 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
698 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
699 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
700 {Z80_CP, Z80_A, Z80_REG, Z80_IXH, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
701 {Z80_CP, Z80_A, Z80_REG, Z80_IXL, 0},
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
702 {Z80_CP, Z80_A, Z80_IX_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
703 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
704 //C
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
705 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
706 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
707 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
708 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
709 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
710 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
711 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
712 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
713 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
714 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
715 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
716 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
717 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
718 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
719 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
720 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
721 //D
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
722 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
723 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
724 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
725 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
726 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
727 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
728 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
729 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
730 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
731 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
732 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
733 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
734 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
735 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
736 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
737 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
738 //E
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
739 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
740 {Z80_POP, Z80_IX, Z80_UNUSED, Z80_UNUSED, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
741 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
742 {Z80_EX, Z80_IX, Z80_REG_INDIRECT | Z80_DIR, Z80_SP, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
743 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
744 {Z80_PUSH, Z80_IX, Z80_UNUSED, Z80_UNUSED, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
745 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
746 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
747 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
748 {Z80_JP, Z80_UNUSED, Z80_REG_INDIRECT, Z80_IX, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
749 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
750 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
751 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
752 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
753 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
754 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
755 //F
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
756 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
757 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
758 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
759 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
760 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
761 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
762 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
763 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
764 USE_MAIN,
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
765 {Z80_LD, Z80_SP, Z80_REG, Z80_IX, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
766 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
767 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
768 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
769 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
770 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
771 USE_MAIN
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
772 };
202
693ad04b965e Distinguish between 1-byte and 2-byte NOPs
Mike Pavone <pavone@retrodev.com>
parents: 201
diff changeset
773
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
774 #define SHIFT_BLOCK_IX(op) \
651
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
775 {op, Z80_B, Z80_IX_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
776 {op, Z80_C, Z80_IX_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
777 {op, Z80_D, Z80_IX_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
778 {op, Z80_E, Z80_IX_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
779 {op, Z80_H, Z80_IX_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
780 {op, Z80_L, Z80_IX_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
781 {op, Z80_UNUSED, Z80_IX_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
782 {op, Z80_A, Z80_IX_DISPLACE | Z80_DIR, 0, 1}
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
783
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
784 #define BIT_BLOCK_IX(bit) \
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
785 {Z80_BIT, Z80_USE_IMMED, Z80_IX_DISPLACE, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
786 {Z80_BIT, Z80_USE_IMMED, Z80_IX_DISPLACE, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
787 {Z80_BIT, Z80_USE_IMMED, Z80_IX_DISPLACE, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
788 {Z80_BIT, Z80_USE_IMMED, Z80_IX_DISPLACE, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
789 {Z80_BIT, Z80_USE_IMMED, Z80_IX_DISPLACE, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
790 {Z80_BIT, Z80_USE_IMMED, Z80_IX_DISPLACE, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
791 {Z80_BIT, Z80_USE_IMMED, Z80_IX_DISPLACE, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
792 {Z80_BIT, Z80_USE_IMMED, Z80_IX_DISPLACE, 0, bit}
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
793
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
794 #define BIT_BLOCK_IX_REG(op, bit) \
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
795 {op, Z80_B, Z80_IX_DISPLACE | Z80_DIR, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
796 {op, Z80_C, Z80_IX_DISPLACE | Z80_DIR, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
797 {op, Z80_D, Z80_IX_DISPLACE | Z80_DIR, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
798 {op, Z80_E, Z80_IX_DISPLACE | Z80_DIR, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
799 {op, Z80_H, Z80_IX_DISPLACE | Z80_DIR, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
800 {op, Z80_L, Z80_IX_DISPLACE | Z80_DIR, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
801 {op, Z80_USE_IMMED, Z80_IX_DISPLACE, 0, bit},\
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
802 {op, Z80_A, Z80_IX_DISPLACE | Z80_DIR, 0, bit}
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
803
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
804 z80inst z80_tbl_ix_bit[256] = {
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
805 //0
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
806 SHIFT_BLOCK_IX(Z80_RLC),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
807 SHIFT_BLOCK_IX(Z80_RRC),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
808 //1
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
809 SHIFT_BLOCK_IX(Z80_RL),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
810 SHIFT_BLOCK_IX(Z80_RR),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
811 //2
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
812 SHIFT_BLOCK_IX(Z80_SLA),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
813 SHIFT_BLOCK_IX(Z80_SRA),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
814 //3
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
815 SHIFT_BLOCK_IX(Z80_SLL),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
816 SHIFT_BLOCK_IX(Z80_SRL),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
817 //4
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
818 BIT_BLOCK_IX(0),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
819 BIT_BLOCK_IX(1),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
820 //5
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
821 BIT_BLOCK_IX(2),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
822 BIT_BLOCK_IX(3),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
823 //6
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
824 BIT_BLOCK_IX(4),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
825 BIT_BLOCK_IX(5),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
826 //7
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
827 BIT_BLOCK_IX(6),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
828 BIT_BLOCK_IX(7),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
829 //8
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
830 BIT_BLOCK_IX_REG(Z80_RES, 0),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
831 BIT_BLOCK_IX_REG(Z80_RES, 1),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
832 //9
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
833 BIT_BLOCK_IX_REG(Z80_RES, 2),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
834 BIT_BLOCK_IX_REG(Z80_RES, 3),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
835 //A
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
836 BIT_BLOCK_IX_REG(Z80_RES, 4),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
837 BIT_BLOCK_IX_REG(Z80_RES, 5),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
838 //B
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
839 BIT_BLOCK_IX_REG(Z80_RES, 6),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
840 BIT_BLOCK_IX_REG(Z80_RES, 7),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
841 //C
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
842 BIT_BLOCK_IX_REG(Z80_SET, 0),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
843 BIT_BLOCK_IX_REG(Z80_SET, 1),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
844 //D
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
845 BIT_BLOCK_IX_REG(Z80_SET, 2),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
846 BIT_BLOCK_IX_REG(Z80_SET, 3),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
847 //E
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
848 BIT_BLOCK_IX_REG(Z80_SET, 4),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
849 BIT_BLOCK_IX_REG(Z80_SET, 5),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
850 //F
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
851 BIT_BLOCK_IX_REG(Z80_SET, 6),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
852 BIT_BLOCK_IX_REG(Z80_SET, 7),
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
853 };
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
854
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
855 z80inst z80_tbl_iy[256] = {
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
856 //0
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
857 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
858 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
859 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
860 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
861 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
862 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
863 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
864 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
865 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
866 {Z80_ADD, Z80_IY, Z80_REG, Z80_BC, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
867 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
868 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
869 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
870 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
871 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
872 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
873 //1
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
874 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
875 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
876 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
877 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
878 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
879 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
880 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
881 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
882 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
883 {Z80_ADD, Z80_IY, Z80_REG, Z80_DE, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
884 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
885 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
886 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
887 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
888 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
889 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
890 //2
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
891 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
892 {Z80_LD, Z80_IY, Z80_IMMED, Z80_UNUSED, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
893 {Z80_LD, Z80_IY, Z80_IMMED_INDIRECT | Z80_DIR, Z80_UNUSED, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
894 {Z80_INC, Z80_IY, Z80_UNUSED, Z80_UNUSED, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
895 {Z80_INC, Z80_IYH, Z80_UNUSED, Z80_UNUSED, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
896 {Z80_DEC, Z80_IYH, Z80_UNUSED, Z80_UNUSED, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
897 {Z80_LD, Z80_IYH, Z80_IMMED, Z80_UNUSED, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
898 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
899 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
900 {Z80_ADD, Z80_IY, Z80_REG, Z80_IY, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
901 {Z80_LD, Z80_IY, Z80_IMMED_INDIRECT, Z80_UNUSED, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
902 {Z80_DEC, Z80_IY, Z80_UNUSED, Z80_UNUSED, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
903 {Z80_INC, Z80_IYL, Z80_UNUSED, Z80_UNUSED, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
904 {Z80_DEC, Z80_IYL, Z80_UNUSED, Z80_UNUSED, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
905 {Z80_LD, Z80_IYL, Z80_IMMED, Z80_UNUSED, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
906 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
907 //3
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
908 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
909 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
910 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
911 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
912 {Z80_INC, Z80_UNUSED, Z80_IY_DISPLACE, 0, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
913 {Z80_DEC, Z80_UNUSED, Z80_IY_DISPLACE, 0, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
914 {Z80_LD, Z80_USE_IMMED, Z80_IY_DISPLACE | Z80_DIR, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
915 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
916 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
917 {Z80_ADD, Z80_IY, Z80_REG, Z80_SP, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
918 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
919 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
920 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
921 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
922 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
923 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
924 //4
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
925 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
926 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
927 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
928 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
929 {Z80_LD, Z80_B, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
930 {Z80_LD, Z80_B, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
931 {Z80_LD, Z80_B, Z80_IY_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
932 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
933 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
934 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
935 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
936 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
937 {Z80_LD, Z80_C, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
938 {Z80_LD, Z80_C, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
939 {Z80_LD, Z80_C, Z80_IY_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
940 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
941 //5
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
942 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
943 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
944 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
945 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
946 {Z80_LD, Z80_D, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
947 {Z80_LD, Z80_D, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
948 {Z80_LD, Z80_D, Z80_IY_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
949 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
950 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
951 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
952 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
953 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
954 {Z80_LD, Z80_E, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
955 {Z80_LD, Z80_E, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
956 {Z80_LD, Z80_E, Z80_IY_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
957 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
958 //6
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
959 {Z80_LD, Z80_IYH, Z80_REG, Z80_B, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
960 {Z80_LD, Z80_IYH, Z80_REG, Z80_C, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
961 {Z80_LD, Z80_IYH, Z80_REG, Z80_D, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
962 {Z80_LD, Z80_IYH, Z80_REG, Z80_E, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
963 {Z80_LD, Z80_IYH, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
964 {Z80_LD, Z80_IYH, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
965 {Z80_LD, Z80_H, Z80_IY_DISPLACE, 0, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
966 {Z80_LD, Z80_IYH, Z80_REG, Z80_A, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
967 {Z80_LD, Z80_IYL, Z80_REG, Z80_B, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
968 {Z80_LD, Z80_IYL, Z80_REG, Z80_C, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
969 {Z80_LD, Z80_IYL, Z80_REG, Z80_D, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
970 {Z80_LD, Z80_IYL, Z80_REG, Z80_E, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
971 {Z80_LD, Z80_IYL, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
972 {Z80_LD, Z80_IYL, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
973 {Z80_LD, Z80_L, Z80_IY_DISPLACE, 0, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
974 {Z80_LD, Z80_IYL, Z80_REG, Z80_A, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
975 //7
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
976 {Z80_LD, Z80_B, Z80_IY_DISPLACE | Z80_DIR, 0, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
977 {Z80_LD, Z80_C, Z80_IY_DISPLACE | Z80_DIR, 0, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
978 {Z80_LD, Z80_D, Z80_IY_DISPLACE | Z80_DIR, 0, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
979 {Z80_LD, Z80_E, Z80_IY_DISPLACE | Z80_DIR, 0, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
980 {Z80_LD, Z80_H, Z80_IY_DISPLACE | Z80_DIR, 0, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
981 {Z80_LD, Z80_L, Z80_IY_DISPLACE | Z80_DIR, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
982 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
983 {Z80_LD, Z80_A, Z80_IY_DISPLACE | Z80_DIR, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
984 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
985 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
986 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
987 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
988 {Z80_LD, Z80_A, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
989 {Z80_LD, Z80_A, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
990 {Z80_LD, Z80_A, Z80_IY_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
991 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
992 //8
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
993 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
994 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
995 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
996 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
997 {Z80_ADD, Z80_A, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
998 {Z80_ADD, Z80_A, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
999 {Z80_ADD, Z80_A, Z80_IY_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1000 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1001 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1002 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1003 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1004 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1005 {Z80_ADC, Z80_A, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1006 {Z80_ADC, Z80_A, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1007 {Z80_ADC, Z80_A, Z80_IY_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1008 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1009 //9
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1010 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1011 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1012 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1013 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1014 {Z80_SUB, Z80_A, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1015 {Z80_SUB, Z80_A, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1016 {Z80_SUB, Z80_A, Z80_IY_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1017 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1018 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1019 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1020 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1021 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1022 {Z80_SBC, Z80_A, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1023 {Z80_SBC, Z80_A, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1024 {Z80_SBC, Z80_A, Z80_IY_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1025 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1026 //A
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1027 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1028 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1029 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1030 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1031 {Z80_AND, Z80_A, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1032 {Z80_AND, Z80_A, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1033 {Z80_AND, Z80_A, Z80_IY_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1034 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1035 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1036 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1037 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1038 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1039 {Z80_XOR, Z80_A, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1040 {Z80_XOR, Z80_A, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1041 {Z80_XOR, Z80_A, Z80_IY_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1042 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1043 //B
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1044 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1045 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1046 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1047 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1048 {Z80_OR, Z80_A, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1049 {Z80_OR, Z80_A, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1050 {Z80_OR, Z80_A, Z80_IY_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1051 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1052 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1053 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1054 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1055 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1056 {Z80_CP, Z80_A, Z80_REG, Z80_IYH, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1057 {Z80_CP, Z80_A, Z80_REG, Z80_IYL, 0},
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1058 {Z80_CP, Z80_A, Z80_IY_DISPLACE, 0, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1059 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1060 //C
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1061 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1062 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1063 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1064 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1065 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1066 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1067 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1068 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1069 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1070 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1071 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1072 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1073 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1074 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1075 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1076 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1077 //D
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1078 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1079 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1080 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1081 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1082 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1083 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1084 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1085 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1086 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1087 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1088 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1089 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1090 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1091 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1092 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1093 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1094 //E
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1095 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1096 {Z80_POP, Z80_IY, Z80_UNUSED, Z80_UNUSED, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1097 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1098 {Z80_EX, Z80_IY, Z80_REG_INDIRECT | Z80_DIR, Z80_SP, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1099 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1100 {Z80_PUSH, Z80_IY, Z80_UNUSED, Z80_UNUSED, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1101 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1102 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1103 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1104 {Z80_JP, Z80_UNUSED, Z80_REG_INDIRECT, Z80_IY, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1105 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1106 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1107 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1108 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1109 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1110 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1111 //F
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1112 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1113 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1114 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1115 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1116 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1117 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1118 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1119 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1120 USE_MAIN,
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1121 {Z80_LD, Z80_SP, Z80_REG, Z80_IY, 0},
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1122 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1123 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1124 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1125 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1126 USE_MAIN,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1127 USE_MAIN
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1128 };
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1129
206
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1130 #define SHIFT_BLOCK_IY(op) \
651
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
1131 {op, Z80_B, Z80_IY_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
1132 {op, Z80_C, Z80_IY_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
1133 {op, Z80_D, Z80_IY_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
1134 {op, Z80_E, Z80_IY_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
1135 {op, Z80_H, Z80_IY_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
1136 {op, Z80_L, Z80_IY_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
1137 {op, Z80_UNUSED, Z80_IY_DISPLACE | Z80_DIR, 0, 1},\
103d5cabbe14 Fix flags for rra, rrca, rla and rlca. Fix timing for rr, rrc, rl and rlc when using IX or IY. Fix access to I and R registers (R still needs to be made 7-bit though). Fix flags for ld a, i. The fix for access to I fixes PCM playback in Titan Overdrive and music playback in Crackdown.
Michael Pavone <pavone@retrodev.com>
parents: 467
diff changeset
1138 {op, Z80_A, Z80_IY_DISPLACE | Z80_DIR, 0, 1}
206
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1139
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1140 #define BIT_BLOCK_IY(bit) \
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1141 {Z80_BIT, Z80_USE_IMMED, Z80_IY_DISPLACE, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1142 {Z80_BIT, Z80_USE_IMMED, Z80_IY_DISPLACE, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1143 {Z80_BIT, Z80_USE_IMMED, Z80_IY_DISPLACE, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1144 {Z80_BIT, Z80_USE_IMMED, Z80_IY_DISPLACE, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1145 {Z80_BIT, Z80_USE_IMMED, Z80_IY_DISPLACE, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1146 {Z80_BIT, Z80_USE_IMMED, Z80_IY_DISPLACE, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1147 {Z80_BIT, Z80_USE_IMMED, Z80_IY_DISPLACE, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1148 {Z80_BIT, Z80_USE_IMMED, Z80_IY_DISPLACE, 0, bit}
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1149
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1150 #define BIT_BLOCK_IY_REG(op, bit) \
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1151 {op, Z80_B, Z80_IY_DISPLACE | Z80_DIR, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1152 {op, Z80_C, Z80_IY_DISPLACE | Z80_DIR, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1153 {op, Z80_D, Z80_IY_DISPLACE | Z80_DIR, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1154 {op, Z80_E, Z80_IY_DISPLACE | Z80_DIR, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1155 {op, Z80_H, Z80_IY_DISPLACE | Z80_DIR, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1156 {op, Z80_L, Z80_IY_DISPLACE | Z80_DIR, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1157 {op, Z80_USE_IMMED, Z80_IY_DISPLACE, 0, bit},\
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1158 {op, Z80_A, Z80_IY_DISPLACE | Z80_DIR, 0, bit}
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1159
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1160 z80inst z80_tbl_iy_bit[256] = {
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1161 //0
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1162 SHIFT_BLOCK_IY(Z80_RLC),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1163 SHIFT_BLOCK_IY(Z80_RRC),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1164 //1
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1165 SHIFT_BLOCK_IY(Z80_RL),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1166 SHIFT_BLOCK_IY(Z80_RR),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1167 //2
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1168 SHIFT_BLOCK_IY(Z80_SLA),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1169 SHIFT_BLOCK_IY(Z80_SRA),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1170 //3
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1171 SHIFT_BLOCK_IY(Z80_SLL),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1172 SHIFT_BLOCK_IY(Z80_SRL),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1173 //4
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1174 BIT_BLOCK_IY(0),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1175 BIT_BLOCK_IY(1),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1176 //5
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1177 BIT_BLOCK_IY(2),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1178 BIT_BLOCK_IY(3),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1179 //6
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1180 BIT_BLOCK_IY(4),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1181 BIT_BLOCK_IY(5),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1182 //7
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1183 BIT_BLOCK_IY(6),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1184 BIT_BLOCK_IY(7),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1185 //8
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1186 BIT_BLOCK_IY_REG(Z80_RES, 0),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1187 BIT_BLOCK_IY_REG(Z80_RES, 1),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1188 //9
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1189 BIT_BLOCK_IY_REG(Z80_RES, 2),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1190 BIT_BLOCK_IY_REG(Z80_RES, 3),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1191 //A
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1192 BIT_BLOCK_IY_REG(Z80_RES, 4),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1193 BIT_BLOCK_IY_REG(Z80_RES, 5),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1194 //B
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1195 BIT_BLOCK_IY_REG(Z80_RES, 6),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1196 BIT_BLOCK_IY_REG(Z80_RES, 7),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1197 //C
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1198 BIT_BLOCK_IY_REG(Z80_SET, 0),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1199 BIT_BLOCK_IY_REG(Z80_SET, 1),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1200 //D
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1201 BIT_BLOCK_IY_REG(Z80_SET, 2),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1202 BIT_BLOCK_IY_REG(Z80_SET, 3),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1203 //E
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1204 BIT_BLOCK_IY_REG(Z80_SET, 4),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1205 BIT_BLOCK_IY_REG(Z80_SET, 5),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1206 //F
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1207 BIT_BLOCK_IY_REG(Z80_SET, 6),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1208 BIT_BLOCK_IY_REG(Z80_SET, 7),
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1209 };
807ca611b561 Add support for IY bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 205
diff changeset
1210
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1211 enum {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1212 NORMAL,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1213 USE_IX,
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1214 USE_IY
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1215 };
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1216
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1217 uint8_t * z80_decode(uint8_t * istream, z80inst * decoded)
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1218 {
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1219 uint8_t tmp;
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1220 uint8_t *start = istream;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1221 uint8_t ixiy = NORMAL;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1222 uint16_t ixiy_disp = 0x100;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1223 z80inst *base = NULL;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1224 while(!base)
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1225 {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1226 switch (*istream)
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1227 {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1228 case 0xCB:
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1229 istream++;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1230 if (ixiy == NORMAL) {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1231 base = z80_tbl_bit + *istream;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1232 } else if (ixiy == USE_IX) {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1233 ixiy_disp = *(istream++);
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1234 base = z80_tbl_ix_bit + *istream;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1235 } else {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1236 ixiy_disp = *(istream++);
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1237 base = z80_tbl_iy_bit + *istream;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1238 }
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1239 break;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1240 case 0xED:
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1241 istream++;
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1242 ixiy = NORMAL;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1243 if (*istream < 0x40 || *istream >= 0xC0) {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1244 base = z80_tbl_extd + 0xBF;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1245 } else {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1246 base = z80_tbl_extd + *istream - 0x40;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1247 }
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1248 break;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1249 case 0xDD:
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1250 istream++;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1251 ixiy = USE_IX;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1252 break;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1253 case 0xFD:
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1254 istream++;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1255 ixiy = USE_IY;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1256 break;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1257 default:
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1258 if (ixiy == NORMAL) {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1259 base = z80_tbl_a + *istream;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1260 } else if (ixiy == USE_IX) {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1261 base = z80_tbl_ix + *istream;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1262 } else {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1263 base = z80_tbl_iy + *istream;
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1264 }
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1265 }
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1266 }
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1267 if (base->op == Z80_USE_MAIN) {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1268 base = z80_tbl_a + *istream;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1269 ixiy = NORMAL;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1270 }
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1271 memcpy(decoded, base, offsetof(z80inst, opcode_bytes));
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1272 decoded->opcode_bytes = istream - start + 1;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1273 if (ixiy != NORMAL) {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1274 if (ixiy_disp < 0x100) {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1275 decoded->ea_reg = ixiy_disp;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1276 //don't count displacement byte as an opcode byte
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1277 decoded->opcode_bytes--;
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1278 } else if ((decoded->addr_mode & 0x1F) == Z80_IX_DISPLACE || (decoded->addr_mode & 0x1F) == Z80_IY_DISPLACE) {
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1279 decoded->ea_reg = *(++istream);
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1280 }
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1281 }
1044
1625555e346e Properly handle redundant prefixes
Michael Pavone <pavone@retrodev.com>
parents: 651
diff changeset
1282
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1283 if ((decoded->addr_mode & 0x1F) == Z80_IMMED && decoded->op != Z80_RST && decoded->op != Z80_IM) {
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1284 decoded->immed = *(++istream);
256
ce7ce2b9c2df Fix decoding of address in JP and JPCC instructions in the Z80 core
Mike Pavone <pavone@retrodev.com>
parents: 247
diff changeset
1285 if ((decoded->reg >= Z80_BC && decoded->reg < Z80_UNUSED) || decoded->op == Z80_CALL || decoded->op == Z80_CALLCC || decoded->op == Z80_JP || decoded->op == Z80_JPCC) {
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1286 decoded->immed |= *(++istream) << 8;
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1287 } else if (decoded->immed & 0x80) {
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1288 decoded->immed |= 0xFF00;
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1289 }
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1290 } else if ((decoded->addr_mode & 0x1F) == Z80_IMMED_INDIRECT) {
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1291 decoded->immed = *(++istream);
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1292 if (decoded->op != Z80_OUT && decoded->op != Z80_IN) {
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1293 decoded->immed |= *(++istream) << 8;
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1294 }
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1295 }
1159
8519b54f9413 Fix decoding of undocumented Z80 instruction out (c), 0
Michael Pavone <pavone@retrodev.com>
parents: 1044
diff changeset
1296 if (decoded->reg == Z80_USE_IMMED && decoded->op != Z80_BIT && decoded->op != Z80_RES && decoded->op != Z80_SET && decoded->op != Z80_OUT) {
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1297 decoded->immed = *(++istream);
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1298 }
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1299 return istream+1;
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1300 }
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1301
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1302 char *z80_mnemonics[Z80_OTDR+1] = {
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1303 "ld",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1304 "push",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1305 "pop",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1306 "ex",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1307 "exx",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1308 "ldi",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1309 "ldir",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1310 "ldd",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1311 "lddr",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1312 "cpi",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1313 "cpir",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1314 "cpd",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1315 "cpdr",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1316 "add",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1317 "adc",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1318 "sub",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1319 "sbc",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1320 "and",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1321 "or",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1322 "xor",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1323 "cp",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1324 "inc",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1325 "dec",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1326 "daa",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1327 "cpl",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1328 "neg",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1329 "ccf",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1330 "scf",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1331 "nop",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1332 "halt",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1333 "di",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1334 "ei",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1335 "im",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1336 "rlc",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1337 "rl",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1338 "rrc",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1339 "rr",
201
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
1340 "sla",
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
1341 "sra",
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
1342 "sll",
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
1343 "srl",
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1344 "rld",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1345 "rrd",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1346 "bit",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1347 "set",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1348 "res",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1349 "jp",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1350 "jp",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1351 "jr",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1352 "jr",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1353 "djnz",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1354 "call",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1355 "call",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1356 "ret",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1357 "ret",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1358 "reti",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1359 "retn",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1360 "rst",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1361 "in",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1362 "ini",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1363 "inir",
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1364 "ind",
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1365 "indr",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1366 "out",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1367 "outi",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1368 "otir",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1369 "outd",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1370 "otdr"
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1371 };
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1372
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1373 char * z80_regs[Z80_USE_IMMED] = {
235
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 213
diff changeset
1374 "c",
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1375 "b",
235
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 213
diff changeset
1376 "e",
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1377 "d",
235
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 213
diff changeset
1378 "l",
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1379 "h",
235
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 213
diff changeset
1380 "ixl",
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1381 "ixh",
235
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 213
diff changeset
1382 "iyl",
204
02dfa5962522 Add support for 2-byte IY instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 203
diff changeset
1383 "iyh",
200
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1384 "i",
d3066ceb29d1 Add support for EXTD group 2-byte Z80 instructions in decoder
Mike Pavone <pavone@retrodev.com>
parents: 199
diff changeset
1385 "r",
213
4d4559b04c59 Make reset trigger debug exit to make it easier to test the same cases in blastem and musashi. Fix asl #1 overflow flag.
Mike Pavone <pavone@retrodev.com>
parents: 206
diff changeset
1386 "a",
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1387 "bc",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1388 "de",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1389 "hl",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1390 "sp",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1391 "af",
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1392 "ix",
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1393 "iy",
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1394 };
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1395
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1396 char * z80_conditions[Z80_CC_M+1] = {
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1397 "nz",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1398 "z",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1399 "nc",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1400 "c",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1401 "po",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1402 "pe",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1403 "p",
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1404 "m"
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1405 };
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1406
314
54c0e5f22198 Show absolute addresses for JR, JRCC and DJNZ in Z80 disassembler
Mike Pavone <pavone@retrodev.com>
parents: 313
diff changeset
1407 int z80_disasm(z80inst * decoded, char * dst, uint16_t address)
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1408 {
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1409 int len = sprintf(dst, "%s", z80_mnemonics[decoded->op]);
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1410 uint8_t needcomma;
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1411 if (decoded->addr_mode & Z80_DIR) {
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1412 needcomma = 1;
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1413 switch (decoded->addr_mode & 0x1F)
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1414 {
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1415 case Z80_REG:
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1416 len += sprintf(dst+len, " %s", z80_regs[decoded->ea_reg]);
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1417 break;
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1418 case Z80_REG_INDIRECT:
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1419 len += sprintf(dst+len, " (%s)", z80_regs[decoded->ea_reg]);
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1420 break;
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1421 case Z80_IMMED:
278
9578e5dea147 Use hex where appropriate in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 270
diff changeset
1422 if (decoded->immed >= 63 || decoded->op == Z80_JP || decoded->op == Z80_JPCC || decoded->op == Z80_CALL || decoded->op == Z80_CALLCC || decoded->op == Z80_RST)
9578e5dea147 Use hex where appropriate in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 270
diff changeset
1423 {
9578e5dea147 Use hex where appropriate in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 270
diff changeset
1424 len += sprintf(dst+len, " $%X", decoded->immed);
9578e5dea147 Use hex where appropriate in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 270
diff changeset
1425 } else {
9578e5dea147 Use hex where appropriate in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 270
diff changeset
1426 len += sprintf(dst+len, " %d", decoded->immed);
9578e5dea147 Use hex where appropriate in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 270
diff changeset
1427 }
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1428 break;
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1429 case Z80_IMMED_INDIRECT:
278
9578e5dea147 Use hex where appropriate in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 270
diff changeset
1430 len += sprintf(dst+len, " ($%X)", decoded->immed);
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1431 break;
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1432 case Z80_IX_DISPLACE:
297
147e31983730 Fix printing of negative displacements in Z80 disassembler
Mike Pavone <pavone@retrodev.com>
parents: 292
diff changeset
1433 len += sprintf(dst+len, " (ix+%d)", decoded->ea_reg & 0x80 ? decoded->ea_reg - 256 : decoded->ea_reg);
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1434 break;
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1435 case Z80_IY_DISPLACE:
297
147e31983730 Fix printing of negative displacements in Z80 disassembler
Mike Pavone <pavone@retrodev.com>
parents: 292
diff changeset
1436 len += sprintf(dst+len, " (iy+%d)", decoded->ea_reg & 0x80 ? decoded->ea_reg - 256 : decoded->ea_reg);
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1437 break;
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1438 default:
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1439 needcomma = 0;
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1440 }
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1441 if (decoded->reg & Z80_IMMED_FLAG) {
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1442 len += sprintf(dst+len, "%s %d", needcomma ? "," : "", decoded->immed);
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1443 }
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1444 if ((decoded->reg & 0x1F) != Z80_UNUSED) {
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1445 if (decoded->op == Z80_JRCC || decoded->op == Z80_JPCC || decoded->op == Z80_CALLCC || decoded->op == Z80_RETCC) {
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1446 len += sprintf(dst+len, "%s %s", needcomma ? "," : "", z80_conditions[decoded->reg & 0x1F]);
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1447 } else {
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1448 len += sprintf(dst+len, "%s %s", needcomma ? "," : "", z80_regs[decoded->reg & 0x1F]);
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1449 }
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1450 }
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1451 } else {
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1452 needcomma = 0;
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1453 if (decoded->reg & Z80_IMMED_FLAG) {
201
2d2fa345e1fc Add support for bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 200
diff changeset
1454 len += sprintf(dst+len, " %d", decoded->immed);
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1455 needcomma = 1;
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1456 }
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1457 if ((decoded->reg & 0x1F) != Z80_UNUSED) {
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1458 if (decoded->op == Z80_JRCC || decoded->op == Z80_JPCC || decoded->op == Z80_CALLCC || decoded->op == Z80_RETCC) {
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1459 len += sprintf(dst+len, " %s", z80_conditions[decoded->reg & 0x1F]);
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1460 } else {
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1461 len += sprintf(dst+len, " %s", z80_regs[decoded->reg & 0x1F]);
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1462 }
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1463 needcomma = 1;
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1464 }
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1465 switch (decoded->addr_mode)
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1466 {
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1467 case Z80_REG:
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1468 len += sprintf(dst+len, "%s %s", needcomma ? "," : "" , z80_regs[decoded->ea_reg]);
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1469 break;
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1470 case Z80_REG_INDIRECT:
205
19b323614309 Add support for IX bit instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 204
diff changeset
1471 len += sprintf(dst+len, "%s (%s)", needcomma ? "," : "" , z80_regs[decoded->ea_reg]);
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1472 break;
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1473 case Z80_IMMED:
314
54c0e5f22198 Show absolute addresses for JR, JRCC and DJNZ in Z80 disassembler
Mike Pavone <pavone@retrodev.com>
parents: 313
diff changeset
1474 if (decoded->op == Z80_JR || decoded->op == Z80_JRCC || decoded->op == Z80_DJNZ) {
54c0e5f22198 Show absolute addresses for JR, JRCC and DJNZ in Z80 disassembler
Mike Pavone <pavone@retrodev.com>
parents: 313
diff changeset
1475 address += 2 + decoded->immed;
54c0e5f22198 Show absolute addresses for JR, JRCC and DJNZ in Z80 disassembler
Mike Pavone <pavone@retrodev.com>
parents: 313
diff changeset
1476 len += sprintf(dst+len, "%s %X", needcomma ? "," : "" , address);
54c0e5f22198 Show absolute addresses for JR, JRCC and DJNZ in Z80 disassembler
Mike Pavone <pavone@retrodev.com>
parents: 313
diff changeset
1477 } else if (decoded->immed >= 63 || decoded->op == Z80_JP || decoded->op == Z80_JPCC || decoded->op == Z80_CALL || decoded->op == Z80_CALLCC || decoded->op == Z80_RST)
278
9578e5dea147 Use hex where appropriate in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 270
diff changeset
1478 {
9578e5dea147 Use hex where appropriate in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 270
diff changeset
1479 len += sprintf(dst+len, "%s $%X", needcomma ? "," : "" , decoded->immed);
9578e5dea147 Use hex where appropriate in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 270
diff changeset
1480 } else {
9578e5dea147 Use hex where appropriate in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 270
diff changeset
1481 len += sprintf(dst+len, "%s %d", needcomma ? "," : "" , decoded->immed);
9578e5dea147 Use hex where appropriate in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 270
diff changeset
1482 }
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1483 break;
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1484 case Z80_IMMED_INDIRECT:
278
9578e5dea147 Use hex where appropriate in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 270
diff changeset
1485 len += sprintf(dst+len, "%s ($%X)", needcomma ? "," : "" , decoded->immed);
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1486 break;
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1487 case Z80_IX_DISPLACE:
297
147e31983730 Fix printing of negative displacements in Z80 disassembler
Mike Pavone <pavone@retrodev.com>
parents: 292
diff changeset
1488 len += sprintf(dst+len, "%s (ix+%d)", needcomma ? "," : "" , decoded->ea_reg & 0x80 ? decoded->ea_reg - 256 : decoded->ea_reg);
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1489 break;
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1490 case Z80_IY_DISPLACE:
297
147e31983730 Fix printing of negative displacements in Z80 disassembler
Mike Pavone <pavone@retrodev.com>
parents: 292
diff changeset
1491 len += sprintf(dst+len, "%s (iy+%d)", needcomma ? "," : "" , decoded->ea_reg & 0x80 ? decoded->ea_reg - 256 : decoded->ea_reg);
203
0ae589d4c3f9 Add support for 2-byte IX instructions to decoder
Mike Pavone <pavone@retrodev.com>
parents: 202
diff changeset
1492 break;
199
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1493 }
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1494 }
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1495 return len;
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1496 }
69585e7d474f Add initial stab at Z80 decoder and disassembler
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1497
292
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1498 uint8_t z80_high_reg(uint8_t reg)
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1499 {
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1500 switch(reg)
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1501 {
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1502 case Z80_C:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1503 case Z80_BC:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1504 return Z80_B;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1505 case Z80_E:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1506 case Z80_DE:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1507 return Z80_D;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1508 case Z80_L:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1509 case Z80_HL:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1510 return Z80_H;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1511 case Z80_IXL:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1512 case Z80_IX:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1513 return Z80_IXH;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1514 case Z80_IYL:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1515 case Z80_IY:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1516 return Z80_IYH;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1517 default:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1518 return Z80_UNUSED;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1519 }
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1520 }
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1521
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1522 uint8_t z80_low_reg(uint8_t reg)
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1523 {
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1524 switch(reg)
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1525 {
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1526 case Z80_B:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1527 case Z80_BC:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1528 return Z80_C;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1529 case Z80_D:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1530 case Z80_DE:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1531 return Z80_E;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1532 case Z80_H:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1533 case Z80_HL:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1534 return Z80_L;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1535 case Z80_IXH:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1536 case Z80_IX:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1537 return Z80_IXL;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1538 case Z80_IYH:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1539 case Z80_IY:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1540 return Z80_IYL;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1541 default:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1542 return Z80_UNUSED;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1543 }
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1544 }
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1545
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1546 uint8_t z80_word_reg(uint8_t reg)
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1547 {
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1548 switch(reg)
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1549 {
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1550 case Z80_B:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1551 case Z80_C:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1552 return Z80_BC;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1553 case Z80_D:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1554 case Z80_E:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1555 return Z80_DE;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1556 case Z80_H:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1557 case Z80_L:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1558 return Z80_HL;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1559 case Z80_IXH:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1560 case Z80_IXL:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1561 return Z80_IX;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1562 case Z80_IYH:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1563 case Z80_IYL:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1564 return Z80_IY;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1565 default:
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1566 return Z80_UNUSED;
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1567 }
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1568 }
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1569
313
a13329645ea3 Fix terminal instruction detection in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 297
diff changeset
1570 uint8_t z80_is_terminal(z80inst * inst)
a13329645ea3 Fix terminal instruction detection in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 297
diff changeset
1571 {
a13329645ea3 Fix terminal instruction detection in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 297
diff changeset
1572 return inst->op == Z80_RET || inst->op == Z80_RETI || inst->op == Z80_RETN || inst->op == Z80_JP
a13329645ea3 Fix terminal instruction detection in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 297
diff changeset
1573 || inst->op == Z80_JR || inst->op == Z80_HALT || (inst->op == Z80_NOP && inst->immed == 42);
a13329645ea3 Fix terminal instruction detection in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 297
diff changeset
1574 }
292
b970ea214ecb Added z80 test generator and z80 test runner.
Mike Pavone <pavone@retrodev.com>
parents: 278
diff changeset
1575
313
a13329645ea3 Fix terminal instruction detection in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 297
diff changeset
1576
a13329645ea3 Fix terminal instruction detection in disassembler
Mike Pavone <pavone@retrodev.com>
parents: 297
diff changeset
1577