diff --git a/src/Makefile b/src/Makefile index 24a0b53..663a286 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,9 +1,11 @@ -OBJS=rk65c02.o bus.o instruction.o 65c02isa.o +OBJS=rk65c02.o bus.o instruction.o LIB_SO=librk65c02.so LIB_STATIC=librk65c02.a LDFLAGS=-shared CFLAGS=-Wall -fpic +65C02ISA=65c02isa + all : $(LIB_SO) $(LIB_STATIC) $(LIB_SO) : $(OBJS) @@ -12,10 +14,15 @@ $(LIB_SO) : $(OBJS) $(LIB_STATIC) : $(OBJS) $(AR) rcs $(LIB_STATIC) $(OBJS) -%.o : %.c %.h +$(65C02ISA).h : $(65C02ISA).csv $(65C02ISA).awk + awk -f $(65C02ISA).awk $(65C02ISA).csv > $(65C02ISA).h + +# XXX: dependency on 65c02isa.h is only for instruction.c +%.o : %.c %.h $(65C02ISA).h $(CC) $(CFLAGS) -c $< clean : + rm -f $(65C02ISA).h rm -f $(OBJS) rm -f $(LIB_SO) $(LIB_STATIC) diff --git a/src/instruction.c b/src/instruction.c index 0c54676..643fac9 100644 --- a/src/instruction.c +++ b/src/instruction.c @@ -114,3 +114,13 @@ disassemble(bus_t *b, uint16_t addr) printf("\n"); } +instrdef_t +instrdef_get(uint8_t opcode) +{ + instrdef_t id; + + id = instrs[opcode]; + + return id; +} + diff --git a/src/instruction.h b/src/instruction.h index fabbced..e227d84 100644 --- a/src/instruction.h +++ b/src/instruction.h @@ -39,5 +39,6 @@ typedef struct instruction instruction_t; instruction_t instruction_fetch(bus_t *, uint16_t); void instruction_print(instruction_t *); void disassemble(bus_t *, uint16_t); +instrdef_t instrdef_get(uint8_t); #endif /* _INSTRUCTION_H_ */