mirror of
https://github.com/cc65/cc65.git
synced 2024-06-09 22:29:35 +00:00
Merge pull request #2006 from bbbradsmith/ca65_jmp_abs_wrap_error
jmp (abs) wrap warning promoted to an error, suppressed on 65C02/etc
This commit is contained in:
commit
537aa665cf
|
@ -120,7 +120,7 @@ Long options:
|
||||||
--list-bytes n Maximum number of bytes per listing line
|
--list-bytes n Maximum number of bytes per listing line
|
||||||
--memory-model model Set the memory model
|
--memory-model model Set the memory model
|
||||||
--pagelength n Set the page length for the listing
|
--pagelength n Set the page length for the listing
|
||||||
--relax-checks Relax some checks (see docs)
|
--relax-checks Disables some error checks
|
||||||
--smart Enable smart mode
|
--smart Enable smart mode
|
||||||
--target sys Set the target system
|
--target sys Set the target system
|
||||||
--verbose Increase verbosity
|
--verbose Increase verbosity
|
||||||
|
@ -265,14 +265,17 @@ Here is a description of all the command line options:
|
||||||
<label id="option--relax-checks">
|
<label id="option--relax-checks">
|
||||||
<tag><tt>--relax-checks</tt></tag>
|
<tag><tt>--relax-checks</tt></tag>
|
||||||
|
|
||||||
Relax some checks done by the assembler. This will allow code that is an
|
Disables some error checks done by the assembler. This will allow code that is an
|
||||||
error in most cases and flagged as such by the assembler, but can be valid
|
error in most cases and flagged as such by the assembler, but can be valid
|
||||||
in special situations.
|
in special situations.
|
||||||
|
|
||||||
Examples are:
|
Disabled checks are:
|
||||||
<itemize>
|
<itemize>
|
||||||
<item>Short branches between two different segments.
|
<item>Address vs. fragment size: a byte sized load from an non-zeropage
|
||||||
<item>Byte sized address loads where the address is not a zeropage address.
|
address is truncated instead of producing an error.
|
||||||
|
<item>Indirect jump on page boundary: <tt>jmp (label)</tt> on a label that
|
||||||
|
resides on a page boundary (<tt>$xxFF</tt>) fetches the second byte from the
|
||||||
|
wrong address on 6502 CPUs, now allowed instead of producing an error.
|
||||||
</itemize>
|
</itemize>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1618,7 +1618,7 @@ static void PutJMP (const InsDesc* Ins)
|
||||||
if (EvalEA (Ins, &A)) {
|
if (EvalEA (Ins, &A)) {
|
||||||
|
|
||||||
/* Check for indirect addressing */
|
/* Check for indirect addressing */
|
||||||
if ((A.AddrModeBit & AM65_ABS_IND) && (CPU < CPU_65SC02)) {
|
if ((A.AddrModeBit & AM65_ABS_IND) && (CPU < CPU_65SC02) && (RelaxChecks == 0)) {
|
||||||
|
|
||||||
/* Compare the low byte of the expression to 0xFF to check for
|
/* Compare the low byte of the expression to 0xFF to check for
|
||||||
** a page cross. Be sure to use a copy of the expression otherwise
|
** a page cross. Be sure to use a copy of the expression otherwise
|
||||||
|
@ -1631,7 +1631,7 @@ static void PutJMP (const InsDesc* Ins)
|
||||||
unsigned Msg = GetStringId ("\"jmp (abs)\" across page border");
|
unsigned Msg = GetStringId ("\"jmp (abs)\" across page border");
|
||||||
|
|
||||||
/* Generate the assertion */
|
/* Generate the assertion */
|
||||||
AddAssertion (E, ASSERT_ACT_WARN, Msg);
|
AddAssertion (E, ASSERT_ACT_ERROR, Msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No error, output code */
|
/* No error, output code */
|
||||||
|
|
4
test/asm/err/jmp-indirect-6502-error.s
Normal file
4
test/asm/err/jmp-indirect-6502-error.s
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
; test that jmp (indirect) on a page boundary will give an error for 6502 CPU
|
||||||
|
|
||||||
|
.p02
|
||||||
|
jmp ($10FF)
|
18
test/asm/val/jmp-indirect-success.s
Normal file
18
test/asm/val/jmp-indirect-success.s
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
; test that jmp (indirect) on a page boundary will not give an error for non-6502 CPUs
|
||||||
|
|
||||||
|
.pc02
|
||||||
|
jmp ($10FF)
|
||||||
|
|
||||||
|
.psc02
|
||||||
|
jmp ($10FF)
|
||||||
|
|
||||||
|
.p816
|
||||||
|
jmp ($10FF)
|
||||||
|
|
||||||
|
; main always returns success (the tested issue is only whether the assembly errors)
|
||||||
|
.import _exit
|
||||||
|
.export _main
|
||||||
|
_main:
|
||||||
|
lda #0
|
||||||
|
tax
|
||||||
|
jmp _exit
|
Loading…
Reference in New Issue
Block a user