fix instruction set bits set by the compiler. in particular do not set the 65SC02 bit for 4510/45GS02, else we get clashes with sta(zp)

This commit is contained in:
mrdudz
2025-06-24 21:39:39 +02:00
parent d374ea2cde
commit d6cc893940
2 changed files with 18 additions and 12 deletions

View File

@@ -66,20 +66,26 @@ const char* CPUNames[CPU_COUNT] = {
"45GS02" "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] = { const unsigned CPUIsets[CPU_COUNT] = {
CPU_ISET_NONE, CPU_ISET_NONE,
CPU_ISET_6502, CPU_ISET_6502,
CPU_ISET_6502 | CPU_ISET_6502X, CPU_ISET_6502X | CPU_ISET_6502,
CPU_ISET_6502 | CPU_ISET_6502DTV, CPU_ISET_6502DTV | CPU_ISET_6502,
CPU_ISET_6502 | CPU_ISET_65SC02, CPU_ISET_65SC02 | CPU_ISET_6502,
CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02, CPU_ISET_65C02 | CPU_ISET_6502 | CPU_ISET_65SC02,
CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02 | CPU_ISET_65816, /* 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_SWEET16,
CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02 | CPU_ISET_HUC6280, /* FIXME: HUC6280 does not have wai/stp */
CPU_ISET_6502 | CPU_ISET_M740, CPU_ISET_HUC6280 | CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02,
CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02 | CPU_ISET_4510, CPU_ISET_M740 | CPU_ISET_6502,
CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02 | CPU_ISET_4510 | CPU_ISET_45GS02, /* 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,
}; };

View File

@@ -47,7 +47,7 @@
/* CPUs */ /* CPUs */
typedef enum { typedef enum {
CPU_UNKNOWN = -1, /* Not specified or invalid target */ CPU_UNKNOWN = -1, /* Not specified or invalid target */
CPU_NONE, /* No CPU - for assembler */ CPU_NONE = 0, /* No CPU - for assembler */
CPU_6502, CPU_6502,
CPU_6502X, /* "Extended", that is: with illegal opcodes */ CPU_6502X, /* "Extended", that is: with illegal opcodes */
CPU_6502DTV, /* CPU_6502 + DTV extra and illegal opcodes */ CPU_6502DTV, /* CPU_6502 + DTV extra and illegal opcodes */
@@ -62,7 +62,7 @@ typedef enum {
CPU_COUNT /* Number of different CPUs */ CPU_COUNT /* Number of different CPUs */
} cpu_t; } cpu_t;
/* CPU instruction sets */ /* CPU instruction sets (make sure this matches asminc/cpu.mac) */
enum { enum {
CPU_ISET_NONE = 1 << CPU_NONE, CPU_ISET_NONE = 1 << CPU_NONE,
CPU_ISET_6502 = 1 << CPU_6502, CPU_ISET_6502 = 1 << CPU_6502,