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,
OR ,
MOV,
IML,
IDV,
PSH,
PUL,
NEG,
SET
};
enum base_isa {
CPS_IMP = 0x00,
ADC_IMM = 0x01,
ROR_IMM = 0x02,
CPB_IMM = 0x04,
ADC_Z = 0x05,
ROR_Z = 0x06,
CPB_Z = 0x08,
CLC_IMP = 0x09,
TAB_IMP = 0x0A,
STY_Z = 0x0C,
JMP_AB = 0x10,
ADC_AB = 0x11,
ROR_AB = 0x12,
CPB_AB = 0x14,
ADC_B = 0x15,
ROR_B = 0x16,
STY_AB = 0x18,
SEC_IMP = 0x19,
TBA_IMP = 0x1A,
JMP_Z = 0x20,
SBC_IMM = 0x21,
MUL_IMM = 0x22,
CPX_IMM = 0x24,
SBC_Z = 0x25,
MUL_Z = 0x26,
CPX_Z = 0x28,
CLI_IMP = 0x29,
TAY_IMP = 0x2A,
STA_Z = 0x2C,
STA_ZX = 0x2E,
JSR_AB = 0x30,
SBC_AB = 0x31,
MUL_AB = 0x32,
CPX_AB = 0x34,
SBC_B = 0x35,
MUL_B = 0x36,
STA_AB = 0x38,
SEI_IMP = 0x39,
TYA_IMP = 0x3A,
STA_ZY = 0x3C,
STA_IX = 0x3E,
JSR_Z = 0x40,
AND_IMM = 0x41,
DIV_IMM = 0x42,
CPY_IMM = 0x44,
AND_Z = 0x45,
DIV_Z = 0x46,
CPY_Z = 0x48,
CLV_IMP = 0x49,
TAX_IMP = 0x4A,
STB_Z = 0x4C,
STB_ZX = 0x4E,
RTS_IMP = 0x50,
AND_AB = 0x51,
DIV_AB = 0x52,
CPY_AB = 0x54,
AND_B = 0x55,
DIV_B = 0x56,
STB_AB = 0x58,
WAI_IMP = 0x59,
TXA_IMP = 0x5A,
STB_ZY = 0x5C,
STB_IX = 0x5E,
RTI_IMP = 0x60,
ORA_IMM = 0x61,
ASR_IMM = 0x62,
LDX_IMM = 0x64,
ORA_Z = 0x65,
ASR_Z = 0x66,
LDX_Z = 0x68,
BRK_IMP = 0x69,
TYX_IMP = 0x6A,
STX_Z = 0x6C,
PHP_IMP = 0x6E,
BPO_REL = 0x70,
ORA_AB = 0x71,
ASR_AB = 0x72,
LDX_AB = 0x74,
ORA_B = 0x75,
ASR_B = 0x76,
STX_AB = 0x78,
DEY_IMP = 0x79,
TXY_IMP = 0x7A,
CPB_IN = 0x7C,
PLP_IMP = 0x7E,
BNG_REL = 0x80,
XOR_IMM = 0x81,
CMP_IMM = 0x82,
DEC_IMP = 0x84,
XOR_Z = 0x85,
CMP_Z = 0x86,
DEC_Z = 0x88,
INY_IMP = 0x89,
TSX_IMP = 0x8A,
CMP_IN = 0x8C,
PHA_IMP = 0x8E,
BCS_REL = 0x90,
XOR_AB = 0x91,
CMP_AB = 0x92,
DEC_AB = 0x94,
XOR_B = 0x95,
CMP_B = 0x96,
DEB_IMP = 0x99,
TXS_IMP = 0x9A,
STY_IN = 0x9C,
PLA_IMP = 0x9E,
BCC_REL = 0xA0,
LSL_IMM = 0xA1,
LDY_IMM = 0xA2,
INC_IMP = 0xA4,
LSL_Z = 0xA5,
LDY_Z = 0xA6,
INC_Z = 0xA8,
INB_IMP = 0xA9,
CMP_IX = 0xAA,
LDY_IN = 0xAC,
PHB_IMP = 0xAE,
BEQ_REL = 0xB0,
LSL_AB = 0xB1,
LDY_AB = 0xB2,
INC_AB = 0xB4,
LSL_B = 0xB5,
DEX_IMP = 0xB9,
CPB_IX = 0xBA,
LDX_IN = 0xBC,
PLB_IMP = 0xBE,
BNE_REL = 0xC0,
LSR_IMM = 0xC1,
LDA_IMM = 0xC2,
LDA_IN = 0xC4,
LSR_Z = 0xC5,
LDA_Z = 0xC6,
LDA_ZX = 0xC8,
INX_IMP = 0xC9,
STA_IY = 0xCA,
STX_IN = 0xCC,
PHY_IMP = 0xCE,
BVS_REL = 0xD0,
LSR_AB = 0xD1,
LDA_AB = 0xD2,
STA_IN = 0xD4,
LSR_B = 0xD5,
LDA_ZY = 0xD6,
LDA_IX = 0xD8,
LDA_IY = 0xD9,
STB_IY = 0xDA,
JSR_IN = 0xDC,
P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_IMM = 0x4D,
LCS_E = 0x4E,
LDS_AB = 0x50,
AND_E = 0x51,
DIV_E = 0x52,
LEA_AX = 0x53,
LDS_E = 0x54,
BIT_AB = 0x55,
ADE_AB = 0x56,
LEA_ZX = 0x57,
LLM_AB = 0x58,
BIT_E = 0x59,
CPY_E = 0x5B,
LLM_E = 0x5C,
SCS_E = 0x5E,
SCO_IMM = 0x60,
PEA_AI = 0x63,
SCO_Z = 0x64,
SBE_IMM = 0x66,
PEA_IN = 0x67,
SBE_Z = 0x6A,
PHE_IMP = 0x6B,
LRM_Z = 0x6C,
LCC_IMM = 0x6D,
LCC_E = 0x6E,
SCO_AB = 0x70,
ORA_E = 0x71,
ASR_E = 0x72,
PEA_AX = 0x73,
SCO_E = 0x74,
SBE_AB = 0x76,
PEA_ZX = 0x77,
LRM_AB = 0x78,
PLE_IMP = 0x7B,
LRM_E = 0x7C,
SCC_E = 0x7E,
ECO_IMM = 0x80,
DEC_E = 0x82,
LEA_AIY = 0x83,
ECO_Z = 0x84,
ADS_IMM = 0x86,
LEA_IY = 0x87,
ADS_Z = 0x8A,
DEE_IMP = 0x8B,
RLM_Z = 0x8C,
LEQ_IMM = 0x8D,
LEQ_E = 0x8E,
ECO_AB = 0x90,
XOR_E = 0x91,
CMP_E = 0x92,
LEA_AIX = 0x93,
ECO_E = 0x94,
ADS_AB = 0x96,
LEA_IX = 0x97,
RLM_AB = 0x98,
ADS_E = 0x9A,
INE_IMP = 0x9B,
RLM_E = 0x9C,
SEQ_E = 0x9E,
INC_E = 0xA2,
PEA_AIY = 0xA3,
STS_Z = 0xA4,
SBS_IMM = 0xA6,
PEA_IY = 0xA7,
SBS_Z = 0xAA,
DES_IMP = 0xAB,
RRM_Z = 0xAC,
LNE_IMM = 0xAD,
LNE_E = 0xAE,
STS_AB = 0xB0,
LSL_E = 0xB1,
LDY_E = 0xB2,
PEA_AIX = 0xB3,
STS_E = 0xB4,
SBS_AB = 0xB6,
PEA_IX = 0xB7,
RRM_AB = 0xB8,
SBS_E = 0xBA,
INS_IMP = 0xBB,
RRM_E = 0xBC,
REP_REL = 0xBD,
SNE_E = 0xBE,
STY_E = 0xC2,
STE_Z = 0xC4,
NOT_A = 0xC6,
NOT_Z = 0xCA,
MMV_IMP = 0xCB,
ARM_Z = 0xCC,
REQ_REL = 0xCD,
STE_AB = 0xD0,
LSR_E = 0xD1,
LDA_E = 0xD2,
NOT_AB = 0xD6,
ARM_AB = 0xD8,
NOT_E = 0xDA,
ARM_E = 0xDC,
RNE_REL = 0xDD,
STA_E = 0xE2,
STZ_Z = 0xE4,
SWP_A = 0xE6,
SWP_Z = 0xEA,
PCN_Z = 0xEC,
STZ_AB = 0xF0,
ROL_E = 0xF1,
LDB_E = 0xF2,
STZ_E = 0xF4,
SWP_AB = 0xF6,
PCN_AB = 0xF8,
SWP_E = 0xFA,
PCN_E = 0xFC
};
#define ORTHO_1CC(mne, base, cc) \
mne##_R##cc = base, mne##_M##cc = base|0x10
#define ORTHO_1OP(mne, base) \
mne##_R = base, mne##_M = base|0x10
#define ORTHO_2OP(mne, base) \
mne##_RR = base, mne##_RM = base|0x08, mne##_MR = base|0x10, mne##_MM = base|0x18
enum ortho {
ORTHO_2OP(MNG, 0x00),
ORTHO_2OP(ADC, 0x01),
ORTHO_2OP(ROR, 0x02),
ORTHO_2OP(ADD, 0x03),
ORTHO_1OP(PSH, 0x04),
ORTHO_1CC(SET, 0x05, NG),
ORTHO_1OP(PEA, 0x0C),
ORTHO_2OP(MPO, 0x20),
ORTHO_2OP(SBC, 0x21),
ORTHO_2OP(MUL, 0x22),
ORTHO_2OP(SUB, 0x23),
ORTHO_1OP(PUL, 0x24),
ORTHO_1CC(SET, 0x25, PO),
ORTHO_1OP(SWP, 0x2C),
ORTHO_2OP(MCS, 0x40),
ORTHO_2OP(AND, 0x41),
ORTHO_2OP(DIV, 0x42),
ORTHO_2OP(PCN, 0x43),
ORTHO_1OP(NOT, 0x44),
ORTHO_1CC(SET, 0x45, CS),
ORTHO_2OP(MCC, 0x60),
ORTHO_2OP(OR , 0x61),
ORTHO_2OP(ASR, 0x62),
ORTHO_2OP(LEA, 0x63),
ORTHO_1OP(NEG, 0x64),
ORTHO_1CC(SET, 0x65, CC),
ORTHO_2OP(MEQ, 0x80),
ORTHO_2OP(XOR, 0x81),
ORTHO_2OP(CMP, 0x82),
ORTHO_1OP(DEC, 0x84),
ORTHO_1CC(SET, 0x85, EQ),
ORTHO_2OP(MNE, 0xA0),
ORTHO_2OP(LSL, 0xA1),
ORTHO_2OP(MOV, 0xA2),
ORTHO_1OP(INC, 0xA4),
ORTHO_1CC(SET, 0xA5, NE),
ORTHO_2OP(MVS, 0xC0),
ORTHO_2OP(LSR, 0xC1),
ORTHO_2OP(IML, 0xC2),
ORTHO_1OP(CLZ, 0xC4),
ORTHO_1CC(SET, 0xC5, VS),
ORTHO_2OP(MVC, 0xE0),
ORTHO_2OP(ROL, 0xE1),
ORTHO_2OP(IDV, 0xE2),
ORTHO_1OP(CLO, 0xE4),
ORTHO_1CC(SET, 0xE5, VC)
};
#undef ORTHO_1CC
#undef ORTHO_1OP
#undef ORTHO_2OP