From c42888e7e09b0a45c6b02534829eac06506834a6 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sun, 17 Nov 2019 23:04:31 -0500 Subject: The emulator is working!!! --- opcode.h | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) (limited to 'opcode.h') diff --git a/opcode.h b/opcode.h index 1c17052..757850e 100644 --- a/opcode.h +++ b/opcode.h @@ -1,4 +1,4 @@ -#define OPNAME(opcode) #opcode /* Get name of Opcode, for dissambly. */ +#define OPNAME(opcode) [opcode] = #opcode /* Get name of Opcode, for dissambly. */ #define CPS 0x00 /* Clear Processor Status. */ #define ADC 0x01 /* ADd with Carry. */ #define PHP 0x08 /* PusH Processor status to stack. */ @@ -84,3 +84,93 @@ #define STX 0xF4 /* STore X register. */ #define SAX 0xF5 /* Store Accumulator, and X register. */ #define BRK 0xF8 /* BReaK. */ +#define STP 0xFF /* SToP. */ + +static const char *opname[0x100] = { + OPNAME(CPS), + OPNAME(ADC), + OPNAME(PHP), + OPNAME(PHA), + OPNAME(PHY), + OPNAME(PAY), + OPNAME(PHX), + OPNAME(PAX), + OPNAME(JMP), + OPNAME(SBC), + OPNAME(PLP), + OPNAME(PLA), + OPNAME(PLY), + OPNAME(PYA), + OPNAME(PLX), + OPNAME(PXA), + OPNAME(JSR), + OPNAME(AND), + OPNAME(ANY), + OPNAME(AAY), + OPNAME(ANX), + OPNAME(AAX), + OPNAME(STT), + OPNAME(BPO), + OPNAME(ORA), + OPNAME(ORY), + OPNAME(OAY), + OPNAME(ORX), + OPNAME(OAX), + OPNAME(SEI), + OPNAME(BNG), + OPNAME(XOR), + OPNAME(XRY), + OPNAME(XAY), + OPNAME(XRX), + OPNAME(XAX), + OPNAME(CLI), + OPNAME(BCS), + OPNAME(SLA), + OPNAME(SEC), + OPNAME(BCC), + OPNAME(SRA), + OPNAME(CLC), + OPNAME(BEQ), + OPNAME(ROL), + OPNAME(SSP), + OPNAME(BNE), + OPNAME(ROR), + OPNAME(CSP), + OPNAME(BVS), + OPNAME(MUL), + OPNAME(SEV), + OPNAME(BVC), + OPNAME(DIV), + OPNAME(CLV), + OPNAME(RTS), + OPNAME(CMP), + OPNAME(CPY), + OPNAME(CAY), + OPNAME(CPX), + OPNAME(CAX), + OPNAME(ENT), + OPNAME(RTI), + OPNAME(INC), + OPNAME(INY), + OPNAME(IAY), + OPNAME(INX), + OPNAME(IAX), + OPNAME(DEC), + OPNAME(DEY), + OPNAME(DAY), + OPNAME(DEX), + OPNAME(DAX), + OPNAME(LDA), + OPNAME(LDY), + OPNAME(LAY), + OPNAME(LDX), + OPNAME(LAX), + OPNAME(NOP), + OPNAME(STA), + OPNAME(STY), + OPNAME(SAY), + OPNAME(STX), + OPNAME(SAX), + OPNAME(BRK), + OPNAME(STP), +}; -- cgit v1.2.3-13-gbd6f