nesemu/cpu/op.h

39 lines
1.2 KiB
C

#include "../include/cpu.h"
#ifndef CPU_OP_H
#define CPU_OP_H
// The number associated with each op code is the matching line of the ALU op code.
// Based on the table here: https://www.nesdev.org/wiki/CPU_unofficial_opcodes
enum op_code_base {
OP_CODE_BASE_ORA = 0x00,
OP_CODE_BASE_AND = 0x20,
OP_CODE_BASE_EOR = 0x40,
OP_CODE_BASE_ADC = 0x60,
OP_CODE_BASE_STA = 0x80,
OP_CODE_BASE_LDA = 0xa0,
OP_CODE_BASE_CMP = 0xc0,
OP_CODE_BASE_SBC = 0xe0
};
typedef enum {
ADDR_MODE_ABSOLUTE, // a
ADDR_MODE_ABSOLUTE_JUMP, // (a)
ADDR_MODE_ABSOLUTE_INDEXED_X, // a,x
ADDR_MODE_ABSOLUTE_INDEXED_Y, // a,y
ADDR_MODE_ACCUMULATOR, // A
ADDR_MODE_IMMEDIATE, // #i
ADDR_MODE_IMPLICIT, // Imp
ADDR_MODE_INDIRECT_X, // (d,x)
ADDR_MODE_INDIRECT_JUMP, //
ADDR_MODE_INDIRECT_Y, // (d),y
ADDR_MODE_RELATIVE, // label
ADDR_MODE_ZERO_PAGE, // d
ADDR_MODE_ZERO_PAGE_INDEXED_X, // d,x
ADDR_MODE_ZERO_PAGE_INDEXED_Y, // d,y
} AddressingMode;
void process_op_code(System *system, byte op);
char* get_op_code_name(byte op);
#endif