made warning about "pointer at $ff" depend on cpu flag

git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@205 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
marcobaye 2020-05-31 13:07:40 +00:00
parent 64a29e4504
commit c03d1145f6
6 changed files with 17 additions and 15 deletions

View File

@ -17,36 +17,37 @@
// constants
static struct cpu_type cpu_type_6502 = {
keyword_is_6502_mnemo,
CPUFLAG_INDIRECTJMPBUGGY, // JMP ($xxFF) is buggy
CPUFLAG_WARN_ABOUT_FF_PTR | CPUFLAG_INDIRECTJMPBUGGY, // warn about "XYZ ($ff),y" and "jmp ($XYff)"
234 // !align fills with "NOP"
};
static struct cpu_type cpu_type_nmos6502 = {
keyword_is_nmos6502_mnemo,
CPUFLAG_INDIRECTJMPBUGGY | CPUFLAG_8B_AND_AB_NEED_0_ARG, // JMP ($xxFF) is buggy, ANE/LXA #$xx are unstable unless arg is $00
CPUFLAG_WARN_ABOUT_FF_PTR | CPUFLAG_INDIRECTJMPBUGGY | CPUFLAG_8B_AND_AB_NEED_0_ARG, // ANE/LXA #$xx are unstable unless arg is $00
234 // !align fills with "NOP"
};
static struct cpu_type cpu_type_c64dtv2 = {
keyword_is_c64dtv2_mnemo,
CPUFLAG_INDIRECTJMPBUGGY | CPUFLAG_8B_AND_AB_NEED_0_ARG, // JMP ($xxFF) is buggy, ANE/LXA #$xx are unstable unless arg is $00
CPUFLAG_WARN_ABOUT_FF_PTR | CPUFLAG_INDIRECTJMPBUGGY | CPUFLAG_8B_AND_AB_NEED_0_ARG,
234 // !align fills with "NOP"
};
static struct cpu_type cpu_type_65c02 = {
keyword_is_65c02_mnemo,
0, // no flags
CPUFLAG_WARN_ABOUT_FF_PTR, // TODO - remove this? check datasheets/realhw!
234 // !align fills with "NOP"
};
static struct cpu_type cpu_type_r65c02 = {
keyword_is_r65c02_mnemo,
0, // no flags
CPUFLAG_WARN_ABOUT_FF_PTR, // TODO - remove this? check datasheets/realhw!
234 // !align fills with "NOP"
};
static struct cpu_type cpu_type_w65c02 = {
keyword_is_w65c02_mnemo,
0, // no flags
CPUFLAG_WARN_ABOUT_FF_PTR, // TODO - remove this? check datasheets/realhw!
234 // !align fills with "NOP"
};
static struct cpu_type cpu_type_65816 = {
keyword_is_65816_mnemo,
// TODO - what about CPUFLAG_WARN_ABOUT_FF_PTR? does this depend on native/emulation mode?
CPUFLAG_SUPPORTSLONGREGS, // allows A and XY to be 16bits wide
234 // !align fills with "NOP"
};

View File

@ -23,7 +23,7 @@ struct cpu_type {
#define CPUFLAG_8B_AND_AB_NEED_0_ARG (1u << 2) // warn if "ane/lxa #$xx" uses non-zero arg
#define CPUFLAG_ISBIGENDIAN (1u << 3) // for 16/24/32-bit values, output msb first
#define CPUFLAG_DECIMALSUBTRACTBUGGY (1u << 4) // warn if "sed" is assembled
#define CPUFLAG_WARN_ABOUT_FF_PTR (1u << 5) // warn if MNEMO($ff) is assembled
// if cpu type and value match, set register length variable to value.
// if cpu type and value don't match, complain instead.

View File

@ -899,8 +899,9 @@ static unsigned int imm_ops(int *force_bit, unsigned char opcode, int immediate_
// helper function to warn if zp pointer wraps around
static void check_zp_wraparound(struct number *result)
{
if ((result->val.intval == 0xff)
&& (result->flags & NUMBER_IS_DEFINED))
if ((result->flags & NUMBER_IS_DEFINED)
&& (result->val.intval == 0xff)
&& (CPU_state.type->flags & CPUFLAG_WARN_ABOUT_FF_PTR))
Throw_warning("Zeropage pointer wraps around from $ff to $00");
}