summaryrefslogtreecommitdiff
path: root/opcode.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2019-11-17 23:04:31 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2019-11-17 23:04:31 -0500
commitc42888e7e09b0a45c6b02534829eac06506834a6 (patch)
treefd720f5aca4e603efd4e549d798ab318e38c17fd /opcode.h
parentf070b984f4d1af513d215bd24e6b1951e3ee86cb (diff)
The emulator is working!!!
Diffstat (limited to 'opcode.h')
-rw-r--r--opcode.h92
1 files changed, 91 insertions, 1 deletions
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),
+};