mirror of
https://github.com/rkujawa/rk65c02.git
synced 2024-12-13 01:29:57 +00:00
Move reg_state struct to header, rename op to opcode.
This commit is contained in:
parent
0da3d6dc5f
commit
d515954f44
@ -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) {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user