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-09-22 14:39:25 -04:00
|
|
|
enum op_code {
|
2023-09-24 22:02:08 -04:00
|
|
|
OP_CODE_ORA = 0x00,
|
|
|
|
OP_CODE_AND = 0x20,
|
|
|
|
OP_CODE_EOR = 0x40,
|
|
|
|
OP_CODE_ADC = 0x60,
|
|
|
|
OP_CODE_STA = 0x80,
|
|
|
|
OP_CODE_LDA = 0xa0,
|
|
|
|
OP_CODE_CMP = 0xc0,
|
|
|
|
OP_CODE_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
|
|
|
|
ADDR_MODE_INDEXED_INDIRECT, // (d,x)
|
|
|
|
ADDR_MODE_INDIRECT_JUMP, //
|
|
|
|
ADDR_MODE_INDIRECT_INDEXED, // (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
|
|
|
|
} addr_mode_t;
|
|
|
|
|
|
|
|
#endif
|