diff --git a/src/common/cpu.c b/src/common/cpu.c index 2c29eb1c4..54bb8a3fb 100644 --- a/src/common/cpu.c +++ b/src/common/cpu.c @@ -66,20 +66,26 @@ const char* CPUNames[CPU_COUNT] = { "45GS02" }; -/* Tables with CPU instruction sets */ +/* Tables with CPU instruction sets + * NOTE: make sure to only combine the instruction sets that are 100% compatible + */ const unsigned CPUIsets[CPU_COUNT] = { CPU_ISET_NONE, CPU_ISET_6502, - CPU_ISET_6502 | CPU_ISET_6502X, - CPU_ISET_6502 | CPU_ISET_6502DTV, - CPU_ISET_6502 | CPU_ISET_65SC02, - CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02, - CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02 | CPU_ISET_65816, + CPU_ISET_6502X | CPU_ISET_6502, + CPU_ISET_6502DTV | CPU_ISET_6502, + CPU_ISET_65SC02 | CPU_ISET_6502, + CPU_ISET_65C02 | CPU_ISET_6502 | CPU_ISET_65SC02, + /* FIXME: does 65816 have both wai/stp and indirect-zp (without z)? */ + CPU_ISET_65816 | CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02, CPU_ISET_SWEET16, - CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02 | CPU_ISET_HUC6280, - CPU_ISET_6502 | CPU_ISET_M740, - CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02 | CPU_ISET_4510, - CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02 | CPU_ISET_4510 | CPU_ISET_45GS02, + /* FIXME: HUC6280 does not have wai/stp */ + CPU_ISET_HUC6280 | CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02, + CPU_ISET_M740 | CPU_ISET_6502, + /* 4510 does NOT have indirect-zp (without z), so we can not use 65SC02 */ + /* FIXME: 4510 does not have wai/stp */ + CPU_ISET_4510 | CPU_ISET_6502 | CPU_ISET_65C02, + CPU_ISET_45GS02 | CPU_ISET_6502 | CPU_ISET_65C02 | CPU_ISET_4510, }; diff --git a/src/common/cpu.h b/src/common/cpu.h index 6d8b72469..81795e146 100644 --- a/src/common/cpu.h +++ b/src/common/cpu.h @@ -47,7 +47,7 @@ /* CPUs */ typedef enum { CPU_UNKNOWN = -1, /* Not specified or invalid target */ - CPU_NONE, /* No CPU - for assembler */ + CPU_NONE = 0, /* No CPU - for assembler */ CPU_6502, CPU_6502X, /* "Extended", that is: with illegal opcodes */ CPU_6502DTV, /* CPU_6502 + DTV extra and illegal opcodes */ @@ -62,7 +62,7 @@ typedef enum { CPU_COUNT /* Number of different CPUs */ } cpu_t; -/* CPU instruction sets */ +/* CPU instruction sets (make sure this matches asminc/cpu.mac) */ enum { CPU_ISET_NONE = 1 << CPU_NONE, CPU_ISET_6502 = 1 << CPU_6502,