1
0
mirror of https://github.com/cc65/cc65.git synced 2026-01-22 17:16:21 +00:00

Use CPUIsets from cpu.c instead of recreating the CPU_xxx constants.

This commit is contained in:
Kugel Fuhr
2025-07-01 13:02:15 +02:00
parent 37414199c7
commit 60ec9045fc
3 changed files with 29 additions and 25 deletions

View File

@@ -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]);
}

View File

@@ -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,
};

View File

@@ -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,