1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 02:29:52 +00:00

Merge branch 'cc65:master' into bootstrap-fix

This commit is contained in:
Jeff Tranter 2023-05-03 10:43:44 -04:00 committed by GitHub
commit fdd4d35887
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 19 deletions

View File

@ -2283,7 +2283,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
Switch on or off case sensitivity on identifiers. The default is off
(that is, identifiers are case sensitive), but may be changed by the
-i switch on the command line.
The command must be followed by a '+' or '-' character to switch the
The command can be followed by a '+' or '-' character to switch the
option on or off respectively.
Example:
@ -2432,7 +2432,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
Switch on or off debug info generation. The default is off (that is,
the object file will not contain debug infos), but may be changed by the
-g switch on the command line.
The command must be followed by a '+' or '-' character to switch the
The command can be followed by a '+' or '-' character to switch the
option on or off respectively.
Example:
@ -3380,7 +3380,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
Note: Line continuations do not work in a comment. A backslash at the
end of a comment is treated as part of the comment and does not trigger
line continuation.
The command must be followed by a '+' or '-' character to switch the
The command can be followed by a '+' or '-' character to switch the
option on or off respectively.
Example:
@ -3395,7 +3395,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
<sect1><tt>.LIST</tt><label id=".LIST"><p>
Enable output to the listing. The command must be followed by a boolean
Enable output to the listing. The command can be followed by a boolean
switch ("on", "off", "+" or "-") and will enable or disable listing
output.
The option has no effect if the listing is not enabled by the command line
@ -4040,7 +4040,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
<sect1><tt>.SMART</tt><label id=".SMART"><p>
Switch on or off smart mode. The command must be followed by a '+' or '-'
Switch on or off smart mode. The command can be followed by a '+' or '-'
character to switch the option on or off respectively. The default is off
(that is, the assembler doesn't try to be smart), but this default may be
changed by the -s switch on the command line.
@ -4262,8 +4262,13 @@ macro actually takes in the definition. You may also leave intermediate
parameters empty. Empty parameters are replaced by empty space (that is,
they are removed when the macro is expanded). If you have a look at our
macro definition above, you will see, that replacing the "addr" parameter
by nothing will lead to wrong code in most lines. To help you, writing
macros with a variable parameter list, there are some control commands:
by nothing will lead to wrong code in most lines.
The names "a", "x" and "y" should be avoided for macro parameters, as these
will usually conflict with the 6502 registers.
For writing macros with a variable parameter list, control commands are
available:
<tt><ref id=".IFBLANK" name=".IFBLANK"></tt> tests the rest of the line and
returns true, if there are any tokens on the remainder of the line. Since
@ -4274,15 +4279,15 @@ opposite.
Look at this example:
<tscreen><verb>
.macro ldaxy a, x, y
.ifnblank a
lda #a
.macro ldaxy i, j, k
.ifnblank i
lda #i
.endif
.ifnblank x
ldx #x
.ifnblank j
ldx #j
.endif
.ifnblank y
ldy #y
.ifnblank k
ldy #k
.endif
.endmacro
</verb></tscreen>

View File

@ -43,6 +43,10 @@
/*****************************************************************************/
/* EffAddr Flags */
#define EFFADDR_OVERRIDE_ZP 0x00000001UL
/* GetEA result struct */
typedef struct EffAddr EffAddr;
@ -51,6 +55,7 @@ struct EffAddr {
unsigned long AddrModeSet; /* Possible addressing modes */
struct ExprNode* Expr; /* Expression if any (NULL otherwise) */
unsigned Reg; /* Register number in sweet16 mode */
unsigned long Flags; /* Other properties */
/* The following fields are used inside instr.c */
unsigned AddrMode; /* Actual addressing mode used */

View File

@ -72,11 +72,13 @@ void GetEA (EffAddr* A)
/* Clear the output struct */
A->AddrModeSet = 0;
A->Expr = 0;
A->Flags = 0;
/* Handle an addressing size override */
switch (CurTok.Tok) {
case TOK_OVERRIDE_ZP:
Restrictions = AM65_DIR | AM65_DIR_X | AM65_DIR_Y;
A->Flags |= EFFADDR_OVERRIDE_ZP;
NextTok ();
break;

View File

@ -1269,7 +1269,8 @@ static int EvalEA (const InsDesc* Ins, EffAddr* A)
ExprNode* Left = A->Expr->Left;
if ((A->Expr->Op == EXPR_BYTE0 || A->Expr->Op == EXPR_BYTE1) &&
Left->Op == EXPR_SYMBOL &&
GetSymAddrSize (Left->V.Sym) != ADDR_SIZE_ZP) {
GetSymAddrSize (Left->V.Sym) != ADDR_SIZE_ZP &&
!(A->Flags & EFFADDR_OVERRIDE_ZP)) {
/* Output a warning */
Warning (1, "Suspicious address expression");
@ -1617,11 +1618,12 @@ static void PutJMP (const InsDesc* Ins)
if (EvalEA (Ins, &A)) {
/* Check for indirect addressing */
if (A.AddrModeBit & AM65_ABS_IND) {
if ((A.AddrModeBit & AM65_ABS_IND) && (CPU < CPU_65SC02)) {
/* 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
** things will go weird later.
** things will go weird later. This only affects the 6502 CPU,
** and was corrected in 65C02 and later CPUs in this family.
*/
ExprNode* E = GenNE (GenByteExpr (CloneExpr (A.Expr)), 0xFF);

View File

@ -21,7 +21,7 @@ unsigned int uia, uib;
unsigned long ula, ulb;
#define OPTCMP8TEST_SINGLE(num,cmpop,asmprefix,vara,varb,b0,b1,a0,a1,typename,name) \
typename name ## _ ## num ## (void) { \
typename name ## _ ## num(void) { \
varb = b0; \
asm( asmprefix ); \
vara = a0; \
@ -30,7 +30,7 @@ unsigned long ula, ulb;
}
#define OPTCMP8TEST_VERIFY(num,b,desc,printterm,name) \
ASSERT_AreEqual(name ## _ ## num ##(),b,printterm,"Incorrect optimization of const comparison (" #name "_" #num ": " desc ").");
ASSERT_AreEqual(name ## _ ## num(),b,printterm,"Incorrect optimization of const comparison (" #name "_" #num ": " desc ").");
/* Generates a set of comparison tests for one type and set of test values.
** name = a name for this test (no spaces)