mirror of
https://github.com/uffejakobsen/acme.git
synced 2025-08-07 14:25:07 +00:00
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:
@@ -373,7 +373,7 @@ Unknown processor.
|
|||||||
Unknown pseudo opcode.
|
Unknown pseudo opcode.
|
||||||
You have mistyped a "!" command.
|
You have mistyped a "!" command.
|
||||||
|
|
||||||
Unknown "* =" segment modifier.
|
Unknown "*=" segment modifier.
|
||||||
You used a modifier keyword ACME does not know.
|
You used a modifier keyword ACME does not know.
|
||||||
|
|
||||||
Unterminated index spec.
|
Unterminated index spec.
|
||||||
|
13
src/cpu.c
13
src/cpu.c
@@ -17,36 +17,37 @@
|
|||||||
// constants
|
// constants
|
||||||
static struct cpu_type cpu_type_6502 = {
|
static struct cpu_type cpu_type_6502 = {
|
||||||
keyword_is_6502_mnemo,
|
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"
|
234 // !align fills with "NOP"
|
||||||
};
|
};
|
||||||
static struct cpu_type cpu_type_nmos6502 = {
|
static struct cpu_type cpu_type_nmos6502 = {
|
||||||
keyword_is_nmos6502_mnemo,
|
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"
|
234 // !align fills with "NOP"
|
||||||
};
|
};
|
||||||
static struct cpu_type cpu_type_c64dtv2 = {
|
static struct cpu_type cpu_type_c64dtv2 = {
|
||||||
keyword_is_c64dtv2_mnemo,
|
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"
|
234 // !align fills with "NOP"
|
||||||
};
|
};
|
||||||
static struct cpu_type cpu_type_65c02 = {
|
static struct cpu_type cpu_type_65c02 = {
|
||||||
keyword_is_65c02_mnemo,
|
keyword_is_65c02_mnemo,
|
||||||
0, // no flags
|
CPUFLAG_WARN_ABOUT_FF_PTR, // TODO - remove this? check datasheets/realhw!
|
||||||
234 // !align fills with "NOP"
|
234 // !align fills with "NOP"
|
||||||
};
|
};
|
||||||
static struct cpu_type cpu_type_r65c02 = {
|
static struct cpu_type cpu_type_r65c02 = {
|
||||||
keyword_is_r65c02_mnemo,
|
keyword_is_r65c02_mnemo,
|
||||||
0, // no flags
|
CPUFLAG_WARN_ABOUT_FF_PTR, // TODO - remove this? check datasheets/realhw!
|
||||||
234 // !align fills with "NOP"
|
234 // !align fills with "NOP"
|
||||||
};
|
};
|
||||||
static struct cpu_type cpu_type_w65c02 = {
|
static struct cpu_type cpu_type_w65c02 = {
|
||||||
keyword_is_w65c02_mnemo,
|
keyword_is_w65c02_mnemo,
|
||||||
0, // no flags
|
CPUFLAG_WARN_ABOUT_FF_PTR, // TODO - remove this? check datasheets/realhw!
|
||||||
234 // !align fills with "NOP"
|
234 // !align fills with "NOP"
|
||||||
};
|
};
|
||||||
static struct cpu_type cpu_type_65816 = {
|
static struct cpu_type cpu_type_65816 = {
|
||||||
keyword_is_65816_mnemo,
|
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
|
CPUFLAG_SUPPORTSLONGREGS, // allows A and XY to be 16bits wide
|
||||||
234 // !align fills with "NOP"
|
234 // !align fills with "NOP"
|
||||||
};
|
};
|
||||||
|
@@ -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_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_ISBIGENDIAN (1u << 3) // for 16/24/32-bit values, output msb first
|
||||||
#define CPUFLAG_DECIMALSUBTRACTBUGGY (1u << 4) // warn if "sed" is assembled
|
#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 match, set register length variable to value.
|
||||||
// if cpu type and value don't match, complain instead.
|
// if cpu type and value don't match, complain instead.
|
||||||
|
@@ -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
|
// helper function to warn if zp pointer wraps around
|
||||||
static void check_zp_wraparound(struct number *result)
|
static void check_zp_wraparound(struct number *result)
|
||||||
{
|
{
|
||||||
if ((result->val.intval == 0xff)
|
if ((result->flags & NUMBER_IS_DEFINED)
|
||||||
&& (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");
|
Throw_warning("Zeropage pointer wraps around from $ff to $00");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -572,7 +572,7 @@ void output_set_xor(char xor)
|
|||||||
|
|
||||||
// set program counter to defined value (FIXME - allow for undefined!)
|
// set program counter to defined value (FIXME - allow for undefined!)
|
||||||
// if start address was given on command line, main loop will call this before each pass.
|
// if start address was given on command line, main loop will call this before each pass.
|
||||||
// in addition to that, it will be called on each "* = VALUE".
|
// in addition to that, it will be called on each "*= VALUE".
|
||||||
void vcpu_set_pc(intval_t new_pc, int segment_flags)
|
void vcpu_set_pc(intval_t new_pc, int segment_flags)
|
||||||
{
|
{
|
||||||
intval_t new_offset;
|
intval_t new_offset;
|
||||||
@@ -599,7 +599,7 @@ when encountering "!pseudopc VALUE { BLOCK }":
|
|||||||
remember difference between current and new value
|
remember difference between current and new value
|
||||||
set PC to new value
|
set PC to new value
|
||||||
after BLOCK, use remembered difference to change PC back
|
after BLOCK, use remembered difference to change PC back
|
||||||
when encountering "* = VALUE":
|
when encountering "*= VALUE":
|
||||||
parse new value (NEW: might be undefined!)
|
parse new value (NEW: might be undefined!)
|
||||||
calculate difference between current PC and new value
|
calculate difference between current PC and new value
|
||||||
set PC to new value
|
set PC to new value
|
||||||
@@ -608,7 +608,7 @@ when encountering "* = VALUE":
|
|||||||
Problem: always check for "undefined"; there are some problematic combinations.
|
Problem: always check for "undefined"; there are some problematic combinations.
|
||||||
I need a way to return the size of a generated code block even if PC undefined.
|
I need a way to return the size of a generated code block even if PC undefined.
|
||||||
Maybe like this:
|
Maybe like this:
|
||||||
* = new_address [, invisible] [, overlay] [, &size_symbol_ref {]
|
*= new_address [, invisible] [, overlay] [, &size_symbol_ref {]
|
||||||
...code...
|
...code...
|
||||||
[} ; at end of block, size is written to size symbol given above!]
|
[} ; at end of block, size is written to size symbol given above!]
|
||||||
*/
|
*/
|
||||||
|
@@ -44,7 +44,7 @@ static struct ronode *pseudo_opcode_tree = NULL; // tree to hold pseudo opcodes
|
|||||||
|
|
||||||
|
|
||||||
// this is not really a pseudo opcode, but similar enough to be put here:
|
// this is not really a pseudo opcode, but similar enough to be put here:
|
||||||
// called when "* = EXPRESSION" is parsed, to set the program counter
|
// called when "*= EXPRESSION" is parsed, to set the program counter
|
||||||
void notreallypo_setpc(void) // GotByte is '*'
|
void notreallypo_setpc(void) // GotByte is '*'
|
||||||
{
|
{
|
||||||
int segment_flags = 0;
|
int segment_flags = 0;
|
||||||
@@ -76,7 +76,7 @@ void notreallypo_setpc(void) // GotByte is '*'
|
|||||||
skip '='
|
skip '='
|
||||||
read segment name (quoted string!) */
|
read segment name (quoted string!) */
|
||||||
} else {
|
} else {
|
||||||
Throw_error("Unknown \"* =\" segment modifier.");
|
Throw_error("Unknown \"*=\" segment modifier.");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user