diff --git a/src/rk65c02.c b/src/rk65c02.c index 973c4d8..582eccc 100644 --- a/src/rk65c02.c +++ b/src/rk65c02.c @@ -11,18 +11,6 @@ static bool run = false; -struct reg_state { - uint8_t A; /* accumulator */ - uint8_t X; /* index X */ - uint8_t Y; /* index Y */ - - uint16_t PC; /* program counter */ - uint8_t SP; /* stack pointer */ - uint8_t P; /* status */ -}; - -typedef struct reg_state reg_state_t; - instruction_t instruction_fetch(bus_t *b, uint16_t addr) { @@ -31,7 +19,7 @@ instruction_fetch(bus_t *b, uint16_t addr) i.opcode = bus_read_1(b, addr); i.def = instrs[i.opcode]; - assert(i.def.op != OP_UNIMPL); + assert(i.def.opcode != OP_UNIMPL); /* handle operands */ switch (i.def.mode) { diff --git a/src/rk65c02.h b/src/rk65c02.h index 6c4f125..d2ac28b 100644 --- a/src/rk65c02.h +++ b/src/rk65c02.h @@ -18,8 +18,20 @@ typedef enum { IABSOLUTEX } addressing_t; +struct reg_state { + uint8_t A; /* accumulator */ + uint8_t X; /* index X */ + uint8_t Y; /* index Y */ + + uint16_t PC; /* program counter */ + uint8_t SP; /* stack pointer */ + uint8_t P; /* status */ +}; + +typedef struct reg_state reg_state_t; + struct instrdef { - uint8_t op; + uint8_t opcode; const char *mnemonic; addressing_t mode; uint8_t size; @@ -36,7 +48,6 @@ struct instruction { typedef struct instruction instruction_t; - #define OP_BRK 0x00 #define OP_TSB_ZP 0x04 #define OP_JSR 0x20