#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define OPNAME(opcode) [opcode] = #opcode
#define CPS 0x00
#define ADC 0x01
#define AAB 0x02
#define ADC_AB 0x04
#define LDA_IN 0x05
#define ADC_Z 0x06
#define PHP 0x08
#define CPB 0x09
#define PHB 0x0A
#define DEC_AB 0x0C
#define DEC_Z 0x0D
#define JMP_Z 0x0E
#define JMP 0x10
#define SBC 0x11
#define SAB 0x12
#define SBC_AB 0x14
#define STA_IN 0x15
#define SBC_Z 0x16
#define ENT 0x18
#define CPY 0x19
#define PLB 0x1A
#define INC_AB 0x1C
#define INC_Z 0x1D
#define JSR 0x1E
#define JSL 0x20
#define AND 0x21
#define ABA 0x22
#define AND_AB 0x24
#define CMP_IN 0x25
#define AND_Z 0x26
#define PLP 0x28
#define CPX 0x29
#define PHY 0x2A
#define CPB_AB 0x2C
#define CPB_Z 0x2D
#define BPO_Z 0x2E
#define BPO 0x30
#define ORA 0x31
#define OAB 0x32
#define ORA_AB 0x34
#define LDB_IN 0x35
#define ORA_Z 0x36
#define STT 0x38
#define LDA_ZY 0x39
#define PLY 0x3A
#define CPX_AB 0x3C
#define CPY_Z 0x3D
#define BNG_Z 0x3E
#define BNG 0x40
#define XOR 0x41
#define XAB 0x42
#define XOR_AB 0x44
#define STB_IN 0x45
#define XOR_Z 0x46
#define PHA 0x48
#define STA_ZY 0x49
#define PHX 0x4A
#define CPY_AB 0x4C
#define CPX_Z 0x4D
#define BCS_Z 0x4E
#define BCS 0x50
#define LSL 0x51
#define LLB 0x52
#define LSL_AB 0x54
#define CPB_IN 0x55
#define LSL_Z 0x56
#define CLC 0x58
#define LDB_ZY 0x59
#define PLX 0x5A
#define LDA_IY 0x5C
#define LDA_IX 0x5D
#define BCC_Z 0x5E
#define BCC 0x60
#define LSR 0x61
#define LRB 0x62
#define LSR_AB 0x64
#define LDY_IN 0x65
#define LSR_Z 0x66
#define PLA 0x68
#define STB_ZY 0x69
#define TAB 0x6A
#define STA_IY 0x6C
#define STA_IX 0x6D
#define BEQ_Z 0x6E
#define BEQ 0x70
#define ROL 0x71
#define RLB 0x72
#define ROL_AB 0x74
#define STY_IN 0x75
#define ROL_Z 0x76
#define SEC 0x78
#define LDA_ZX 0x79
#define TBA 0x7A
#define CMP_IY 0x7C
#define CMP_IX 0x7D
#define BNE_Z 0x7E
#define BNE 0x80
#define ROR 0x81
#define RRB 0x82
#define ROR_AB 0x84
#define CPY_IN 0x85
#define ROR_Z 0x86
#define DEY 0x88
#define STA_ZX 0x89
#define TAY 0x8A
#define LDB_IY 0x8C
#define LDB_IX 0x8D
#define BVS_Z 0x8E
#define BVS 0x90
#define MUL 0x91
#define MAB 0x92
#define MUL_AB 0x94
#define LDX_IN 0x95
#define MUL_Z 0x96
#define CLI 0x98
#define LDB_ZX 0x99
#define TYA 0x9A
#define STB_IY 0x9C
#define STB_IX 0x9D
#define BVC_Z 0x9E
#define BVC 0xA0
#define DIV 0xA1
#define DAB 0xA2
#define DIV_AB 0xA4
#define STX_IN 0xA5
#define DIV_Z 0xA6
#define INY 0xA8
#define STB_ZX 0xA9
#define TAX 0xAA
#define CPB_IY 0xAC
#define CPB_IX 0xAD
#define RTS 0xAE
#define RTL 0xB0
#define CMP 0xB1
#define CAB 0xB2
#define CMP_AB 0xB4
#define CPX_IN 0xB5
#define CMP_Z 0xB6
#define SEI 0xB8
#define LDX 0xB9
#define TXA 0xBA
#define LDX_AB 0xBC
#define LDX_Z 0xBD
#define JSR_IN 0xBE
#define RTI 0xC0
#define LDA 0xC1
#define LDA_AB 0xC4
#define DEX 0xC5
#define LDA_Z 0xC6
#define CLV 0xC8
#define LDX_ZY 0xC9
#define TYX 0xCA
#define STA 0xCC
#define STA_Z 0xCD
#define JMP_IN 0xCE
#define TSX 0xD0
#define LDB 0xD1
#define LDB_AB 0xD4
#define INX 0xD5
#define LDB_Z 0xD6
#define WAI 0xD8
#define STX_ZY 0xD9
#define TXY 0xDA
#define STB 0xDC
#define STB_Z 0xDD
#define TXS 0xE0
#define LDY 0xE1
#define LDY_AB 0xE4
#define DEC 0xE5
#define LDY_Z 0xE6
#define BRK 0xE8
#define LDY_ZX 0xE9
#define NOP 0xEA
#define STY 0xEC
#define STY_Z 0xED
#define DEB 0xEE
#define ASR 0xF1
#define ARB 0xF2
#define ASR_AB 0xF4
#define INC 0xF5
#define ASR_Z 0xF6
#define STY_ZX 0xF9
#define STX 0xFC
#define STX_Z 0xFD
#define INB 0xFE
#define OPNUM 90
#define C ((uint64_t)1 << 0)
#define Z ((uint64_t)1 << 1)
#define I ((uint64_t)1 << 2)
#define S ((uint64_t)1 << 3)
#define V ((uint64_t)1 << 6)
#define N ((uint64_t)1 << 7)
struct sux;
uint8_t *addr;
uint8_t ibcount;
struct sux {
uint64_t ps;
uint64_t a[8], b[8], y[8], x[8];
uint64_t pc[8];
uint16_t sp[8];
uint16_t stk_st[8];
uint8_t crt;
uint8_t c[8], z[8], i[8], s[8], v[8], n[8];
};
typedef struct {
char mnemonic[4];
uint8_t imm;
uint8_t abs;
uint8_t zm;
uint8_t zmy;
uint8_t zmx;
uint8_t ind;
uint8_t inx;
uint8_t iny;
uint8_t impl;
} opent;
opent opcodes[OPNUM];
enum {IMPL, IMM, ZM, ZMX, ZMY, ABS, IND, INDX, INDY};
static const char *adrmode[9] = {
[0] = "IMPL",
[1] = "IMM",
[2] = "ZM",
[3] = "ZMX",
[4] = "ZMY",
[5] = "ABS",
[6] = "IND",
[7] = "INDX",
[8] = "INDY"
};
static const uint8_t optype[0x100] = {
[0x00] = IMPL,
[0x01] = IMM,
[0x02] = IMPL,
[0x04] = ABS,
[0x05] = IND,
[0x06] = ZM,
[0x08] = IMM,
[0x09] = IMM,
[0x0A] = IMM,
[0x0C] = ABS,
[0x0D] = ZM,
[0x0E] = ZM,
[0x10] = ABS,
[0x11] = IMM,
[0x12] = IMPL,
[0x14] = ABS,
[0x15] = IND,
[0x16] = ZM,
[0x18] = IMM,
[0x19] = IMM,
[0x1A] = IMM,
[0x1C] = ABS,
[0x1D] = ZM,
[0x1E] = ZM,
[0x20] = ABS,
[0x21] = IMM,
[0x22] = IMPL,
[0x24] = ABS,
[0x25] = IND,
[0x26] = ZM,
[0x28] = IMM,
[0x29] = IMM,
[0x2A] = IMM,
[0x2C] = ABS,
[0x2D] = ZM,
[0x2E] = ZM,
[0x30] = ABS,
[0x31] = IMM,
[0x32] = IMPL,
[0x34] = ABS,
[0x35] = IND,
[0x36] = ZM,
[0x38] = IMM,
[0x39] = ZMY,
[0x3A] = IMM,
[0x3C] = ABS,
[0x3D] = ZM,
[0x3E] = ZM,
[0x40] = ABS,
[0x41] = IMM,
[0x42] = IMPL,
[0x44] = ABS,
[0x45] = IND,
[0x46] = ZM,
[0x48] = IMM,
[0x49] = ZMY,
[0x4A] = IMM,
[0x4C] = ABS,
[0x4D] = ZM,
[0x4E] = ZM,
[0x50] = ABS,
[0x51] = IMM,
[0x52] = IMPL,
[0x54] = ABS,
[0x55] = IND,
[0x56] = ZM,
[0x58] = IMPL,
[0x59] = ZMY,
[0x5A] = IMM,
[0x5C] = INDY,
[0x5D] = INDX,
[0x5E] = ZM,
[0x60] = ABS,
[0x61] = IMM,
[0x62] = IMPL,
[0x64] = ABS,
[0x65] = IND,
[0x66] = ZM,
[0x68] = IMM,
[0x69] = ZMY,
[0x6A] = IMPL,
[0x6C] = INDY,
[0x6D] = INDX,
[0x6E] = ZM,
[0x70] = ABS,
[0x71] = IMM,
[0x72] = IMPL,
[0x74] = ABS,
[0x75] = IND,
[0x76] = ZM,
[0x78] = IMPL,
[0x79] = ZMX,
[0x7A] = IMPL,
[0x7C] = INDY,
[0x7D] = INDX,
[0x7E] = ZM,
[0x80] = ABS,
[0x81] = IMM,
[0x82] = IMPL,
[0x84] = ABS,
[0x85] = IND,
[0x86] = ZM,
[0x88] = IMPL,
[0x89] = ZMX,
[0x8A] = IMPL,
[0x8C] = INDY,
[0x8D] = INDX,
[0x8E] = ZM,
[0x90] = ABS,
[0x91] = IMM,
[0x92] = IMPL,
[0x94] = ABS,
[0x95] = IND,
[0x96] = ZM,
[0x98] = IMPL,
[0x99] = ZMX,
[0x9A] = IMPL,
[0x9C] = INDY,
[0x9D] = INDX,
[0x9E] = ZM,
[0xA0] = ABS,
[0xA1] = IMM,
[0xA2] = IMPL,
[0xA4] = ABS,
[0xA5] = IND,
[0xA6] = ZM,
[0xA8] = IMPL,
[0xA9] = ZMX,
[0xAA] = IMPL,
[0xAC] = INDY,
[0xAD] = INDX,
[0xAE] = IMPL,
[0xB0] = IMPL,
[0xB1] = IMM,
[0xB2] = IMPL,
[0xB4] = ABS,
[0xB5] = IND,
[0xB6] = ZM,
[0xB8] = IMPL,
[0xB9] = IMM,
[0xBA] = IMPL,
[0xBC] = ABS,
[0xBD] = ZM,
[0xBE] = IND,
[0xC0] = IMPL,
[0xC1] = IMM,
[0xC4] = ABS,
[0xC5] = IMPL,
[0xC6] = ZM,
[0xC8] = IMPL,
[0xC9] = ZMY,
[0xCA] = IMPL,
[0xCC] = ABS,
[0xCD] = ZM,
[0xCE] = IND,
[0xD0] = IMPL,
[0xD1] = IMM,
[0xD4] = ABS,
[0xD5] = IMPL,
[0xD6] = ZM,
[0xD8] = IMPL,
[0xD9] = ZMY,
[0xDA] = IMPL,
[0xDC] = ABS,
[0xDD] = ZM,
[0xE0] = IMM,
[0xE1] = IMM,
[0xE4] = ABS,
[0xE5] = IMPL,
[0xE6] = ZM,
[0xE8] = IMPL,
[0xE9] = ZMX,
[0xEA] = IMPL,
[0xEC] = ABS,
[0xED] = ZM,
[0xEE] = IMPL,
[0xF1] = IMM,
[0xF2] = IMPL,
[0xF4] = ABS,
[0xF5] = IMPL,
[0xF6] = ZM,
[0xF9] = ZMX,
[0xFC] = ABS,
[0xFD] = ZM,
[0xFE] = IMPL
};
static const char *mne[OPNUM] = {
[ 0] = "CPS",
[ 1] = "ADC",
[ 2] = "AAB",
[ 3] = "PHP",
[ 4] = "CPB",
[ 5] = "PHB",
[ 6] = "DEC",
[ 7] = "JMP",
[ 8] = "SBC",
[ 9] = "SAB",
[10] = "ENT",
[11] = "CPY",
[12] = "PLB",
[13] = "INC",
[14] = "JSR",
[15] = "JSL",
[16] = "AND",
[17] = "ABA",
[18] = "PLP",
[19] = "CPX",
[20] = "PHY",
[21] = "BPO",
[22] = "ORA",
[23] = "OAB",
[24] = "STT",
[25] = "PLY",
[26] = "BNG",
[27] = "XOR",
[28] = "XAB",
[29] = "PHA",
[30] = "PHX",
[31] = "BCS",
[32] = "LSL",
[33] = "LLB",
[34] = "CLC",
[35] = "PLX",
[36] = "BCC",
[37] = "LSR",
[38] = "LRB",
[39] = "PLA",
[40] = "TAB",
[41] = "BEQ",
[42] = "ROL",
[43] = "RLB",
[44] = "SEC",
[45] = "TBA",
[46] = "BNE",
[47] = "ROR",
[48] = "RRB",
[49] = "DEY",
[50] = "TAY",
[51] = "BVS",
[52] = "MUL",
[53] = "MAB",
[54] = "CLI",
[55] = "TYA",
[56] = "BVC",
[57] = "DIV",
[58] = "DAB",
[59] = "INY",
[60] = "TAX",
[61] = "RTS",
[62] = "RTL",
[63] = "CMP",
[64] = "CAB",
[65] = "SEI",
[66] = "LDX",
[67] = "TXA",
[68] = "RTI",
[69] = "LDA",
[70] = "DEX",
[71] = "CLV",
[72] = "TYX",
[73] = "STA",
[74] = "TSX",
[75] = "LDB",
[76] = "INX",
[77] = "WAI",
[78] = "TXY",
[79] = "STB",
[80] = "TXS",
[81] = "LDY",
[82] = "BRK",
[83] = "NOP",
[84] = "STY",
[85] = "DEB",
[86] = "ASR",
[87] = "ARB",
[88] = "STX",
[89] = "INB"
};
static const char *instdesc[OPNUM] = {
[ 0] = "Clears the Processor Status register.",
[ 1] = "ADd accumulator, with operand, Carry if needed.",
[ 2] = "Add Accumulator, with B, carry if needed.",
[ 3] = "PusH the number of bytes specified, from the Processor status register to the stack.",
[ 4] = "ComPare the B register, with operand.",
[ 5] = "PusH the number of bytes specified, from the B register to the stack.",
[ 6] = "DECrement accumulator, or memory.",
[ 7] = "JuMP to the address specified.",
[ 8] = "SuBtract accumulator, with operand, Carry if needed",
[ 9] = "Subtract Accumulator, with B, carry if needed.",
[10] = "ENd a Thread.",
[11] = "ComPare the Y register, with operand.",
[12] = "PuLl the number of bytes specified, from the stack, to the B register.",
[13] = "INCrement accumulator, or memory.",
[14] = "Jump to a SubRoutine.",
[15] = "Jump to a Subroutine, Long address.",
[16] = "Bitwise AND accumulator, with operand.",
[17] = "Bitwise AND Accumulator, with B.",
[18] = "PuLl the number of bytes specified, from the stack, to the Processor status register.",
[19] = "ComPare the X register, with operand.",
[20] = "PusH the number of bytes specified, from the Y register to the stack.",
[21] = "Branch if POsitive.",
[22] = "Bitwise OR Accumulator, with operand.",
[23] = "Bitwise OR Accumulator, with B.",
[24] = "STart a Thread.",
[25] = "PuLl the number of bytes specified, from the stack, to the Y register.",
[26] = "Branch if NeGative.",
[27] = "Bitwise XOR Accumulator, with operand.",
[28] = "Bitwise XOR Accumulator, with B.",
[29] = "PusH the number of bytes specified, from the Accumulator to the stack.",
[30] = "PusH the number of bytes specified, from the X register to the stack.",
[31] = "Branch if the Carry flag is Set.",
[32] = "Logical Shift Left accumulator, with operand.",
[33] = "Logical Shift Left accumulator, with B.",
[34] = "CLear the Carry flag.",
[35] = "PuLl the number of bytes specified, from the stack, to the X register.",
[36] = "Branch if the Carry flag has been Cleared.",
[37] = "Logical Shift Right accumulator, with operand.",
[38] = "Logical Shift Right accumulator, with B.",
[39] = "PuLl the number of bytes specified, from the stack, to the Accumulator.",
[40] = "Transfer the value from the Accumulator, to the B register.",
[41] = "Branch if EQual (the zero flag has been set).",
[42] = "ROtate Left accumulator, with operand.",
[43] = "Rotate Left accumulator, with B.",
[44] = "SEt the Carry flag.",
[45] = "Transfer the value from the Y register, to the Accumulator.",
[46] = "Branch if Not Equal (the zero flag has been cleared)",
[47] = "ROtate Right accumulator, with operand.",
[48] = "Rotate Right accumulator, with B.",
[49] = "DEcrement the Y register.",
[50] = "Transfer the value from the Accumulator, to the Y register.",
[51] = "Branch if the oVerflow flag is Set.",
[52] = "MULtiply accumulator, with operand.",
[53] = "Multiply Accumulator, with B.",
[54] = "CLear the Interrupt flag.",
[55] = "Transfer the value from the Y register, to the Accumulator.",
[56] = "Branch if the oVerflow flag has been Cleared.",
[57] = "DIVide accumulator, with operand, and put the remainder into the B register.",
[58] = "Divide Accumulator, with B, and put the remainder into the X register.",
[59] = "INcrement the Y register.",
[60] = "Transfer the value from the Accumulator, to the X register.",
[61] = "ReTurn from a Subroutine.",
[62] = "ReTurn from subroutine, Long address.",
[63] = "CoMPare acumulator, with operand.",
[64] = "Compare Accumulator, with B.",
[65] = "SEt the Interrupt flag.",
[66] = "LoaD the value from the operand, to the X register.",
[67] = "Transfer the value from the X register, to the Accumulator.",
[68] = "ReTurn from an Interrupt.",
[69] = "LoaD the value from the operand, to the Accumulator.",
[70] = "DEcrement the X register.",
[71] = "CLear the oVerflow flag.",
[72] = "Transfer the value from the Y register, to the X register.",
[73] = "STore the value from the Accumulator, in memory.",
[74] = "Transfer the value from the Stack pointer, to the X register.",
[75] = "LoaD the value from the operand, to the B register.",
[76] = "INcrement the X register.",
[77] = "WAIt for an interrupt",
[78] = "Transfer the value from the X register, to the Y register.",
[79] = "STore the value from the B register, in memory.",
[80] = "Transfer the value from the X register, to the Stack pointer.",
[81] = "LoaD the value from the operand, to the Y register.",
[82] = "BReaKpoint",
[83] = "NO oPeration",
[84] = "STore the value from the Y register, in memory.",
[85] = "DEcrement the B register.",
[86] = "Arithmetic Shift Right accumulator, with operand.",
[87] = "Arithmetic shift Right accumulator, with B.",
[88] = "STore the value from the X register, in memory.",
[89] = "INcrement the B register."
};
static const char *opname[0x100] = {
[0x00] = "CPS",
[0x01] = "ADC #",
[0x02] = "AAB",
[0x04] = "ADC a",
[0x05] = "LDA ind",
[0x06] = "ADC zm",
[0x08] = "PHP #",
[0x09] = "CPB #",
[0x0A] = "PHB #",
[0x0C] = "DEC a",
[0x0D] = "DEC zm",
[0x0E] = "JMP zm",
[0x10] = "JMP a",
[0x11] = "SBC #",
[0x12] = "SAB",
[0x14] = "SBC a",
[0x15] = "STA ind",
[0x16] = "SBC zm",
[0x18] = "ENT #",
[0x19] = "CPY #",
[0x1A] = "PLB #",
[0x1C] = "INC a",
[0x1D] = "INC zm",
[0x1E] = "JSR zm",
[0x20] = "JSL a",
[0x21] = "AND #",
[0x22] = "ABA",
[0x24] = "AND a",
[0x25] = "CMP ind",
[0x26] = "AND zm",
[0x28] = "PLP #",
[0x29] = "CPX #",
[0x2A] = "PHY #",
[0x2C] = "CPB a",
[0x2D] = "CPB zm",
[0x2E] = "BPO zm",
[0x30] = "BPO a",
[0x31] = "ORA #",
[0x32] = "OAB",
[0x34] = "ORA a",
[0x35] = "LDB ind",
[0x36] = "ORA zm",
[0x38] = "STT #",
[0x39] = "LDA zmy",
[0x3A] = "PLY #",
[0x3C] = "CPX a",
[0x3D] = "CPY zm",
[0x3E] = "BNG zm",
[0x40] = "BNG a",
[0x41] = "XOR #",
[0x42] = "XAB",
[0x44] = "XOR a",
[0x45] = "STB ind",
[0x46] = "XOR zm",
[0x48] = "PHA #",
[0x49] = "STA zmy",
[0x4A] = "PHX #",
[0x4C] = "CPY a",
[0x4D] = "CPX zm",
[0x4E] = "BCS zm",
[0x50] = "BCS a",
[0x51] = "LSL #",
[0x52] = "LLB",
[0x54] = "LSL a",
[0x55] = "CPB ind",
[0x56] = "LSL zm",
[0x58] = "CLC",
[0x59] = "LDB zmy",
[0x5A] = "PLX #",
[0x5C] = "LDA iny",
[0x5D] = "LDA inx",
[0x5E] = "BCC zm",
[0x60] = "BCC a",
[0x61] = "LSR #",
[0x62] = "LRB",
[0x64] = "LSR a",
[0x65] = "LDY ind",
[0x66] = "LSR zm",
[0x68] = "PLA #",
[0x69] = "STB zmy",
[0x6A] = "TAB",
[0x6C] = "STA iny",
[0x6D] = "STA inx",
[0x6E] = "BEQ zm",
[0x70] = "BEQ a",
[0x71] = "ROL #",
[0x72] = "RLB",
[0x74] = "ROL a",
[0x75] = "STY ind",
[0x76] = "ROL zm",
[0x78] = "SEC",
[0x79] = "LDA zmx",
[0x7A] = "TBA",
[0x7C] = "CMP iny",
[0x7D] = "CMP inx",
[0x7E] = "BNE zm",
[0x80] = "BNE a",
[0x81] = "ROR #",
[0x82] = "RRB",
[0x84] = "ROR a",
[0x85] = "CPY ind",
[0x86] = "ROR zm",
[0x88] = "DEY",
[0x89] = "STA zmx",
[0x8A] = "TAY",
[0x8C] = "LDB iny",
[0x8D] = "LDB inx",
[0x8E] = "BVS zm",
[0x90] = "BVS a",
[0x91] = "MUL #",
[0x92] = "MAB",
[0x94] = "MUL a",
[0x95] = "LDX ind",
[0x96] = "MUL zm",
[0x98] = "CLI",
[0x99] = "LDB zmx",
[0x9A] = "TYA",
[0x9C] = "STB iny",
[0x9D] = "STB inx",
[0x9E] = "BVC zm",
[0xA0] = "BVC a",
[0xA1] = "DIV #",
[0xA2] = "DAB",
[0xA4] = "DIV a",
[0xA5] = "STX ind",
[0xA6] = "DIV zm",
[0xA8] = "INY",
[0xA9] = "STB zmx",
[0xAA] = "TAX",
[0xAC] = "CPB iny",
[0xAD] = "CPB inx",
[0xAE] = "RTS",
[0xB0] = "RTL",
[0xB1] = "CMP #",
[0xB2] = "CAB",
[0xB4] = "CMP a",
[0xB5] = "CPX ind",
[0xB6] = "CMP zm",
[0xB8] = "SEI",
[0xB9] = "LDX #",
[0xBA] = "TXA",
[0xBC] = "LDX a",
[0xBD] = "LDX zm",
[0xBE] = "JSR ind",
[0xC0] = "RTI",
[0xC1] = "LDA #",
[0xC4] = "LDA a",
[0xC5] = "DEX",
[0xC6] = "LDA zm",
[0xC8] = "CLV",
[0xC9] = "LDX zmy",
[0xCA] = "TYX",
[0xCC] = "STA a",
[0xCD] = "STA zm",
[0xCE] = "JMP ind",
[0xD0] = "TSX",
[0xD1] = "LDB #",
[0xD4] = "LDB a",
[0xD5] = "INX",
[0xD6] = "LDB zm",
[0xD8] = "WAI",
[0xD9] = "STX zmy",
[0xDA] = "TXY",
[0xDC] = "STB a",
[0xDD] = "STB zm",
[0xE0] = "TXS #",
[0xE1] = "LDY #",
[0xE4] = "LDY a",
[0xE5] = "DEC A",
[0xE6] = "LDY zm",
[0xE8] = "BRK",
[0xE9] = "LDY zmx",
[0xEA] = "NOP",
[0xEC] = "STY a",
[0xED] = "STY zm",
[0xEE] = "DEB",
[0xF1] = "ASR #",
[0xF2] = "ARB",
[0xF4] = "ASR a",
[0xF5] = "INC A",
[0xF6] = "ASR zm",
[0xF9] = "STY zmx",
[0xFC] = "STX a",
[0xFD] = "STX zm",
[0xFE] = "INB"
};
extern int asmmon();
extern void adc(struct sux *cpu, uint64_t adr, uint8_t thread, uint8_t regsize);
extern void sbc(struct sux *cpu, uint64_t adr, uint8_t thread, uint8_t regsize);
extern void mul(struct sux *cpu, uint64_t adr, uint8_t thread, uint8_t regsize);
extern void divd(struct sux *cpu, uint64_t adr, uint8_t thread, uint8_t regsize);
extern uint64_t and(struct sux *cpu, uint64_t value, uint8_t thread);
extern void and_addr(struct sux *cpu, uint64_t* const reg, uint64_t adr, uint8_t thread, uint8_t regsize);
extern uint64_t or(struct sux *cpu, uint64_t value, uint8_t thread);
extern void or_addr(struct sux *cpu, uint64_t* const reg, uint64_t adr, uint8_t thread, uint8_t regsize);
extern uint64_t xor(struct sux *cpu, uint64_t value, uint8_t thread);
extern void xor_addr(struct sux *cpu, uint64_t* const reg, uint64_t adr, uint8_t thread, uint8_t regsize);
extern void rol(struct sux *cpu, uint64_t adr, uint8_t thread);
extern void ror(struct sux *cpu, uint64_t adr, uint8_t thread);
extern void lsl(struct sux *cpu, uint64_t adr, uint8_t thread);
extern void lsr(struct sux *cpu, uint64_t adr, uint8_t thread);
extern void inc(struct sux *cpu, uint64_t *reg, uint8_t thread);
extern void inc_addr(struct sux *cpu, uint64_t adr, uint8_t thread);
extern void dec(struct sux *cpu, uint64_t *reg, uint8_t thread);
extern void dec_addr(struct sux *cpu, uint64_t adr, uint8_t thread);
extern void stt(struct sux *cpu, uint8_t value);
extern void ent(struct sux *cpu, uint8_t value);
extern void ld(struct sux *cpu, uint64_t *reg, uint64_t adr, uint8_t thread, uint8_t regsize);
extern void st(struct sux *cpu, uint64_t *reg, uint64_t adr, uint8_t thread, uint8_t regsize);
extern void push(struct sux *cpu, uint8_t value);
extern uint8_t pull(struct sux *cpu);
extern void cmp_addr(struct sux *cpu, uint64_t reg, uint64_t adr, uint8_t thread, uint8_t regsize);
extern void cmp(struct sux *cpu, uint64_t reg1, uint64_t reg2, uint8_t thread);
extern void bfs(struct sux *cpu, uint8_t flag, uint64_t adr, uint8_t thread);
extern void bfc(struct sux *cpu, uint8_t flag, uint64_t adr, uint8_t thread);
extern void setps(struct sux *cpu, uint8_t thread);
extern uint64_t immaddr(struct sux *cpu, uint8_t thread, uint8_t size);
extern uint64_t absaddr(struct sux *cpu, uint8_t thread);
extern uint32_t zeromtx(struct sux *cpu, uint8_t thread);
extern uint32_t zeromx(struct sux *cpu, uint8_t thread);
extern uint32_t zeromy(struct sux *cpu, uint8_t thread);