diff --git a/src/ca65/main.c b/src/ca65/main.c index fb0907df3..e9b36ee5d 100644 --- a/src/ca65/main.c +++ b/src/ca65/main.c @@ -213,28 +213,20 @@ static void DefineCpuSymbols (void) /* Additional ones from cpu.mac. Not sure how useful they are after the ** changes from #2751. */ - NewSymbol ("CPU_NONE", CPU_ISET_NONE); - NewSymbol ("CPU_6502", CPU_ISET_6502); - NewSymbol ("CPU_6502X", CPU_ISET_6502X | CPU_ISET_6502); - NewSymbol ("CPU_6502DTV", CPU_ISET_6502DTV | CPU_ISET_6502); - NewSymbol ("CPU_65SC02", CPU_ISET_65SC02 | CPU_ISET_6502); - NewSymbol ("CPU_65C02", CPU_ISET_65C02 | CPU_ISET_6502 | CPU_ISET_65SC02); - NewSymbol ("CPU_W65C02", CPU_ISET_W65C02 | CPU_ISET_6502 | CPU_ISET_65SC02 | - CPU_ISET_65C02); - - /* FIXME: CPU_ISET_65SC02 does not apply to the following, because the - ** zp-indirect addressing was replaced with zp-indirect,z-indexed in - ** 652SCE02 - */ - NewSymbol ("CPU_HUC6280", CPU_ISET_HUC6280 | CPU_ISET_6502 | CPU_ISET_65C02); - NewSymbol ("CPU_4510", CPU_ISET_4510 | CPU_ISET_6502 | CPU_ISET_65C02 | - CPU_ISET_65CE02); - NewSymbol ("CPU_45GS02", CPU_ISET_45GS02 | CPU_ISET_6502 | CPU_ISET_65C02 | - CPU_ISET_65CE02 | CPU_ISET_4510); - NewSymbol ("CPU_M740", CPU_ISET_M740 | CPU_ISET_6502); - NewSymbol ("CPU_65CE02", CPU_ISET_65CE02 | CPU_ISET_6502 | CPU_ISET_65C02); - NewSymbol ("CPU_65816", CPU_ISET_65816 | CPU_ISET_6502 | CPU_ISET_65SC02); - NewSymbol ("CPU_SWEET16", CPU_ISET_SWEET16); + NewSymbol ("CPU_NONE", CPUIsets[CPU_NONE]); + NewSymbol ("CPU_6502", CPUIsets[CPU_6502]); + NewSymbol ("CPU_6502X", CPUIsets[CPU_6502X]); + NewSymbol ("CPU_6502DTV", CPUIsets[CPU_6502DTV]); + NewSymbol ("CPU_65SC02", CPUIsets[CPU_65SC02]); + NewSymbol ("CPU_65C02", CPUIsets[CPU_65C02]); + NewSymbol ("CPU_65816", CPUIsets[CPU_65816]); + NewSymbol ("CPU_SWEET16", CPUIsets[CPU_SWEET16]); + NewSymbol ("CPU_HUC6280", CPUIsets[CPU_HUC6280]); + NewSymbol ("CPU_M740", CPUIsets[CPU_M740]); + NewSymbol ("CPU_4510", CPUIsets[CPU_4510]); + NewSymbol ("CPU_45GS02", CPUIsets[CPU_45GS02]); + NewSymbol ("CPU_W65C02", CPUIsets[CPU_W65C02]); + NewSymbol ("CPU_65CE02", CPUIsets[CPU_65CE02]); } diff --git a/src/common/cpu.c b/src/common/cpu.c index 7988cb4c1..8e9ff827a 100644 --- a/src/common/cpu.c +++ b/src/common/cpu.c @@ -74,21 +74,33 @@ const char* CPUNames[CPU_COUNT] = { * NOTE: make sure to only combine the instruction sets that are 100% compatible */ const unsigned CPUIsets[CPU_COUNT] = { + /* CPU_NONE */ CPU_ISET_NONE, + /* CPU_6502 */ CPU_ISET_6502, + /* CPU_6502X */ CPU_ISET_6502X | CPU_ISET_6502, + /* CPU_6502DTV */ CPU_ISET_6502DTV | CPU_ISET_6502, + /* CPU_65SC02 */ CPU_ISET_65SC02 | CPU_ISET_6502, + /* CPU_65C02 */ CPU_ISET_65C02 | CPU_ISET_6502 | CPU_ISET_65SC02, - /* 65816 has wai/stp and NO bit manipulation */ + /* CPU_65816. 65816 has wai/stp and NO bit manipulation. */ CPU_ISET_65816 | CPU_ISET_6502 | CPU_ISET_65SC02, + /* CPU_SWEET16 */ CPU_ISET_SWEET16, + /* CPU_HUC6280 */ CPU_ISET_HUC6280 | CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02, + /* CPU_M740 */ CPU_ISET_M740 | CPU_ISET_6502, - /* 4510 does NOT have indirect-zp (without z), so we can not use 65SC02 */ + /* CPU_4510. 4510 does NOT have indirect-zp (without z), so we can not use 65SC02 */ CPU_ISET_4510 | CPU_ISET_6502 | CPU_ISET_65C02 | CPU_ISET_65CE02, + /* CPU_45GS02 */ CPU_ISET_45GS02 | CPU_ISET_6502 | CPU_ISET_65C02 | CPU_ISET_65CE02 | CPU_ISET_4510, + /* CPU_W65C02 */ CPU_ISET_W65C02 | CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02, + /* CPU_65CE02 */ CPU_ISET_65CE02 | CPU_ISET_6502 | CPU_ISET_65C02, }; diff --git a/src/common/cpu.h b/src/common/cpu.h index 0a7c853ac..bc6260371 100644 --- a/src/common/cpu.h +++ b/src/common/cpu.h @@ -69,7 +69,7 @@ typedef enum { CPU_COUNT /* Number of different CPUs */ } cpu_t; -/* CPU instruction sets (make sure this matches asminc/cpu.mac) */ +/* CPU instruction sets */ enum { CPU_ISET_NONE = 1 << CPU_NONE, CPU_ISET_6502 = 1 << CPU_6502,