nesemu/cpu/op.h

38 lines
1.1 KiB
C
Raw Normal View History

2023-12-23 16:35:23 -05:00
#include "../include/cpu.h"
2023-09-24 22:02:08 -04:00
#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
2023-10-05 17:05:06 -04:00
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
2023-09-22 14:39:25 -04:00
};
2023-09-24 22:02:08 -04:00
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
2023-11-26 12:11:49 -05:00
ADDR_MODE_INDIRECT_X, // (d,x)
2023-09-24 22:02:08 -04:00
ADDR_MODE_INDIRECT_JUMP, //
2023-11-26 12:11:49 -05:00
ADDR_MODE_INDIRECT_Y, // (d),y
2023-09-24 22:02:08 -04:00
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
2023-11-26 12:11:49 -05:00
} AddressingMode;
2023-09-24 22:02:08 -04:00
2023-12-23 16:35:23 -05:00
void process_op_code(byte op);
#endif