From f5365c7ffdcafda91b7f84d3b4d04555ba458816 Mon Sep 17 00:00:00 2001 From: polluks2 <74630735+polluks2@users.noreply.github.com> Date: Sun, 4 Apr 2021 03:13:45 +0200 Subject: [PATCH 01/44] Update README.md Commander X16 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3d78fda50..2c84b7430 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ including - the Oric Telestrat. - the Lynx console. - the Ohio Scientific Challenger 1P. +- the Commander X16. The libraries are fairly portable, so creating a version for other 6502s shouldn't be too much work. From bd8eae67f1616ca8fcb434a8ba932731c21891f8 Mon Sep 17 00:00:00 2001 From: acqn Date: Mon, 5 Apr 2021 16:40:32 +0800 Subject: [PATCH 02/44] Fixed local struct field access via the address of the struct. --- src/cc65/expr.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 9e08faeeb..74524c47a 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -1340,7 +1340,6 @@ static void Primary (ExprDesc* E) static void StructRef (ExprDesc* Expr) /* Process struct/union field after . or ->. */ { - ident Ident; Type* FinalType; TypeCode Q; @@ -1354,42 +1353,42 @@ static void StructRef (ExprDesc* Expr) } /* Get the symbol table entry and check for a struct/union field */ - strcpy (Ident, CurTok.Ident); NextToken (); - const SymEntry Field = FindStructField (Expr->Type, Ident); + const SymEntry Field = FindStructField (Expr->Type, CurTok.Ident); if (Field.Type == 0) { - Error ("No field named '%s' found in '%s'", Ident, GetFullTypeName (Expr->Type)); + Error ("No field named '%s' found in '%s'", CurTok.Ident, GetFullTypeName (Expr->Type)); /* Make the expression an integer at address zero */ ED_MakeConstAbs (Expr, 0, type_int); return; } - /* A struct/union is usually an lvalue. If not, it is a struct/union passed - ** in the primary register, which is usually the result returned from a - ** function. However, it is possible that this rvalue is the result of - ** certain kind of operations on an lvalue such as assignment, and there - ** are no reasons to disallow such use cases. So we just rely on the check - ** upon function returns to catch the unsupported cases and dereference the - ** rvalue address of the struct/union here all the time. - */ - if (IsTypePtr (Expr->Type) || - (ED_IsRVal (Expr) && - ED_IsLocPrimary (Expr) && - Expr->Type == GetStructReplacementType (Expr->Type))) { + if (IsTypePtr (Expr->Type)) { - if (!ED_IsConst (Expr) && !ED_IsLocPrimary (Expr)) { + /* pointer->field */ + if (!ED_IsQuasiConst (Expr) && !ED_IsLocPrimary (Expr)) { /* If we have a non-const struct/union pointer that is not in the - ** primary yet, load its content now. + ** primary yet, load its content now to get the base address. */ LoadExpr (CF_NONE, Expr); - - /* Clear the offset */ - Expr->IVal = 0; + ED_FinalizeRValLoad (Expr); } - /* Dereference the address expression */ ED_IndExpr (Expr); + } else if (ED_IsRVal (Expr) && + ED_IsLocPrimary (Expr) && + Expr->Type == GetStructReplacementType (Expr->Type)) { + + /* A struct/union is usually an lvalue. If not, it is a struct/union + ** passed in the primary register, which is usually the result returned + ** from a function. However, it is possible that this rvalue is the + ** result of certain kind of operations on an lvalue such as assignment, + ** and there are no reasons to disallow such use cases. So we just rely + ** on the check upon function returns to catch the unsupported cases and + ** dereference the rvalue address of the struct/union here all the time. + */ + ED_IndExpr (Expr); + } else if (!ED_IsLocQuasiConst (Expr) && !ED_IsLocPrimaryOrExpr (Expr)) { /* Load the base address into the primary (and use it as a reference ** later) if it's not quasi-const or in the primary already. From 39700c77ee8eb0c2e162b81155c5066c6a4c81fe Mon Sep 17 00:00:00 2001 From: acqn Date: Mon, 5 Apr 2021 17:31:18 +0800 Subject: [PATCH 03/44] Added test case for Issue #1451. --- test/val/bug1451.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/val/bug1451.c diff --git a/test/val/bug1451.c b/test/val/bug1451.c new file mode 100644 index 000000000..c00f19903 --- /dev/null +++ b/test/val/bug1451.c @@ -0,0 +1,39 @@ +/* Bug #1451 - local struct field access via the address of the struct */ + +#include + +typedef struct { + int a; + int b; +} S; + +int failures = 0; + +int main(void) +{ + S a = {2, 5}; + S b = {1, 4}; + S m[1] = {{6, 3}}; + S *p = &a; + + (&a)->a += b.a; + p->b += b.b; + m->a += b.a; + + if ((&a)->a != 3) { + ++failures; + printf("Expected 3, got %d\n", (&a)->a); + } + + if (p->b != 9) { + ++failures; + printf("Expected 9, got %d\n", p->b); + } + + if (m->a != 7) { + ++failures; + printf("Expected 7, got %d\n", m->a); + } + + return failures; +} From 0ed41db478ccf77b89aca8c6e9e959b0c113336c Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 5 Apr 2021 23:50:07 +0200 Subject: [PATCH 04/44] Some minor clarifications. --- doc/apple2.sgml | 14 +++++--------- doc/apple2enh.sgml | 14 +++++--------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/doc/apple2.sgml b/doc/apple2.sgml index 91c02c7ad..f957e1247 100644 --- a/doc/apple2.sgml +++ b/doc/apple2.sgml @@ -575,15 +575,13 @@ url="ca65.html" name="assembler manual">. Explanation of File Types - ProDOS associates a file type and an auxiliary type with each file. + ProDOS 8 associates a file type and an auxiliary type with each file. These type specifications are separate from the file's name, unlike Windows which uses the file name's suffix (a.k.a. extension) to specify the file type. For example, . The header file Example @@ -624,8 +620,8 @@ url="ca65.html" name="assembler manual">. carriage return instead of a line-feed (Linux/BSD/MacOS) or carriage return, line-feed pair (Windows). - The "sequential" text file terminology is in contrast to a - "random-access" text file which would + The 'sequential' text file terminology is in contrast to a + 'random-access' text file which would have a fixed-length, non-zero record length, so that the file position of any individual record can be calculated. diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml index 2d4381353..4aafbc256 100644 --- a/doc/apple2enh.sgml +++ b/doc/apple2enh.sgml @@ -580,15 +580,13 @@ url="ca65.html" name="assembler manual">. Explanation of File Types - ProDOS associates a file type and an auxiliary type with each file. + ProDOS 8 associates a file type and an auxiliary type with each file. These type specifications are separate from the file's name, unlike Windows which uses the file name's suffix (a.k.a. extension) to specify the file type. For example, . The header file Example @@ -629,8 +625,8 @@ url="ca65.html" name="assembler manual">. carriage return instead of a line-feed (Linux/BSD/MacOS) or carriage return, line-feed pair (Windows). - The "sequential" text file terminology is in contrast to a - "random-access" text file which would + The 'sequential' text file terminology is in contrast to a + 'random-access' text file which would have a fixed-length, non-zero record length, so that the file position of any individual record can be calculated. From e435da623460d3baaad0c8f5f0b609f53cb96bb3 Mon Sep 17 00:00:00 2001 From: acqn Date: Fri, 18 Sep 2020 20:21:51 +0800 Subject: [PATCH 05/44] Interim fix for Issue #897. --- src/cc65/codeseg.c | 49 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/src/cc65/codeseg.c b/src/cc65/codeseg.c index 0626f3d18..e621147ab 100644 --- a/src/cc65/codeseg.c +++ b/src/cc65/codeseg.c @@ -282,6 +282,8 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L) char Reg; CodeEntry* E; CodeLabel* Label; + const char* ArgBase = Arg; + int IsLabel = 0; /* Read the first token and skip white space after it */ L = SkipSpace (ReadToken (L, " \t:", Mnemo, sizeof (Mnemo))); @@ -448,32 +450,44 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L) } - /* If the instruction is a branch, check for the label and generate it - ** if it does not exist. This may lead to unused labels (if the label + /* We do now have the addressing mode in AM. Allocate a new CodeEntry + ** structure and half-initialize it. We'll set the argument and the label + ** later. + */ + E = NewCodeEntry (OPC->OPC, AM, Arg, 0, LI); + + /* If the instruction is a branch or accessing memory data, check if for + ** the argument could refer to a label. If it does but the label does not + ** exist yet, generate it. This may lead to unused labels (if the label ** is actually an external one) which are removed by the CS_MergeLabels ** function later. */ - Label = 0; - if (AM == AM65_BRA) { + if ((E->Info & OF_CALL) == 0 && + (E->ArgInfo & AIF_HAS_NAME) != 0) { + ArgBase = E->ArgBase; + IsLabel = (E->ArgInfo & AIF_LOCAL) != 0; + } + + if (AM == AM65_BRA || IsLabel) { /* Generate the hash over the label, then search for the label */ - unsigned Hash = HashStr (Arg) % CS_LABEL_HASH_SIZE; - Label = CS_FindLabel (S, Arg, Hash); + unsigned Hash = HashStr (ArgBase) % CS_LABEL_HASH_SIZE; + Label = CS_FindLabel (S, ArgBase, Hash); /* If we don't have the label, it's a forward ref - create it unless ** it's an external function. */ - if (Label == 0 && (OPC->OPC != OP65_JMP || IsLocalLabelName (Arg)) ) { + if (Label == 0 && (OPC->OPC != OP65_JMP || IsLabel)) { /* Generate a new label */ - Label = CS_NewCodeLabel (S, Arg, Hash); + Label = CS_NewCodeLabel (S, ArgBase, Hash); + } + + if (Label != 0) { + /* Assign the jump */ + CL_AddRef (Label, E); } } - /* We do now have the addressing mode in AM. Allocate a new CodeEntry - ** structure and initialize it. - */ - E = NewCodeEntry (OPC->OPC, AM, Arg, Label, LI); - /* Return the new code entry */ return E; } @@ -1084,8 +1098,13 @@ void CS_MoveLabelRef (CodeSeg* S, struct CodeEntry* E, CodeLabel* L) /* Be sure that code entry references a label */ PRECONDITION (OldLabel != 0); - /* Remove the reference to our label */ - CS_RemoveLabelRef (S, E); + /* Delete the entry from the label */ + CollDeleteItem (&OldLabel->JumpFrom, E); + + /* If there are no more references, delete the label */ + if (CollCount (&OldLabel->JumpFrom) == 0) { + CS_DelLabel (S, OldLabel); + } /* Use the new label */ CL_AddRef (L, E); From 5f8d1630458f76f17862ed1fff6a30a635e93218 Mon Sep 17 00:00:00 2001 From: acqn Date: Thu, 1 Apr 2021 18:46:00 +0800 Subject: [PATCH 06/44] Moved one test case for #1209. --- test/{misc => val}/bug1209-ind-goto-rev.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/{misc => val}/bug1209-ind-goto-rev.c (100%) diff --git a/test/misc/bug1209-ind-goto-rev.c b/test/val/bug1209-ind-goto-rev.c similarity index 100% rename from test/misc/bug1209-ind-goto-rev.c rename to test/val/bug1209-ind-goto-rev.c From eb1cf750f285dffd3d3b6de227482e69f1b79c01 Mon Sep 17 00:00:00 2001 From: Dirk Lehmann Date: Mon, 12 Apr 2021 17:05:31 +0200 Subject: [PATCH 07/44] -W-unreachable-code option added, alphabetic order of --list-warnings --- doc/cc65.sgml | 2 ++ src/cc65/error.c | 6 ++++-- src/cc65/error.h | 3 ++- src/cc65/stmt.c | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/cc65.sgml b/doc/cc65.sgml index 24f4422f4..240c2bc09 100644 --- a/doc/cc65.sgml +++ b/doc/cc65.sgml @@ -555,6 +555,8 @@ Here is a description of all the command line options: Warn when passing structs by value. Warn about #pragmas that aren't recognized by cc65. + + Warn about unreachable code in cases of comparing constants, etc. Warn about unused labels. diff --git a/src/cc65/error.c b/src/cc65/error.c index ec665b319..0118d50b8 100644 --- a/src/cc65/error.c +++ b/src/cc65/error.c @@ -71,12 +71,13 @@ IntStack WarnNoEffect = INTSTACK(1); /* - statements without an effect */ IntStack WarnPointerSign = INTSTACK(1); /* - pointer conversion to pointer differing in signedness */ IntStack WarnPointerTypes = INTSTACK(1); /* - pointer conversion to incompatible pointer type */ IntStack WarnRemapZero = INTSTACK(1); /* - remapping character code zero */ +IntStack WarnReturnType = INTSTACK(1); /* - control reaches end of non-void function */ IntStack WarnStructParam = INTSTACK(0); /* - structs passed by val */ IntStack WarnUnknownPragma = INTSTACK(1); /* - unknown #pragmas */ +IntStack WarnUnreachableCode= INTSTACK(1); /* - unreachable code */ IntStack WarnUnusedLabel = INTSTACK(1); /* - unused labels */ IntStack WarnUnusedParam = INTSTACK(1); /* - unused parameters */ IntStack WarnUnusedVar = INTSTACK(1); /* - unused variables */ -IntStack WarnReturnType = INTSTACK(1); /* - control reaches end of non-void function */ /* Map the name of a warning to the intstack that holds its state */ typedef struct WarnMapEntry WarnMapEntry; @@ -92,12 +93,13 @@ static WarnMapEntry WarnMap[] = { { &WarnPointerSign, "pointer-sign" }, { &WarnPointerTypes, "pointer-types" }, { &WarnRemapZero, "remap-zero" }, + { &WarnReturnType, "return-type" }, { &WarnStructParam, "struct-param" }, { &WarnUnknownPragma, "unknown-pragma" }, + { &WarnUnreachableCode, "unreachable-code" }, { &WarnUnusedLabel, "unused-label" }, { &WarnUnusedParam, "unused-param" }, { &WarnUnusedVar, "unused-var" }, - { &WarnReturnType, "return-type" }, }; Collection DiagnosticStrBufs; diff --git a/src/cc65/error.h b/src/cc65/error.h index a7592b366..31c46f513 100644 --- a/src/cc65/error.h +++ b/src/cc65/error.h @@ -68,12 +68,13 @@ extern IntStack WarnPointerSign; /* - pointer conversion to pointer diffe extern IntStack WarnPointerTypes; /* - pointer conversion to incompatible pointer type */ extern IntStack WarnNoEffect; /* - statements without an effect */ extern IntStack WarnRemapZero; /* - remapping character code zero */ +extern IntStack WarnReturnType; /* - control reaches end of non-void function */ extern IntStack WarnStructParam; /* - structs passed by val */ extern IntStack WarnUnknownPragma; /* - unknown #pragmas */ +extern IntStack WarnUnreachableCode; /* - unreachable code */ extern IntStack WarnUnusedLabel; /* - unused labels */ extern IntStack WarnUnusedParam; /* - unused parameters */ extern IntStack WarnUnusedVar; /* - unused variables */ -extern IntStack WarnReturnType; /* - control reaches end of non-void function */ /* Forward */ struct StrBuf; diff --git a/src/cc65/stmt.c b/src/cc65/stmt.c index 9890c5467..ccb113978 100644 --- a/src/cc65/stmt.c +++ b/src/cc65/stmt.c @@ -187,7 +187,7 @@ static int IfStatement (void) /* If the if expression was always true, the code in the else branch ** is never executed. Output a warning if this is the case. */ - if (TestResult == TESTEXPR_TRUE) { + if (TestResult == TESTEXPR_TRUE && IS_Get (&WarnUnreachableCode)) { Warning ("Unreachable code"); } From 6bb1b6953f77bcf07e337ccd988b562a9cd611f3 Mon Sep 17 00:00:00 2001 From: Greg King Date: Sat, 17 Apr 2021 01:59:09 -0400 Subject: [PATCH 08/44] Documented the options to control cc65's warnings about induced pointer type changes. --- doc/cc65.sgml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/cc65.sgml b/doc/cc65.sgml index 240c2bc09..dc754cb31 100644 --- a/doc/cc65.sgml +++ b/doc/cc65.sgml @@ -546,6 +546,12 @@ Here is a description of all the command line options: Treat all warnings as errors. Warn about statements that don't have an effect. + + Warn if a pointer assignment changes the signedness of the target + of a pointer value, and the new signedness wasn't cast explicitly. + + Warn if a pointer assignment changes the type of the target + of a pointer value, and the new type wasn't cast explicitly. Warn about a / that changes a character's code number from/to 0x00. From 6e61093e7934098959e846758c0bec132fbe8d10 Mon Sep 17 00:00:00 2001 From: acqn Date: Thu, 15 Apr 2021 21:38:30 +0800 Subject: [PATCH 09/44] Fixed pointer subtraction in certain very rare cases. --- src/cc65/expr.c | 50 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 74524c47a..b0ebbf191 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -3250,6 +3250,20 @@ static void parsesub (ExprDesc* Expr) /* Get the rhs type */ rhst = Expr2.Type; + if (IsClassPtr (lhst)) { + /* We'll have to scale the result */ + rscale = PSizeOf (lhst); + /* We cannot scale by 0-size or unknown-size */ + if (rscale == 0 && (IsClassPtr (rhst) || IsClassInt (rhst))) { + TypeCompatibilityDiagnostic (lhst, rhst, + 1, "Invalid pointer types in subtraction: '%s' and '%s'"); + /* Avoid further errors */ + rscale = 1; + } + /* Generate code for pointer subtraction */ + flags = CF_PTR; + } + /* We can only do constant expressions for: ** - integer subtraction: ** - numeric - numeric @@ -3266,24 +3280,14 @@ static void parsesub (ExprDesc* Expr) */ if (IsClassPtr (lhst) && IsClassPtr (rhst)) { - /* Pointer diff */ - if (TypeCmp (lhst, rhst).C >= TC_STRICT_COMPATIBLE) { - /* We'll have to scale the result */ - rscale = PSizeOf (lhst); - /* We cannot scale by 0-size or unknown-size */ - if (rscale == 0) { - TypeCompatibilityDiagnostic (lhst, rhst, - 1, "Invalid pointer types in subtraction: '%s' and '%s'"); - /* Avoid further errors */ - rscale = 1; - } - } else { + /* Pointer Diff. We've got the scale factor and flags above */ + typecmp_t Cmp = TypeCmp (lhst, rhst); + if (Cmp.C < TC_STRICT_COMPATIBLE) { TypeCompatibilityDiagnostic (lhst, rhst, 1, "Incompatible pointer types in subtraction: '%s' and '%s'"); } /* Operate on pointers, result type is an integer */ - flags = CF_PTR; Expr->Type = type_int; /* Check for a constant rhs expression */ @@ -3338,10 +3342,7 @@ static void parsesub (ExprDesc* Expr) /* Both sides are constant. Check for pointer arithmetic */ if (IsClassPtr (lhst) && IsClassInt (rhst)) { - /* Left is pointer, right is int, must scale rhs */ - rscale = CheckedPSizeOf (lhst); - /* Operate on pointers, result type is a pointer */ - flags = CF_PTR; + /* Pointer subtraction. We've got the scale factor and flags above */ } else if (IsClassInt (lhst) && IsClassInt (rhst)) { /* Integer subtraction. We'll adjust the types later */ } else { @@ -3383,7 +3384,7 @@ static void parsesub (ExprDesc* Expr) flags = typeadjust (Expr, &Expr2, 1); } /* Do the subtraction */ - g_dec (flags | CF_CONST, Expr2.IVal); + g_dec (flags | CF_CONST, Expr2.IVal * rscale); } else { if (IsClassInt (lhst)) { /* Adjust the types */ @@ -3391,6 +3392,7 @@ static void parsesub (ExprDesc* Expr) } /* Load rhs into the primary */ LoadExpr (CF_NONE, &Expr2); + g_scale (TypeOf (rhst), rscale); /* Generate code for the sub (the & is a hack here) */ g_sub (flags & ~CF_CONST, 0); } @@ -3402,10 +3404,7 @@ static void parsesub (ExprDesc* Expr) /* Left hand side is not constant, right hand side is */ if (IsClassPtr (lhst) && IsClassInt (rhst)) { - /* Left is pointer, right is int, must scale rhs */ - Expr2.IVal *= CheckedPSizeOf (lhst); - /* Operate on pointers, result type is a pointer */ - flags = CF_PTR; + /* Pointer subtraction. We've got the scale factor and flags above */ } else if (IsClassInt (lhst) && IsClassInt (rhst)) { /* Integer subtraction. We'll adjust the types later */ } else { @@ -3422,7 +3421,7 @@ static void parsesub (ExprDesc* Expr) flags = typeadjust (Expr, &Expr2, 1); } /* Do the subtraction */ - g_dec (flags | CF_CONST, Expr2.IVal); + g_dec (flags | CF_CONST, Expr2.IVal * rscale); } else { if (IsClassInt (lhst)) { /* Adjust the types */ @@ -3430,6 +3429,7 @@ static void parsesub (ExprDesc* Expr) } /* Load rhs into the primary */ LoadExpr (CF_NONE, &Expr2); + g_scale (TypeOf (rhst), rscale); /* Generate code for the sub (the & is a hack here) */ g_sub (flags & ~CF_CONST, 0); } @@ -3449,9 +3449,7 @@ static void parsesub (ExprDesc* Expr) /* Check for pointer arithmetic */ if (IsClassPtr (lhst) && IsClassInt (rhst)) { /* Left is pointer, right is int, must scale rhs */ - g_scale (CF_INT, CheckedPSizeOf (lhst)); - /* Operate on pointers, result type is a pointer */ - flags = CF_PTR; + g_scale (CF_INT, rscale); } else if (IsClassInt (lhst) && IsClassInt (rhst)) { /* Adjust operand types */ flags = typeadjust (Expr, &Expr2, 0); From ffc30c0c6ea220d8adaedcdcc9517436fdb98f86 Mon Sep 17 00:00:00 2001 From: Greg King Date: Sun, 18 Apr 2021 01:39:44 -0400 Subject: [PATCH 10/44] Added RAM_BANK and ROM_BANK macro definitions to cx16.h header. --- include/cx16.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/cx16.h b/include/cx16.h index f3d02bd28..179021e84 100644 --- a/include/cx16.h +++ b/include/cx16.h @@ -278,6 +278,9 @@ struct __vera { #define VIA1 (*(volatile struct __6522 *)0x9F60) #define VIA2 (*(volatile struct __6522 *)0x9F70) +#define RAM_BANK (VIA1.pra) +#define ROM_BANK (VIA1.prb) + /* A structure with the x16emu's settings registers */ struct __emul { unsigned char debug; /* Boolean: debugging enabled */ @@ -295,7 +298,7 @@ struct __emul { #define EMULATOR (*(volatile struct __emul *)0x9FB0) /* An array window into the half Mebibyte or two Mebibytes of banked RAM */ -#define BANK_RAM ((unsigned char[0x2000])0xA000) +#define BANK_RAM ((unsigned char *)0xA000) From c915b5d7f3bc5bc66e481001de240aae408acd6d Mon Sep 17 00:00:00 2001 From: Marco Aurelio da Costa Date: Fri, 16 Apr 2021 14:42:16 -0300 Subject: [PATCH 11/44] Implemented charmap stack New commands: .PUSHCHARMAP: will push the current charmap state into an internal stack .POPCHARMAP: will restore the current charmap to the last pushed charmap Details: The push and pop facilities are implemented directly inside the tgttrans.h, to facilitate its reuse on the C compiler. --- src/ca65/pseudo.c | 28 ++++++++++++++++++++++ src/ca65/scanner.c | 2 ++ src/ca65/token.h | 2 ++ src/common/tgttrans.c | 56 +++++++++++++++++++++++++++++++++++++++++++ src/common/tgttrans.h | 13 ++++++++++ 5 files changed, 101 insertions(+) diff --git a/src/ca65/pseudo.c b/src/ca65/pseudo.c index 26d01cbf1..df0482a5a 100644 --- a/src/ca65/pseudo.c +++ b/src/ca65/pseudo.c @@ -1568,6 +1568,19 @@ static void DoPageLength (void) +static void DoPopCharmap (void) +/* Restore a charmap */ +{ + if (TgtTranslateStackIsEmpty ()) { + ErrorSkip ("Charmap stack is empty"); + return; + } + + TgtTranslatePop (); +} + + + static void DoPopCPU (void) /* Pop an old CPU setting from the CPU stack */ { @@ -1657,6 +1670,16 @@ static void DoPSC02 (void) +static void DoPushCharmap (void) +/* Save the current charmap */ +{ + if (!TgtTranslatePush ()) { + ErrorSkip ("Charmap stack overflow"); + } +} + + + static void DoPushCPU (void) /* Push the current CPU setting onto the CPU stack */ { @@ -2101,10 +2124,12 @@ static CtrlDesc CtrlCmdTab [] = { { ccNone, DoUnexpected }, /* .PARAMCOUNT */ { ccNone, DoPC02 }, { ccNone, DoPDTV }, + { ccNone, DoPopCharmap }, { ccNone, DoPopCPU }, { ccNone, DoPopSeg }, { ccNone, DoProc }, { ccNone, DoPSC02 }, + { ccNone, DoPushCharmap }, { ccNone, DoPushCPU }, { ccNone, DoPushSeg }, { ccNone, DoUnexpected }, /* .REFERENCED */ @@ -2183,4 +2208,7 @@ void CheckPseudo (void) if (!IS_IsEmpty (&CPUStack)) { Warning (1, "CPU stack is not empty"); } + if (!TgtTranslateStackIsEmpty ()) { + Warning (1, "Charmap stack is not empty"); + } } diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c index fb9905809..0452bb368 100644 --- a/src/ca65/scanner.c +++ b/src/ca65/scanner.c @@ -260,10 +260,12 @@ struct DotKeyword { { ".PARAMCOUNT", TOK_PARAMCOUNT }, { ".PC02", TOK_PC02 }, { ".PDTV", TOK_PDTV }, + { ".POPCHARMAP", TOK_POPCHARMAP }, { ".POPCPU", TOK_POPCPU }, { ".POPSEG", TOK_POPSEG }, { ".PROC", TOK_PROC }, { ".PSC02", TOK_PSC02 }, + { ".PUSHCHARMAP", TOK_PUSHCHARMAP }, { ".PUSHCPU", TOK_PUSHCPU }, { ".PUSHSEG", TOK_PUSHSEG }, { ".REF", TOK_REFERENCED }, diff --git a/src/ca65/token.h b/src/ca65/token.h index ab36028fd..a94254bfd 100644 --- a/src/ca65/token.h +++ b/src/ca65/token.h @@ -231,10 +231,12 @@ typedef enum token_t { TOK_PARAMCOUNT, TOK_PC02, TOK_PDTV, + TOK_POPCHARMAP, TOK_POPCPU, TOK_POPSEG, TOK_PROC, TOK_PSC02, + TOK_PUSHCHARMAP, TOK_PUSHCPU, TOK_PUSHSEG, TOK_REFERENCED, diff --git a/src/common/tgttrans.c b/src/common/tgttrans.c index bd2056505..af5bdf725 100644 --- a/src/common/tgttrans.c +++ b/src/common/tgttrans.c @@ -39,6 +39,8 @@ #include "check.h" #include "target.h" #include "tgttrans.h" +#include "coll.h" +#include "xmalloc.h" @@ -68,6 +70,9 @@ static unsigned char Tab[256] = { 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, }; +#define MAX_CHARMAP_STACK 16 +static Collection CharmapStack = STATIC_COLLECTION_INITIALIZER; + /*****************************************************************************/ @@ -76,6 +81,8 @@ static unsigned char Tab[256] = { + + void TgtTranslateInit (void) /* Initialize the translation tables */ { @@ -127,3 +134,52 @@ void TgtTranslateSet (unsigned Index, unsigned char C) CHECK (Index < sizeof (Tab)); Tab[Index] = C; } + + + +int TgtTranslatePush (void) +/* Pushes the current translation table to the internal stack +** Returns 1 on success, 0 on stack full +*/ +{ + unsigned char* TempTab; + + if (CollCount (&CharmapStack) >= MAX_CHARMAP_STACK) { + return 0; + } + + TempTab = xmalloc (sizeof (Tab)); + memcpy (TempTab, Tab, sizeof (Tab)); + + CollAppend (&CharmapStack, TempTab); + return 1; +} + + + +int TgtTranslatePop (void) +/* Pops a translation table from the internal stack into the current table +** Returns 1 on success, 0 on stack empty +*/ +{ + unsigned char* TempTab; + + if (CollCount (&CharmapStack) == 0) { + return 0; + } + + TempTab = CollPop (&CharmapStack); + + memcpy (Tab, TempTab, sizeof (Tab)); + + xfree (TempTab); + return 1; +} + + + +int TgtTranslateStackIsEmpty (void) +/* Returns 1 if the internal stack is empty */ +{ + return CollCount (&CharmapStack) == 0; +} diff --git a/src/common/tgttrans.h b/src/common/tgttrans.h index 46981ec0f..a86d126db 100644 --- a/src/common/tgttrans.h +++ b/src/common/tgttrans.h @@ -70,6 +70,19 @@ void TgtTranslateStrBuf (StrBuf* Buf); void TgtTranslateSet (unsigned Index, unsigned char C); /* Set the translation code for the given character */ +int TgtTranslatePush (void); +/* Pushes the current translation table to the internal stack +** Returns 1 on success, 0 on stack full +*/ + +int TgtTranslatePop (void); +/* Pops a translation table from the internal stack into the current table +** Returns 1 on success, 0 on stack empty +*/ + +int TgtTranslateStackIsEmpty (void); +/* Returns 1 if the internal stack is empty */ + /* End of tgttrans.h */ From 83ee928fb155c53d32ac532d959d6e17bbfb945b Mon Sep 17 00:00:00 2001 From: Marco Aurelio da Costa Date: Sun, 18 Apr 2021 12:52:26 -0300 Subject: [PATCH 12/44] mc: Formatting, remove stray lines --- src/common/tgttrans.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/common/tgttrans.c b/src/common/tgttrans.c index af5bdf725..3310eab81 100644 --- a/src/common/tgttrans.c +++ b/src/common/tgttrans.c @@ -81,8 +81,6 @@ static Collection CharmapStack = STATIC_COLLECTION_INITIALIZER; - - void TgtTranslateInit (void) /* Initialize the translation tables */ { From 1993d5c091d85af22fe5c7fd5ac13599ce1cd90b Mon Sep 17 00:00:00 2001 From: Marco Aurelio da Costa Date: Sun, 18 Apr 2021 14:18:39 -0300 Subject: [PATCH 13/44] mc: Documentation for .PUSHCHARMAP/.POPCHARMAP --- doc/ca65.sgml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/doc/ca65.sgml b/doc/ca65.sgml index cebdca12e..ebd6c7135 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -3601,6 +3601,21 @@ Here's a list of all control commands and a description, what they do: See: +.POPCHARMAP

- Apply a custom mapping for characters. The command is followed by two - numbers. The first one is the index of the source character (range 0..255); + Apply a custom mapping for characters for the commands and . The command + is followed by two numbers. The first one is the index of the source character + (range 0..255); the second one is the mapping (range 0..255). The mapping applies to all character and string constants @@ -3356,6 +3366,22 @@ Here's a list of all control commands and a description, what they do: +.LITERAL

+ + Define byte sized data. Must be followed by a sequence of (byte ranged) + expressions or strings. Strings will disregard the current character + mapping definition and will be interpreted literally. + + Example: + + + .literal "Hello " + .literal "world", $0D, $00 + + +See: , + + .LOBYTES

Define byte sized data by extracting only the low byte (that is, bits 0-7) from diff --git a/src/ca65/pseudo.c b/src/ca65/pseudo.c index df0482a5a..7e24d814d 100644 --- a/src/ca65/pseudo.c +++ b/src/ca65/pseudo.c @@ -566,8 +566,8 @@ static void DoBss (void) -static void DoByte (void) -/* Define bytes */ +static void DoByteBase (int EnableTranslation) +/* Define bytes or literals */ { /* Element type for the generated array */ static const char EType[1] = { GT_BYTE }; @@ -579,8 +579,12 @@ static void DoByte (void) /* Parse arguments */ while (1) { if (CurTok.Tok == TOK_STRCON) { - /* A string, translate into target charset and emit */ - TgtTranslateStrBuf (&CurTok.SVal); + /* A string, translate into target charset + if appropriate */ + if (EnableTranslation) { + TgtTranslateStrBuf (&CurTok.SVal); + } + /* Emit */ EmitStrBuf (&CurTok.SVal); NextTok (); } else { @@ -613,6 +617,14 @@ static void DoByte (void) +static void DoByte (void) +/* Define bytes with translation */ +{ + DoByteBase (1); +} + + + static void DoCase (void) /* Switch the IgnoreCase option */ { @@ -1415,6 +1427,14 @@ static void DoList (void) +static void DoLiteral (void) +/* Define bytes without translation */ +{ + DoByteBase (0); +} + + + static void DoLoBytes (void) /* Define bytes, extracting the lo byte from each expression in the list */ { @@ -2103,6 +2123,7 @@ static CtrlDesc CtrlCmdTab [] = { { ccNone, DoLineCont }, { ccNone, DoList }, { ccNone, DoListBytes }, + { ccNone, DoLiteral }, { ccNone, DoUnexpected }, /* .LOBYTE */ { ccNone, DoLoBytes }, { ccNone, DoUnexpected }, /* .LOCAL */ diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c index 0452bb368..0a7d433b2 100644 --- a/src/ca65/scanner.c +++ b/src/ca65/scanner.c @@ -234,6 +234,7 @@ struct DotKeyword { { ".LINECONT", TOK_LINECONT }, { ".LIST", TOK_LIST }, { ".LISTBYTES", TOK_LISTBYTES }, + { ".LITERAL", TOK_LITERAL }, { ".LOBYTE", TOK_LOBYTE }, { ".LOBYTES", TOK_LOBYTES }, { ".LOCAL", TOK_LOCAL }, diff --git a/src/ca65/token.h b/src/ca65/token.h index a94254bfd..02fc8d491 100644 --- a/src/ca65/token.h +++ b/src/ca65/token.h @@ -210,6 +210,7 @@ typedef enum token_t { TOK_LINECONT, TOK_LIST, TOK_LISTBYTES, + TOK_LITERAL, TOK_LOBYTE, TOK_LOBYTES, TOK_LOCAL, From f272bc8f42ebe26b7bab8e44665957eb690dfcf3 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 19 Apr 2021 15:50:52 +0200 Subject: [PATCH 29/44] Removed non-ASCII chars. --- asminc/joy-kernel.inc | 2 +- include/fcntl.h | 2 +- include/mouse/mouse-kernel.h | 2 +- include/signal.h | 2 +- src/ar65/error.c | 2 +- src/ca65/enum.h | 2 +- src/ca65/struct.h | 2 +- src/cc65/loadexpr.h | 2 +- src/cc65/loop.c | 2 +- src/cc65/loop.h | 2 +- src/cc65/preproc.h | 2 +- src/cc65/shiftexpr.h | 2 +- src/cc65/stackptr.c | 2 +- src/cc65/stackptr.h | 2 +- src/cc65/testexpr.c | 2 +- src/common/inline.h | 2 +- src/common/strstack.c | 2 +- src/common/strstack.h | 2 +- src/common/xmalloc.h | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/asminc/joy-kernel.inc b/asminc/joy-kernel.inc index ef729fe3c..791934197 100644 --- a/asminc/joy-kernel.inc +++ b/asminc/joy-kernel.inc @@ -7,7 +7,7 @@ ;/* */ ;/* */ ;/* (C) 2002-2006, Ullrich von Bassewitz */ -;/* Römerstraße 52 */ +;/* Roemerstrasse 52 */ ;/* D-70794 Filderstadt */ ;/* EMail: uz@cc65.org */ ;/* */ diff --git a/include/fcntl.h b/include/fcntl.h index 0d2398315..a1121159d 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2004 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/include/mouse/mouse-kernel.h b/include/mouse/mouse-kernel.h index f024b0926..e2d2ced10 100644 --- a/include/mouse/mouse-kernel.h +++ b/include/mouse/mouse-kernel.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003-2006, Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/include/signal.h b/include/signal.h index 5cb63fcae..0d5f6ad09 100644 --- a/include/signal.h +++ b/include/signal.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2002-2005, Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/ar65/error.c b/src/ar65/error.c index 47ee90aa5..7f1e0f611 100644 --- a/src/ar65/error.c +++ b/src/ar65/error.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/ca65/enum.h b/src/ca65/enum.h index 7d73a97b8..b954588dd 100644 --- a/src/ca65/enum.h +++ b/src/ca65/enum.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/ca65/struct.h b/src/ca65/struct.h index 1fdaf9d60..e927c477c 100644 --- a/src/ca65/struct.h +++ b/src/ca65/struct.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/cc65/loadexpr.h b/src/cc65/loadexpr.h index 3f13311f1..c9e70e1f6 100644 --- a/src/cc65/loadexpr.h +++ b/src/cc65/loadexpr.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2004 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/cc65/loop.c b/src/cc65/loop.c index f6c53ddc4..cc8ccdec9 100644 --- a/src/cc65/loop.c +++ b/src/cc65/loop.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2004 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/cc65/loop.h b/src/cc65/loop.h index fa2859f61..1174443b4 100644 --- a/src/cc65/loop.h +++ b/src/cc65/loop.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2004 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/cc65/preproc.h b/src/cc65/preproc.h index 1487179f4..78a91a590 100644 --- a/src/cc65/preproc.h +++ b/src/cc65/preproc.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2004 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/cc65/shiftexpr.h b/src/cc65/shiftexpr.h index 2a000fd58..1f1a8c283 100644 --- a/src/cc65/shiftexpr.h +++ b/src/cc65/shiftexpr.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2004 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/cc65/stackptr.c b/src/cc65/stackptr.c index 1f10e8500..1381d68b4 100644 --- a/src/cc65/stackptr.c +++ b/src/cc65/stackptr.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2004-2006 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/cc65/stackptr.h b/src/cc65/stackptr.h index 4f90f8dcc..4e5ea732e 100644 --- a/src/cc65/stackptr.h +++ b/src/cc65/stackptr.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2004-2006 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/cc65/testexpr.c b/src/cc65/testexpr.c index 243f3ebf9..bad8b95f1 100644 --- a/src/cc65/testexpr.c +++ b/src/cc65/testexpr.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2004 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/common/inline.h b/src/common/inline.h index b90b3d1f4..2453547ac 100644 --- a/src/common/inline.h +++ b/src/common/inline.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2001-2005 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/common/strstack.c b/src/common/strstack.c index 508af178e..29dd10426 100644 --- a/src/common/strstack.c +++ b/src/common/strstack.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2004 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/common/strstack.h b/src/common/strstack.h index d29a47993..b0ff22bfb 100644 --- a/src/common/strstack.h +++ b/src/common/strstack.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2004 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/common/xmalloc.h b/src/common/xmalloc.h index eb196b6a1..fc919a16f 100644 --- a/src/common/xmalloc.h +++ b/src/common/xmalloc.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2000-2006 Ullrich von Bassewitz */ -/* Römerstraße 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ From 5d84a4ba137e32163390ccd058c32ad169b4ca94 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 19 Apr 2021 16:06:10 +0200 Subject: [PATCH 30/44] Removed non-ASCII chars. --- asminc/em-kernel.inc | 2 +- asminc/ser-kernel.inc | 2 +- asminc/stdio.inc | 2 +- asminc/utsname.inc | 2 +- include/_ted.h | 2 +- include/cbm264.h | 2 +- include/locale.h | 2 +- include/peekpoke.h | 2 +- include/plus4.h | 2 +- include/stdarg.h | 2 +- include/sys/stat.h | 2 +- include/sys/types.h | 2 +- libsrc/common/_poserror.c | 2 +- src/ar65/error.h | 2 +- src/ca65/ea.h | 2 +- src/ca65/ea65.h | 2 +- src/ca65/easw16.h | 2 +- src/cc65/assignment.h | 2 +- src/cc65/coptadd.c | 2 +- src/cc65/coptsub.c | 2 +- src/cl65/error.h | 2 +- src/co65/convert.h | 2 +- src/co65/error.c | 2 +- src/co65/error.h | 2 +- src/co65/fileio.c | 2 +- src/co65/fileio.h | 2 +- src/co65/global.c | 2 +- src/co65/global.h | 2 +- src/common/fragdefs.h | 2 +- src/common/optdefs.h | 2 +- src/common/segnames.c | 2 +- src/common/segnames.h | 2 +- src/common/va_copy.h | 2 +- src/common/xmalloc.c | 2 +- src/da65/asminc.h | 2 +- src/da65/code.h | 2 +- src/da65/comments.c | 2 +- src/da65/comments.h | 2 +- src/da65/error.h | 2 +- src/da65/global.c | 2 +- src/da65/infofile.h | 2 +- src/da65/opc4510.h | 2 +- src/da65/opc6502.h | 2 +- src/da65/opc65816.h | 2 +- src/da65/opc65c02.h | 2 +- src/da65/opc65sc02.h | 2 +- src/da65/opcdesc.h | 2 +- src/da65/opctable.h | 2 +- src/ld65/dbgfile.h | 2 +- src/ld65/error.h | 2 +- src/ld65/o65.h | 2 +- src/od65/error.h | 2 +- src/od65/fileio.h | 2 +- src/sim65/error.c | 2 +- src/sim65/error.h | 2 +- src/sim65/paravirt.c | 2 +- src/sim65/paravirt.h | 2 +- 57 files changed, 57 insertions(+), 57 deletions(-) diff --git a/asminc/em-kernel.inc b/asminc/em-kernel.inc index e7cdf9a70..889ffba98 100644 --- a/asminc/em-kernel.inc +++ b/asminc/em-kernel.inc @@ -7,7 +7,7 @@ ;/* */ ;/* */ ;/* (C) 2002-2003 Ullrich von Bassewitz */ -;/* Römerstrasse 52 */ +;/* Roemerstrasse 52 */ ;/* D-70794 Filderstadt */ ;/* EMail: uz@cc65.org */ ;/* */ diff --git a/asminc/ser-kernel.inc b/asminc/ser-kernel.inc index 546587515..79ace64e9 100644 --- a/asminc/ser-kernel.inc +++ b/asminc/ser-kernel.inc @@ -7,7 +7,7 @@ ;* * ;* * ;*(C) 2003-2006, Ullrich von Bassewitz * -;* Römerstrasse 52 * +;* Roemerstrasse 52 * ;* D-70794 Filderstadt * ;*EMail: uz@cc65.org * ;* * diff --git a/asminc/stdio.inc b/asminc/stdio.inc index 3b22c47f6..c727e8d0b 100644 --- a/asminc/stdio.inc +++ b/asminc/stdio.inc @@ -7,7 +7,7 @@ ;* */ ;* */ ;* (C) 2003-2005, Ullrich von Bassewitz */ -;* Römerstrasse 52 */ +;* Roemerstrasse 52 */ ;* D-70794 Filderstadt */ ;* EMail: uz@cc65.org */ ;* */ diff --git a/asminc/utsname.inc b/asminc/utsname.inc index 6e2289244..2c7052ce1 100644 --- a/asminc/utsname.inc +++ b/asminc/utsname.inc @@ -7,7 +7,7 @@ ;/* */ ;/* */ ;/* (C) 2003 Ullrich von Bassewitz */ -;/* Römerstrasse 52 */ +;/* Roemerstrasse 52 */ ;/* D-70794 Filderstadt */ ;/* EMail: uz@cc65.org */ ;/* */ diff --git a/include/_ted.h b/include/_ted.h index 68b59d706..c2cd0a04e 100644 --- a/include/_ted.h +++ b/include/_ted.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/include/cbm264.h b/include/cbm264.h index 5e8a242a7..a51ee79c5 100644 --- a/include/cbm264.h +++ b/include/cbm264.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/include/locale.h b/include/locale.h index 4134dd5db..3f23e01d2 100644 --- a/include/locale.h +++ b/include/locale.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2005 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/include/peekpoke.h b/include/peekpoke.h index 4c1156ec3..268dbfb98 100644 --- a/include/peekpoke.h +++ b/include/peekpoke.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/include/plus4.h b/include/plus4.h index c8aaf2eaf..325ba7d89 100644 --- a/include/plus4.h +++ b/include/plus4.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2006, Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/include/stdarg.h b/include/stdarg.h index adf73483c..f6a4fe934 100644 --- a/include/stdarg.h +++ b/include/stdarg.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2004 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/include/sys/stat.h b/include/sys/stat.h index c7e003808..d8fc09c75 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/include/sys/types.h b/include/sys/types.h index 9b1e9610f..e75dd7d46 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/libsrc/common/_poserror.c b/libsrc/common/_poserror.c index 95dbfdc9d..2777fee98 100644 --- a/libsrc/common/_poserror.c +++ b/libsrc/common/_poserror.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/ar65/error.h b/src/ar65/error.h index 4052ee3eb..b311287a1 100644 --- a/src/ar65/error.h +++ b/src/ar65/error.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/ca65/ea.h b/src/ca65/ea.h index 9a038047c..d861e9a6c 100644 --- a/src/ca65/ea.h +++ b/src/ca65/ea.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2004 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/ca65/ea65.h b/src/ca65/ea65.h index 066d9b0cc..c5b139572 100644 --- a/src/ca65/ea65.h +++ b/src/ca65/ea65.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/ca65/easw16.h b/src/ca65/easw16.h index 81dfd0fa2..b8b06d466 100644 --- a/src/ca65/easw16.h +++ b/src/ca65/easw16.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2004 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/cc65/assignment.h b/src/cc65/assignment.h index 278c5ef72..b2cc1548b 100644 --- a/src/cc65/assignment.h +++ b/src/cc65/assignment.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2002-2004 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/cc65/coptadd.c b/src/cc65/coptadd.c index 07bd2bf98..bc67f7a74 100644 --- a/src/cc65/coptadd.c +++ b/src/cc65/coptadd.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2001-2005, Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/cc65/coptsub.c b/src/cc65/coptsub.c index 3d75c1f72..08e65fe1d 100644 --- a/src/cc65/coptsub.c +++ b/src/cc65/coptsub.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2001-2006, Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/cl65/error.h b/src/cl65/error.h index b1ff30660..fdf55c758 100644 --- a/src/cl65/error.h +++ b/src/cl65/error.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/co65/convert.h b/src/co65/convert.h index 22ef25424..8c7782ff3 100644 --- a/src/co65/convert.h +++ b/src/co65/convert.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/co65/error.c b/src/co65/error.c index 1c1625207..1fa099c94 100644 --- a/src/co65/error.c +++ b/src/co65/error.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/co65/error.h b/src/co65/error.h index 4fb9d370d..23901e52e 100644 --- a/src/co65/error.h +++ b/src/co65/error.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/co65/fileio.c b/src/co65/fileio.c index 9241797c6..18813d5e4 100644 --- a/src/co65/fileio.c +++ b/src/co65/fileio.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/co65/fileio.h b/src/co65/fileio.h index c5e9a003c..150c4fca7 100644 --- a/src/co65/fileio.h +++ b/src/co65/fileio.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/co65/global.c b/src/co65/global.c index bc9b0099b..405cda7d5 100644 --- a/src/co65/global.c +++ b/src/co65/global.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/co65/global.h b/src/co65/global.h index 29c17ca29..8f1e0c4f8 100644 --- a/src/co65/global.h +++ b/src/co65/global.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/common/fragdefs.h b/src/common/fragdefs.h index c3e589cb2..80dcad491 100644 --- a/src/common/fragdefs.h +++ b/src/common/fragdefs.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/common/optdefs.h b/src/common/optdefs.h index fae517667..95af8ebba 100644 --- a/src/common/optdefs.h +++ b/src/common/optdefs.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/common/segnames.c b/src/common/segnames.c index bb9aac351..ea8a0125a 100644 --- a/src/common/segnames.c +++ b/src/common/segnames.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/common/segnames.h b/src/common/segnames.h index 0d57d6ac3..c4401a302 100644 --- a/src/common/segnames.h +++ b/src/common/segnames.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/common/va_copy.h b/src/common/va_copy.h index 2f56efa1a..4aa2428db 100644 --- a/src/common/va_copy.h +++ b/src/common/va_copy.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2004 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/common/xmalloc.c b/src/common/xmalloc.c index 327d378fe..192e8fadd 100644 --- a/src/common/xmalloc.c +++ b/src/common/xmalloc.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2000-2006 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/asminc.h b/src/da65/asminc.h index bf48710e9..6d58cd155 100644 --- a/src/da65/asminc.h +++ b/src/da65/asminc.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2005 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/code.h b/src/da65/code.h index 0d21e61e1..50e68ebdf 100644 --- a/src/da65/code.h +++ b/src/da65/code.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2000-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/comments.c b/src/da65/comments.c index 64b64ca28..cf0b9d4e9 100644 --- a/src/da65/comments.c +++ b/src/da65/comments.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2006 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/comments.h b/src/da65/comments.h index 1b8bc1771..1d95111a9 100644 --- a/src/da65/comments.h +++ b/src/da65/comments.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2006 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/error.h b/src/da65/error.h index d0221bcc4..8027b3c1f 100644 --- a/src/da65/error.h +++ b/src/da65/error.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2000-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/global.c b/src/da65/global.c index 7df1bd977..e258aecdd 100644 --- a/src/da65/global.c +++ b/src/da65/global.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2000-2006 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/infofile.h b/src/da65/infofile.h index b8b3f53a8..49ddfcd5d 100644 --- a/src/da65/infofile.h +++ b/src/da65/infofile.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2000-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/opc4510.h b/src/da65/opc4510.h index 10735952c..a87254cd1 100644 --- a/src/da65/opc4510.h +++ b/src/da65/opc4510.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/opc6502.h b/src/da65/opc6502.h index c890e241b..f9d03c085 100644 --- a/src/da65/opc6502.h +++ b/src/da65/opc6502.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/opc65816.h b/src/da65/opc65816.h index 12ffc4a37..341fbf085 100644 --- a/src/da65/opc65816.h +++ b/src/da65/opc65816.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/opc65c02.h b/src/da65/opc65c02.h index 38138aa51..aa2fa9756 100644 --- a/src/da65/opc65c02.h +++ b/src/da65/opc65c02.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/opc65sc02.h b/src/da65/opc65sc02.h index 391f425ea..c00a8e91f 100644 --- a/src/da65/opc65sc02.h +++ b/src/da65/opc65sc02.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/opcdesc.h b/src/da65/opcdesc.h index 7913131cd..399a0962d 100644 --- a/src/da65/opcdesc.h +++ b/src/da65/opcdesc.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2000-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/da65/opctable.h b/src/da65/opctable.h index d5c81b216..69a64db9c 100644 --- a/src/da65/opctable.h +++ b/src/da65/opctable.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2000-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/ld65/dbgfile.h b/src/ld65/dbgfile.h index b8e1a534f..cabb60f8a 100644 --- a/src/ld65/dbgfile.h +++ b/src/ld65/dbgfile.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/ld65/error.h b/src/ld65/error.h index b49d8919c..75b8e0bc1 100644 --- a/src/ld65/error.h +++ b/src/ld65/error.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/ld65/o65.h b/src/ld65/o65.h index 2112537ff..68ed94ba7 100644 --- a/src/ld65/o65.h +++ b/src/ld65/o65.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1999-2005 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/od65/error.h b/src/od65/error.h index 8e1469a34..8a3ac0652 100644 --- a/src/od65/error.h +++ b/src/od65/error.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/od65/fileio.h b/src/od65/fileio.h index 068c4d9a3..af5559f6b 100644 --- a/src/od65/fileio.h +++ b/src/od65/fileio.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/sim65/error.c b/src/sim65/error.c index 30d90c700..441b07d2a 100644 --- a/src/sim65/error.c +++ b/src/sim65/error.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2002-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/sim65/error.h b/src/sim65/error.h index cbb785875..ea54fa048 100644 --- a/src/sim65/error.h +++ b/src/sim65/error.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2002-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/sim65/paravirt.c b/src/sim65/paravirt.c index 603a07e9a..e73bd3400 100644 --- a/src/sim65/paravirt.c +++ b/src/sim65/paravirt.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2013-2013 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ diff --git a/src/sim65/paravirt.h b/src/sim65/paravirt.h index 99c28fa02..bfa38e047 100644 --- a/src/sim65/paravirt.h +++ b/src/sim65/paravirt.h @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2013-2013 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ From 080cb1bac9b748810e528db62b74fca9394db4d0 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Fri, 23 Apr 2021 21:52:36 +0200 Subject: [PATCH 31/44] added testcase for issue #1462 --- test/todo/bug1462.c | 67 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 test/todo/bug1462.c diff --git a/test/todo/bug1462.c b/test/todo/bug1462.c new file mode 100644 index 000000000..aec990cde --- /dev/null +++ b/test/todo/bug1462.c @@ -0,0 +1,67 @@ + +/* issue #1462 - Bit-fields are still broken */ + +#include + +typedef struct { + signed int a : 3; + signed int b : 3; + signed int c : 3; +} T; + +int failures = 0; + +void test() +{ + T a = {2, 5, -1}; + T b = {1, 4, -1}; + T m[1] = {{6, 3, -1}}; + T *p = &a; + + a.c += b.a; + p->c += b.b; + m->c += b.c; + + if (a.c != -4) { + ++failures; + } + printf("%d\n", a.c); + + if (p->c != -4) { + ++failures; + } + printf("%d\n", p->c); + + if (m->c != -2) { + ++failures; + } + printf("%d\n", m->c); + + ++a.a; + p->b++; + m->c--; + + if (a.a != 3) { + ++failures; + } + printf("%d\n", a.a); + + if (p->b != -2) { + ++failures; + } + printf("%d\n", p->b); + + if (m->c != -3) { + ++failures; + } + printf("%d\n", m->c); + + printf("Failures: %d\n", failures); +} + +int main(void) +{ + test(); + return failures; +} + From 4866ee53e69767aa911b4ab94738c5430ea98a0a Mon Sep 17 00:00:00 2001 From: Greg King Date: Sat, 24 Apr 2021 13:20:10 -0400 Subject: [PATCH 32/44] Moved some Assembly function descriptions out of the "Control commands" section, and into the "Pseudo functions" section. --- doc/ca65.sgml | 144 +++++++++++++++++++++++++------------------------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/doc/ca65.sgml b/doc/ca65.sgml index f3a3c218f..137404919 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -1353,15 +1353,15 @@ writable. Pseudo functions

-Pseudo functions expect their arguments in parenthesis, and they have a result, -either a string or an expression. +Pseudo functions expect their arguments in parentheses, and they have a result, +either a string or an expression value. .ADDRSIZE

- The .BANK

The or similar functions to address just part of it. - Please note that .BLANK

- Builtin function. The function evaluates its argument in braces and yields + Builtin function. The function evaluates its argument in parentheses and yields "false" if the argument is non blank (there is an argument), and "true" if there is no argument. The token list that makes up the function argument may optionally be enclosed in curly braces. This allows the inclusion of @@ -1479,7 +1479,7 @@ either a string or an expression. .CONST

- Builtin function. The function evaluates its argument in braces and + Builtin function. The function evaluates its argument in parentheses and yields "true" if the argument is a constant expression (that is, an expression that yields a constant value at assembly time) and "false" otherwise. As an example, the .IFCONST statement may be replaced by @@ -1489,6 +1489,41 @@ either a string or an expression. +.DEF, .DEFINED

+ + Builtin function. The function expects an identifier as argument in parentheses. + The argument is evaluated, and the function yields "true" if the identifier + is a symbol that already is defined somewhere in the source file up to the + current position. Otherwise, the function yields false. As an example, the + statement may be replaced by + + + .if .defined(a) + + + +.DEFINEDMACRO

+ + Builtin function. The function expects an identifier as argument in parentheses. + The argument is evaluated, and the function yields "true" if the identifier + already has been defined as the name of a macro. Otherwise, the function yields + false. Example: + + + .macro add foo + clc + adc foo + .endmacro + + .if .definedmacro(add) + add #$01 + .else + clc + adc #$01 + .endif + + + .HIBYTE

The function returns the high byte (that is, bits 8-15) of its argument. @@ -1525,6 +1560,23 @@ either a string or an expression. +.ISMNEM, .ISMNEMONIC

+ + Builtin function. The function expects an identifier as argument in parentheses. + The argument is evaluated, and the function yields "true" if the identifier + is defined as an instruction mnemonic that is recognized by the assembler. + Example: + + + .if .not .ismnemonic(ina) + .macro ina + clc + adc #$01 + .endmacro + .endif + + + .LEFT

Builtin function. Extracts the left part of a given token list. @@ -1719,7 +1771,7 @@ either a string or an expression. .REF, .REFERENCED

- Builtin function. The function expects an identifier as argument in braces. + Builtin function. The function expects an identifier as argument in parentheses. The argument is evaluated, and the function yields "true" if the identifier is a symbol that has already been referenced somewhere in the source file up to the current position. Otherwise the function yields false. As an example, @@ -1865,7 +1917,7 @@ either a string or an expression. .STRING

- Builtin function. The function accepts an argument in braces and converts + Builtin function. The function accepts an argument in parentheses and converts this argument into a string constant. The argument may be an identifier, or a constant numeric value. @@ -1884,7 +1936,7 @@ either a string or an expression. .STRLEN

- Builtin function. The function accepts a string argument in braces and + Builtin function. The function accepts a string argument in parentheses and evaluates to the length of the string. Example: @@ -1901,7 +1953,7 @@ either a string or an expression. .TCOUNT

- Builtin function. The function accepts a token list in braces. The function + Builtin function. The function accepts a token list in parentheses. The function result is the number of tokens given as argument. The token list may optionally be enclosed into curly braces which are not considered part of the list and not counted. Enclosement in curly braces allows the inclusion @@ -2366,7 +2418,7 @@ See: ,,. -.DEF, .DEFINED

- - Builtin function. The function expects an identifier as argument in braces. - The argument is evaluated, and the function yields "true" if the identifier - is a symbol that is already defined somewhere in the source file up to the - current position. Otherwise the function yields false. As an example, the - statement may be replaced by - - - .if .defined(a) - - - -.DEFINEDMACRO

- - Builtin function. The function expects an identifier as argument in braces. - The argument is evaluated, and the function yields "true" if the identifier - has already been defined as the name of a macro. Otherwise the function yields - false. Example: - - - .macro add foo - clc - adc foo - .endmacro - - .if .definedmacro(add) - add #$01 - .else - clc - adc #$01 - .endif - - - .DESTRUCTOR

Export a symbol and mark it as a module destructor. This may be used @@ -3294,23 +3311,6 @@ See: ,

- - Builtin function. The function expects an identifier as argument in braces. - The argument is evaluated, and the function yields "true" if the identifier - is defined as an instruction mnemonic that is recognized by the assembler. - Example: - - - .if .not .ismnemonic(ina) - .macro ina - clc - adc #$01 - .endmacro - .endif - - - .LINECONT

Switch on or off line continuations using the backslash character @@ -4399,8 +4399,8 @@ different: For this macro type, the number of actual parameters must match exactly the number of formal parameters. - To make this possible, formal parameters are enclosed in braces when - defining the macro. If there are no parameters, the empty braces may + To make this possible, formal parameters are enclosed in parentheses when + defining the macro. If there are no parameters, the empty parentheses may be omitted. Since style macros may not @@ -4450,8 +4450,8 @@ Macros with parameters may also be useful: Note that, while formal parameters have to be placed in parentheses, the actual argument used when invoking the macro should not be. -The invoked arguments are separated by commas only, if parentheses are -used by accident they will become part of the replaced token. +The invoked arguments are separated by commas only; if parentheses are +used by accident, they will become part of the replaced token. If you wish to have an expression follow the macro invocation, the last parameter can be enclosed in curly braces {} to indicate the end of that From 1f4ce4184607dcc530db5f7577ae219874079532 Mon Sep 17 00:00:00 2001 From: Greg King Date: Sat, 24 Apr 2021 13:48:42 -0400 Subject: [PATCH 33/44] Fixed the alphabetic sorting of the "Pseudo functions" section. --- doc/ca65.sgml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/doc/ca65.sgml b/doc/ca65.sgml index 137404919..b6d577472 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -1878,24 +1878,6 @@ either a string or an expression value. -.STRAT

- - Builtin function. The function accepts a string and an index as - arguments and returns the value of the character at the given position - as an integer value. The index is zero based. - - Example: - - - .macro M Arg - ; Check if the argument string starts with '#' - .if (.strat (Arg, 0) = '#') - ... - .endif - .endmacro - - - .SPRINTF

Builtin function. It expects a format string as first argument. The number @@ -1915,6 +1897,24 @@ either a string or an expression value. +.STRAT

+ + Builtin function. The function accepts a string and an index as + arguments and returns the value of the character at the given position + as an integer value. The index is zero based. + + Example: + + + .macro M Arg + ; Check if the argument string starts with '#' + .if (.strat (Arg, 0) = '#') + ... + .endif + .endmacro + + + .STRING

Builtin function. The function accepts an argument in parentheses and converts From 71bd6415d6e203f941f200ceb5b8764aafe155fe Mon Sep 17 00:00:00 2001 From: acqn Date: Sat, 17 Apr 2021 16:50:59 +0800 Subject: [PATCH 34/44] No more unnecessary jump-over labels generated for logical OR false cases. --- src/cc65/expr.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index c0a9081f9..bc277f13b 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -3757,7 +3757,6 @@ static void hieOr (ExprDesc *Expr) unsigned Flags = Expr->Flags & E_MASK_KEEP_SUBEXPR; int AndOp; /* Did we have a && operation? */ unsigned TrueLab; /* Jump to this label if true */ - unsigned DoneLab; int HasTrueJump = 0; CodeMark Start; @@ -3884,19 +3883,23 @@ static void hieOr (ExprDesc *Expr) /* If we really had boolean ops, generate the end sequence if necessary */ if (HasTrueJump) { - /* False case needs to jump over true case */ - DoneLab = GetLocalLabel (); if ((Flags & E_EVAL_UNEVAL) != E_EVAL_UNEVAL) { + /* False case needs to jump over true case */ + unsigned DoneLab = GetLocalLabel (); /* Load false only if the result is not true */ g_getimmed (CF_INT | CF_CONST, 0, 0); /* Load FALSE */ g_falsejump (CF_NONE, DoneLab); + + /* Load the true value */ + g_defcodelabel (TrueLab); + g_getimmed (CF_INT | CF_CONST, 1, 0); /* Load TRUE */ + g_defcodelabel (DoneLab); + } else { + /* Load the true value */ + g_defcodelabel (TrueLab); + g_getimmed (CF_INT | CF_CONST, 1, 0); /* Load TRUE */ } - /* Load the true value */ - g_defcodelabel (TrueLab); - g_getimmed (CF_INT | CF_CONST, 1, 0); /* Load TRUE */ - g_defcodelabel (DoneLab); - /* The result is an rvalue in primary */ ED_FinalizeRValLoad (Expr); /* Condition codes are set */ From f3663b8d2e8b1f9d035fd612865379aed23730bd Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 28 Apr 2021 14:21:48 +0200 Subject: [PATCH 35/44] added test for issue #1461 --- test/val/pr1461.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 test/val/pr1461.c diff --git a/test/val/pr1461.c b/test/val/pr1461.c new file mode 100644 index 000000000..dae6b2999 --- /dev/null +++ b/test/val/pr1461.c @@ -0,0 +1,53 @@ + +/* pr#1461 Fixed pointer subtraction in certain very rare cases */ + +#include +#include + +static int err = 0; + +static int a[1], *p; +static unsigned int i1, i2; + +int test1(void) +{ + p = a - (int)a; + printf("a: %p - (int)a: 0x%x = p: %p\n", a, (int)a, p); + printf("i1: 0x%x - i2: 0x%x = p: %p\n", i1, i2, i1 - i2); + if ((int)p != (i1 - i2)) { + printf("-> failed\n"); + return 1; + } + return 0; +} + +int test2(void) +{ + p = p - (int)a; + printf("p: %p - (int)a: 0x%x = p: %p\n", p, (int)a, p); + printf("p: %p - i2: 0x%x = p: %p\n", p, i2, 0x1234 - i2); + if ((int)p != (0x1234 - i2)) { + printf("-> failed\n"); + return 1; + } + return 0; +} + +int main(void) +{ + a[0] = 0x4711; + i1 = (int)a; + i2 = i1 << 1; + + p = (int*)0x1234; + printf("p: %p &a[0]: %p a: %p (int)a: 0x%x i1: 0x%x i2: 0x%x\n", p, &a[0], a, (int)a, i1, i2); + + err += test1(); + + p = (int*)0x1234; + printf("p: %p &a[0]: %p a: %p (int)a: 0x%x i1: 0x%x i2: 0x%x\n", p, &a[0], a, (int)a, i1, i2); + + err += test2(); + + return err; +} From e9a72b2462936fb929617766218b85bc7834c3b6 Mon Sep 17 00:00:00 2001 From: Evgeny Vrublevsky Date: Sat, 24 Apr 2021 16:34:21 +0300 Subject: [PATCH 36/44] Add .REF control command implementation. --- src/ca65/pseudo.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ca65/pseudo.c b/src/ca65/pseudo.c index 7e24d814d..971faf2a8 100644 --- a/src/ca65/pseudo.c +++ b/src/ca65/pseudo.c @@ -1730,6 +1730,18 @@ static void DoPushSeg (void) +static void DoReferenced (void) +/* Mark given symbol as referenced */ +{ + SymEntry* Sym = ParseAnySymName (SYM_ALLOC_NEW); + if (Sym) + { + SymRef (Sym); + } +} + + + static void DoReloc (void) /* Enter relocatable mode */ { @@ -2153,7 +2165,7 @@ static CtrlDesc CtrlCmdTab [] = { { ccNone, DoPushCharmap }, { ccNone, DoPushCPU }, { ccNone, DoPushSeg }, - { ccNone, DoUnexpected }, /* .REFERENCED */ + { ccNone, DoReferenced }, /* .REFERENCED */ { ccNone, DoReloc }, { ccNone, DoRepeat }, { ccNone, DoRes }, From 83e7c372775b8594bd0069116511fcddfbcf98d0 Mon Sep 17 00:00:00 2001 From: Evgeny Vrublevsky Date: Sat, 24 Apr 2021 20:51:11 +0300 Subject: [PATCH 37/44] Use .REFERTO instead of .REF as the command. --- src/ca65/pseudo.c | 5 +++-- src/ca65/scanner.c | 1 + src/ca65/token.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ca65/pseudo.c b/src/ca65/pseudo.c index 971faf2a8..0c9e623a1 100644 --- a/src/ca65/pseudo.c +++ b/src/ca65/pseudo.c @@ -1730,7 +1730,7 @@ static void DoPushSeg (void) -static void DoReferenced (void) +static void DoReferTo (void) /* Mark given symbol as referenced */ { SymEntry* Sym = ParseAnySymName (SYM_ALLOC_NEW); @@ -2165,7 +2165,8 @@ static CtrlDesc CtrlCmdTab [] = { { ccNone, DoPushCharmap }, { ccNone, DoPushCPU }, { ccNone, DoPushSeg }, - { ccNone, DoReferenced }, /* .REFERENCED */ + { ccNone, DoUnexpected }, /* .REFERENCED */ + { ccNone, DoReferTo }, /* .REFERTO */ { ccNone, DoReloc }, { ccNone, DoRepeat }, { ccNone, DoRes }, diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c index 0a7d433b2..2c099a517 100644 --- a/src/ca65/scanner.c +++ b/src/ca65/scanner.c @@ -271,6 +271,7 @@ struct DotKeyword { { ".PUSHSEG", TOK_PUSHSEG }, { ".REF", TOK_REFERENCED }, { ".REFERENCED", TOK_REFERENCED }, + { ".REFERTO", TOK_REFERTO }, { ".RELOC", TOK_RELOC }, { ".REPEAT", TOK_REPEAT }, { ".RES", TOK_RES }, diff --git a/src/ca65/token.h b/src/ca65/token.h index 02fc8d491..b8bbb6d6e 100644 --- a/src/ca65/token.h +++ b/src/ca65/token.h @@ -241,6 +241,7 @@ typedef enum token_t { TOK_PUSHCPU, TOK_PUSHSEG, TOK_REFERENCED, + TOK_REFERTO, TOK_RELOC, TOK_REPEAT, TOK_RES, From 50a58e77067f6653a283ada6c680ef6189593bd0 Mon Sep 17 00:00:00 2001 From: Evgeny Vrublevsky Date: Sat, 24 Apr 2021 21:26:52 +0300 Subject: [PATCH 38/44] Added documentation for the .REFERTO. --- doc/ca65.sgml | 30 +++++++++++++++++++++++++++++- src/ca65/pseudo.c | 3 +-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/doc/ca65.sgml b/doc/ca65.sgml index b6d577472..978aaf159 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -3213,7 +3213,8 @@ See: , + See also: , and + .IMPORT

@@ -3764,6 +3765,33 @@ See: , +.REFERTO

+ + Mark a symbol as referenced. + + It is useful in combination with the + command. A subroutine with two entry points can be created. When the first + entry point is called, it sets some default value as an argument, and falls + through into the second entry point. .REFERTO helps to ensure that + the second part is included into binary when only the first entry point is + actually used from the code. + + Example: + + + .ifref ResetValue ; If this subroutine is used + ResetValue: ; Define it + lda #0 ; Set a default value + .referto SetValue ; Ensure that SetValue will be included + .endif + .ifref SetValue ; If this or previous subroutine is used + SetValue: + sta Value + rts + .endif + + + .RELOC

Switch back to relocatable mode. See the Date: Wed, 28 Apr 2021 21:38:23 +0300 Subject: [PATCH 39/44] Add .REFTO as an alias to .REFERTO. Update the docs related to it. --- doc/ca65.sgml | 17 +++++++++++++++-- src/ca65/scanner.c | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/ca65.sgml b/doc/ca65.sgml index 978aaf159..3fc534066 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -3765,7 +3765,7 @@ See: , -.REFERTO

+.REFERTO, .REFTO

Mark a symbol as referenced. @@ -3779,11 +3779,24 @@ See: , + .ifref NegateValue ; If this subroutine is used + NegateValue: ; Define it + lda #0 + sec + sbc Value + .ifref ResetValue ; If the ResetValue is also used + jmp SetValue ; Jump over it + .else + .refto SetValue ; Ensure that SetValue will be included + .endif + .endif + .ifref ResetValue ; If this subroutine is used ResetValue: ; Define it lda #0 ; Set a default value - .referto SetValue ; Ensure that SetValue will be included + .refto SetValue ; Ensure that SetValue will be included .endif + .ifref SetValue ; If this or previous subroutine is used SetValue: sta Value diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c index 2c099a517..bf0a85183 100644 --- a/src/ca65/scanner.c +++ b/src/ca65/scanner.c @@ -272,6 +272,7 @@ struct DotKeyword { { ".REF", TOK_REFERENCED }, { ".REFERENCED", TOK_REFERENCED }, { ".REFERTO", TOK_REFERTO }, + { ".REFTO", TOK_REFERTO }, { ".RELOC", TOK_RELOC }, { ".REPEAT", TOK_REPEAT }, { ".RES", TOK_RES }, From b9a3c7888822732a0de92741cfe1a3e1b6bb272f Mon Sep 17 00:00:00 2001 From: Marco Aurelio da Costa Date: Mon, 26 Apr 2021 13:30:54 -0300 Subject: [PATCH 40/44] Parse file included inside a macro at definition time --- src/ca65/macro.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/ca65/macro.c b/src/ca65/macro.c index 988493976..56791eb66 100644 --- a/src/ca65/macro.c +++ b/src/ca65/macro.c @@ -510,6 +510,22 @@ void MacDef (unsigned Style) } } + if (CurTok.Tok == TOK_INCLUDE) { + /* Include another file */ + NextTok (); + /* Name must follow */ + if (CurTok.Tok != TOK_STRCON) { + ErrorSkip ("String constant expected"); + } else { + SB_Terminate (&CurTok.SVal); + if (NewInputFile (SB_GetConstBuf (&CurTok.SVal)) == 0) { + /* Error opening the file, skip remainder of line */ + SkipUntilSep (); + } + } + NextTok (); + } + /* Check for a .LOCAL declaration */ if (CurTok.Tok == TOK_LOCAL && Style == MAC_STYLE_CLASSIC) { From 04cd884f8f08e98cd9826287d2d272a23f68510f Mon Sep 17 00:00:00 2001 From: Marco Aurelio da Costa Date: Tue, 27 Apr 2021 08:21:06 -0300 Subject: [PATCH 41/44] Prevent missed .ENDMACRO in included file --- src/ca65/macro.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/ca65/macro.c b/src/ca65/macro.c index 56791eb66..34d87e65f 100644 --- a/src/ca65/macro.c +++ b/src/ca65/macro.c @@ -491,6 +491,23 @@ void MacDef (unsigned Style) */ while (1) { + /* Check for include */ + if (CurTok.Tok == TOK_INCLUDE) { + /* Include another file */ + NextTok (); + /* Name must follow */ + if (CurTok.Tok != TOK_STRCON) { + ErrorSkip ("String constant expected"); + } else { + SB_Terminate (&CurTok.SVal); + if (NewInputFile (SB_GetConstBuf (&CurTok.SVal)) == 0) { + /* Error opening the file, skip remainder of line */ + SkipUntilSep (); + } + } + NextTok (); + } + /* Check for end of macro */ if (Style == MAC_STYLE_CLASSIC) { /* In classic macros, only .endmacro is allowed */ @@ -510,22 +527,6 @@ void MacDef (unsigned Style) } } - if (CurTok.Tok == TOK_INCLUDE) { - /* Include another file */ - NextTok (); - /* Name must follow */ - if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); - } else { - SB_Terminate (&CurTok.SVal); - if (NewInputFile (SB_GetConstBuf (&CurTok.SVal)) == 0) { - /* Error opening the file, skip remainder of line */ - SkipUntilSep (); - } - } - NextTok (); - } - /* Check for a .LOCAL declaration */ if (CurTok.Tok == TOK_LOCAL && Style == MAC_STYLE_CLASSIC) { From 216bb22b20e67f6ab12a74ad3a15f8bc13151c39 Mon Sep 17 00:00:00 2001 From: Greg King Date: Tue, 4 May 2021 11:54:06 -0400 Subject: [PATCH 42/44] Added a special version of a function which uses an absolute addressing mode to access the zero page. The PCEngine needs such operands to be redirected to RAM page $20 explicitly. Fixes #1482; fixes #1483. --- libsrc/common/_printf.s | 49 ++- libsrc/pce/_printf.s | 791 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 814 insertions(+), 26 deletions(-) create mode 100644 libsrc/pce/_printf.s diff --git a/libsrc/common/_printf.s b/libsrc/common/_printf.s index f5d1784ec..840d42127 100644 --- a/libsrc/common/_printf.s +++ b/libsrc/common/_printf.s @@ -3,7 +3,7 @@ ; ; Ullrich von Bassewitz, 2000-10-21 ; - + .include "zeropage.inc" .export __printf @@ -32,8 +32,8 @@ FCount = ptr2 .code ; ---------------------------------------------------------------------------- -; Get one character from the format string and increment the pointer. Will -; return zero in Y. +; Get one character from the format string, and increment the pointer. Will +; return zero in .Y. GetFormatChar: ldy #0 @@ -51,7 +51,7 @@ OutputPadChar: lda PadChar ; ---------------------------------------------------------------------------- -; Call the output function with one character in A +; Call the output function with one character in .A Output1: sta CharArg @@ -92,7 +92,7 @@ GetSignedArg: jmp axlong ; Convert to long ; ---------------------------------------------------------------------------- -; Get a long argument from the argument list. Returns 0 in Y. +; Get a long argument from the argument list. Returns 0 in .Y. GetLongArg: jsr GetIntArg ; Get high word @@ -102,7 +102,7 @@ GetLongArg: ; Run into GetIntArg fetching the low word ; ---------------------------------------------------------------------------- -; Get an integer argument from the argument list. Returns 0 in Y. +; Get an integer argument from the argument list. Returns 0 in .Y. GetIntArg: jsr DecArgList2 @@ -114,7 +114,7 @@ GetIntArg: rts ; ---------------------------------------------------------------------------- -; Read an integer from the format string. Will return zero in Y. +; Read an integer from the format string. Will return zero in .Y. ReadInt: ldy #0 @@ -247,10 +247,10 @@ Save: lda regbank,y sta RegSave,y dey bpl Save + pla ; Restore low byte of ap ; Get the parameters from the stack - pla ; Restore low byte of ap sta ArgList ; Argument list pointer stx ArgList+1 @@ -307,7 +307,7 @@ MainLoop: inc Format+1 ; Calculate, how many characters must be output. Beware: This number may -; be zero. A still contains the low byte of the pointer. +; be zero. .A still contains the low byte of the pointer. @L3: sub FSave sta FCount @@ -343,7 +343,7 @@ MainLoop: ; We're back from out(), or we didn't call it. Check for end of string. -@L4: jsr GetFormatChar ; Get one char, zero in Y +@L4: jsr GetFormatChar ; Get one char, zero in .Y tax ; End of format string reached? bne NotDone ; End not reached @@ -357,7 +357,7 @@ Rest: lda RegSave,x rts ; Still a valid format character. Check for '%' and a '%%' sequence. Output -; anything that is not a format specifier. On intro, Y is zero. +; anything that is not a format specifier. On intro, .Y is zero. NotDone: cmp #'%' @@ -371,7 +371,7 @@ NotDone: ; We have a real format specifier ; Format is: %[flags][width][.precision][mod]type -; Y is zero on entry. +; .Y is zero on entry. FormatSpec: @@ -383,7 +383,7 @@ FormatSpec: dex bpl @L1 -; Start with reading the flags if there are any. X is $FF which is used +; Start with reading the flags if there are any. .X is $FF which is used ; for "true" ReadFlags: @@ -410,7 +410,7 @@ ReadFlags: @L4: jsr IncFormatPtr jmp ReadFlags ; ...and start over -; Done with flags, read the pad char. Y is still zero if we come here. +; Done with flags, read the pad char. .Y is still zero if we come here. ReadPadding: ldx #' ' ; PadChar @@ -421,8 +421,8 @@ ReadPadding: lda (Format),y ; Read current for later @L1: stx PadChar -; Read the width. Even here, Y is still zero. A contains the current character -; from the format string +; Read the width. Even here, .Y is still zero. .A contains the current character +; from the format string. ReadWidth: cmp #'*' @@ -435,7 +435,7 @@ ReadWidth: @L2: sta Width stx Width+1 ; ...and remember in Width -; Read the precision. Even here, Y is still zero. +; Read the precision. Even here, .Y is still zero. sty Prec ; Assume Precision is zero sty Prec+1 @@ -456,7 +456,7 @@ ReadPrec: @L2: sta Prec stx Prec+1 -; Read the modifiers. Y is still zero. +; Read the modifiers. .Y is still zero. ReadMod: lda (Format),y @@ -479,9 +479,9 @@ ReadMod: ; Initialize the argument buffer pointers. We use a static buffer (ArgBuf) to ; assemble strings. A zero page index (BufIdx) is used to keep the current -; write position. A pointer to the buffer (Str) is used to point to the the -; argument in case we will not use the buffer but a user supplied string. -; Y is zero when we come here. +; write position. A pointer to the buffer (Str) is used to point to the +; argument in case we will not use the buffer but a user-supplied string. +; .Y is zero when we come here. DoFormat: sty BufIdx ; Clear BufIdx @@ -490,7 +490,7 @@ DoFormat: ldx #>Buf stx Str+1 -; Skip the current format character, then check it (current char in A) +; Skip the current format character, then check it (current char in .A) jsr IncFormatPtr @@ -777,8 +777,5 @@ ArgLen: .res 2 .data -; Stuff from OutData. Is used as a vector and must be aligned +; Stuff from OutData. Is used as a vector CallOutFunc: jmp $0000 - - - diff --git a/libsrc/pce/_printf.s b/libsrc/pce/_printf.s new file mode 100644 index 000000000..e1d2a1cf4 --- /dev/null +++ b/libsrc/pce/_printf.s @@ -0,0 +1,791 @@ +; +; _printf: Basic layer for all printf type functions. +; +; 2000-10-21, Ullrich von Bassewitz +; 2021-05-04, Greg King +; + + .include "zeropage.inc" + + .export __printf + + .import popax, pushax, pusheax, decsp6, push1, axlong, axulong + .import _ltoa, _ultoa + .import _strlower, _strlen + + .macpack generic + +; ---------------------------------------------------------------------------- +; We will store variables into the register bank in the zeropage. Define +; equates for these variables. + +ArgList = regbank+0 ; Argument list pointer +Format = regbank+2 ; Format string +OutData = regbank+4 ; Function parameters + +; ---------------------------------------------------------------------------- +; Other zero page cells + +Base = ptr1 +FSave = ptr1 +FCount = ptr2 + +.code + +; ---------------------------------------------------------------------------- +; Get one character from the format string, and increment the pointer. Will +; return zero in .Y. + +GetFormatChar: + ldy #0 + lda (Format),y +IncFormatPtr: + inc Format + bne @L1 + inc Format+1 +@L1: rts + +; ---------------------------------------------------------------------------- +; Output a pad character: outfunc (d, &padchar, 1) + +OutputPadChar: + lda PadChar + +; ---------------------------------------------------------------------------- +; Call the output function with one character in .A + +Output1: + sta CharArg + jsr PushOutData + lda #CharArg + jsr pushax + jsr push1 + jmp CallOutFunc ; fout (OutData, &CharArg, 1) + +; ---------------------------------------------------------------------------- +; Decrement the argument list pointer by 2 + +DecArgList2: + lda ArgList + sub #2 + sta ArgList + bcs @L1 + dec ArgList+1 +@L1: rts + +; ---------------------------------------------------------------------------- +; Get an unsigned int or long argument depending on the IsLong flag. + +GetUnsignedArg: + lda IsLong ; Check flag + bne GetLongArg ; Long sets all + jsr GetIntArg ; Get an integer argument + jmp axulong ; Convert to unsigned long + +; ---------------------------------------------------------------------------- +; Get an signed int or long argument depending on the IsLong flag. + +GetSignedArg: + lda IsLong ; Check flag + bne GetLongArg ; Long sets all + jsr GetIntArg ; Get an integer argument + jmp axlong ; Convert to long + +; ---------------------------------------------------------------------------- +; Get a long argument from the argument list. Returns 0 in .Y. + +GetLongArg: + jsr GetIntArg ; Get high word + sta sreg + stx sreg+1 + +; Run into GetIntArg fetching the low word + +; ---------------------------------------------------------------------------- +; Get an integer argument from the argument list. Returns 0 in .Y. + +GetIntArg: + jsr DecArgList2 + ldy #1 + lda (ArgList),y + tax + dey + lda (ArgList),y + rts + +; ---------------------------------------------------------------------------- +; Read an integer from the format string. Will return zero in .Y. + +ReadInt: + ldy #0 + sty ptr1 + sty ptr1+1 ; Start with zero +@Loop: lda (Format),y ; Get format string character + sub #'0' ; Make number from ascii digit + bcc @L9 ; Jump if done + cmp #9+1 + bcs @L9 ; Jump if done + +; Skip the digit character + + jsr IncFormatPtr + +; Add the digit to the value we have in ptr1 + + pha ; Save digit value + lda ptr1 + ldx ptr1+1 + asl ptr1 + rol ptr1+1 ; * 2 + asl ptr1 + rol ptr1+1 ; * 4, assume carry clear + adc ptr1 + sta ptr1 + txa + adc ptr1+1 + sta ptr1+1 ; * 5 + asl ptr1 + rol ptr1+1 ; * 10, assume carry clear + pla + adc ptr1 ; Add digit value + sta ptr1 + bcc @Loop + inc ptr1+1 + bcs @Loop ; Branch always + +; We're done converting + +@L9: lda ptr1 + ldx ptr1+1 ; Load result + rts + + +; ---------------------------------------------------------------------------- +; Put a character into the argument buffer and increment the buffer index + +PutBuf: ldy BufIdx + inc BufIdx + sta Buf,y + rts + +; ---------------------------------------------------------------------------- +; Get a pointer to the current buffer end and push it onto the stack + +PushBufPtr: + lda #Buf + add BufIdx + bcc @L1 + inx +@L1: jmp pushax + +; ---------------------------------------------------------------------------- +; Push OutData onto the software stack + +PushOutData: + lda OutData + ldx OutData+1 + jmp pushax + +; ---------------------------------------------------------------------------- +; Output Width pad characters +; + +PadLoop: + jsr OutputPadChar +OutputPadding: + inc Width + bne PadLoop + inc Width+1 + bne PadLoop + rts + +; ---------------------------------------------------------------------------- +; Output the argument itself: outfunc (d, str, arglen); +; + +OutputArg: + jsr PushOutData + lda Str + ldx Str+1 + jsr pushax + lda ArgLen + ldx ArgLen+1 + jsr pushax + jmp CallOutFunc + +; ---------------------------------------------------------------------------- +; ltoa: Wrapper for _ltoa that pushes all arguments + +ltoa: sty Base ; Save base + jsr pusheax ; Push value + jsr PushBufPtr ; Push the buffer pointer... + lda Base ; Restore base + jmp _ltoa ; ultoa (l, s, base); + + +; ---------------------------------------------------------------------------- +; ultoa: Wrapper for _ultoa that pushes all arguments + +ultoa: sty Base ; Save base + jsr pusheax ; Push value + jsr PushBufPtr ; Push the buffer pointer... + lda Base ; Restore base + jmp _ultoa ; ultoa (l, s, base); + + +; ---------------------------------------------------------------------------- +; + +__printf: + +; Save the register bank variables into the save area + + pha ; Save low byte of ap + ldy #5 + +; The PC-Engine puts the zero-page at $2000. The indexed-by-.Y addressing mode +; doesn't allow zero-page addressing. Therefore, the operand must be redirected +; explicitly. + +Save: lda regbank+$2000,y + sta RegSave,y + dey + bpl Save + pla ; Restore low byte of ap + +; Get the parameters from the stack + + sta ArgList ; Argument list pointer + stx ArgList+1 + + jsr popax ; Format string + sta Format + stx Format+1 + + jsr popax ; Output descriptor + sta OutData + stx OutData+1 + +; Initialize the output counter in the output descriptor to zero + + lda #0 + tay + sta (OutData),y + iny + sta (OutData),y + +; Get the output function from the output descriptor and remember it + + iny + lda (OutData),y + sta CallOutFunc+1 + iny + lda (OutData),y + sta CallOutFunc+2 + +; Start parsing the format string + +MainLoop: + lda Format ; Remember current format pointer + sta FSave + lda Format+1 + sta FSave+1 + + ldy #0 ; Index +@L1: lda (Format),y ; Get next char + beq @L2 ; Jump on end of string + cmp #'%' ; Format spec? + beq @L2 + iny ; Bump pointer + bne @L1 + inc Format+1 ; Bump high byte of pointer + bne @L1 ; Branch always + +; Found a '%' character or end of string. Update the Format pointer so it is +; current (points to this character). + +@L2: tya ; Low byte of offset + add Format + sta Format + bcc @L3 + inc Format+1 + +; Calculate, how many characters must be output. Beware: This number may +; be zero. .A still contains the low byte of the pointer. + +@L3: sub FSave + sta FCount + lda Format+1 + sbc FSave+1 + sta FCount+1 + ora FCount ; Is the result zero? + beq @L4 ; Jump if yes + +; Output the characters that we have until now. To make the call to out +; faster, build the stack frame by hand (don't use pushax) + + jsr decsp6 ; 3 args + ldy #5 + lda OutData+1 + sta (sp),y + dey + lda OutData + sta (sp),y + dey + lda FSave+1 + sta (sp),y + dey + lda FSave + sta (sp),y + dey + lda FCount+1 + sta (sp),y + dey + lda FCount + sta (sp),y + jsr CallOutFunc ; Call the output function + +; We're back from out(), or we didn't call it. Check for end of string. + +@L4: jsr GetFormatChar ; Get one char, zero in .Y + tax ; End of format string reached? + bne NotDone ; End not reached + +; End of format string reached. Restore the zeropage registers and return. + + ldx #5 +Rest: lda RegSave,x + +; The indexed-by-.X addressing mode does allow zero-page addressing. +; Therefore, this operand doesn't need to be redirected explicitly. + + sta regbank,x + dex + bpl Rest + rts + +; Still a valid format character. Check for '%' and a '%%' sequence. Output +; anything that is not a format specifier. On intro, .Y is zero. + +NotDone: + cmp #'%' + bne @L1 + lda (Format),y ; Check for "%%" + cmp #'%' + bne FormatSpec ; Jump if really a format specifier + jsr IncFormatPtr ; Skip the second '%' +@L1: jsr Output1 ; Output the character... + jmp MainLoop ; ...and continue + +; We have a real format specifier +; Format is: %[flags][width][.precision][mod]type +; .Y is zero on entry. + +FormatSpec: + +; Initialize the flags + + lda #0 + ldx #FormatVarSize-1 +@L1: sta FormatVars,x + dex + bpl @L1 + +; Start with reading the flags if there are any. .X is $FF which is used +; for "true" + +ReadFlags: + lda (Format),y ; Get next char... + cmp #'-' + bne @L1 + stx LeftJust + beq @L4 + +@L1: cmp #'+' + bne @L2 + stx AddSign + beq @L4 + +@L2: cmp #' ' + bne @L3 + stx AddBlank + beq @L4 + +@L3: cmp #'#' + bne ReadPadding + stx AltForm + +@L4: jsr IncFormatPtr + jmp ReadFlags ; ...and start over + +; Done with flags, read the pad char. .Y is still zero if we come here. + +ReadPadding: + ldx #' ' ; PadChar + cmp #'0' + bne @L1 + tax ; PadChar is '0' + jsr IncFormatPtr + lda (Format),y ; Read current for later +@L1: stx PadChar + +; Read the width. Even here, .Y is still zero. .A contains the current character +; from the format string. + +ReadWidth: + cmp #'*' + bne @L1 + jsr IncFormatPtr + jsr GetIntArg ; Width is an additional argument + jmp @L2 + +@L1: jsr ReadInt ; Read integer from format string... +@L2: sta Width + stx Width+1 ; ...and remember in Width + +; Read the precision. Even here, .Y is still zero. + + sty Prec ; Assume Precision is zero + sty Prec+1 + lda (Format),y ; Load next format string char + cmp #'.' ; Precision given? + bne ReadMod ; Branch if no precision given + +ReadPrec: + jsr IncFormatPtr ; Skip the '.' + lda (Format),y + cmp #'*' ; Variable precision? + bne @L1 + jsr IncFormatPtr ; Skip the '*' + jsr GetIntArg ; Get integer argument + jmp @L2 + +@L1: jsr ReadInt ; Read integer from format string +@L2: sta Prec + stx Prec+1 + +; Read the modifiers. .Y is still zero. + +ReadMod: + lda (Format),y + cmp #'z' ; size_t - same as unsigned + beq @L2 + cmp #'h' ; short - same as int + beq @L2 + cmp #'t' ; ptrdiff_t - same as int + beq @L2 + cmp #'j' ; intmax_t/uintmax_t - same as long + beq @L1 + cmp #'L' ; long double + beq @L1 + cmp #'l' ; long int + bne DoFormat +@L1: lda #$FF + sta IsLong +@L2: jsr IncFormatPtr + jmp ReadMod + +; Initialize the argument buffer pointers. We use a static buffer (ArgBuf) to +; assemble strings. A zero page index (BufIdx) is used to keep the current +; write position. A pointer to the buffer (Str) is used to point to the +; argument in case we will not use the buffer but a user-supplied string. +; .Y is zero when we come here. + +DoFormat: + sty BufIdx ; Clear BufIdx + ldx #Buf + stx Str+1 + +; Skip the current format character, then check it (current char in .A) + + jsr IncFormatPtr + +; Is it a character? + + cmp #'c' + bne CheckInt + +; It is a character + + jsr GetIntArg ; Get the argument (promoted to int) + sta Buf ; Place it as zero terminated string... + lda #0 + sta Buf+1 ; ...into the buffer + jmp HaveArg ; Done + +; Is it an integer? + +CheckInt: + cmp #'d' + beq @L1 + cmp #'i' + bne CheckCount + +; It is an integer + +@L1: ldx #0 + lda AddBlank ; Add a blank for positives? + beq @L2 ; Jump if no + ldx #' ' +@L2: lda AddSign ; Add a plus for positives (precedence)? + beq @L3 + ldx #'+' +@L3: stx Leader + +; Integer argument + + jsr GetSignedArg ; Get argument as a long + ldy sreg+1 ; Check sign + bmi @Int1 + ldy Leader + beq @Int1 + sty Buf + inc BufIdx + +@Int1: ldy #10 ; Base + jsr ltoa ; Push arguments, call _ltoa + jmp HaveArg + +; Is it a count pseudo format? + +CheckCount: + cmp #'n' + bne CheckOctal + +; It is a count pseudo argument + + jsr GetIntArg + sta ptr1 + stx ptr1+1 ; Get user supplied pointer + ldy #0 + lda (OutData),y ; Low byte of OutData->ccount + sta (ptr1),y + iny + lda (OutData),y ; High byte of OutData->ccount + sta (ptr1),y + jmp MainLoop ; Done + +; Check for an octal digit + +CheckOctal: + cmp #'o' + bne CheckPointer + +; Integer in octal representation + + jsr GetSignedArg ; Get argument as a long + ldy AltForm ; Alternative form? + beq @Oct1 ; Jump if no + pha ; Save low byte of value + stx tmp1 + ora tmp1 + ora sreg + ora sreg+1 + ora Prec + ora Prec+1 ; Check if value or Prec != 0 + beq @Oct1 + lda #'0' + jsr PutBuf + pla ; Restore low byte + +@Oct1: ldy #8 ; Load base + jsr ltoa ; Push arguments, call _ltoa + jmp HaveArg + +; Check for a pointer specifier (%p) + +CheckPointer: + cmp #'p' + bne CheckString + +; It's a pointer. Use %#x conversion + + ldx #0 + stx IsLong ; IsLong = 0; + inx + stx AltForm ; AltForm = 1; + lda #'x' + bne IsHex ; Branch always + +; Check for a string specifier (%s) + +CheckString: + cmp #'s' + bne CheckUnsigned + +; It's a string + + jsr GetIntArg ; Get 16bit argument + sta Str + stx Str+1 + jmp HaveArg + +; Check for an unsigned integer (%u) + +CheckUnsigned: + cmp #'u' + bne CheckHex + +; It's an unsigned integer + + jsr GetUnsignedArg ; Get argument as unsigned long + ldy #10 ; Load base + jsr ultoa ; Push arguments, call _ultoa + jmp HaveArg + +; Check for a hexadecimal integer (%x) + +CheckHex: + cmp #'x' + beq IsHex + cmp #'X' + bne UnknownFormat + +; Hexadecimal integer + +IsHex: pha ; Save the format spec + lda AltForm + beq @L1 + lda #'0' + jsr PutBuf + lda #'X' + jsr PutBuf + +@L1: jsr GetUnsignedArg ; Get argument as an unsigned long + ldy #16 ; Load base + jsr ultoa ; Push arguments, call _ultoa + + pla ; Get the format spec + cmp #'x' ; Lower case? + bne @L2 + lda Str + ldx Str+1 + jsr _strlower ; Make characters lower case +@L2: jmp HaveArg + +; Unknown format character, skip it + +UnknownFormat: + jmp MainLoop + +; We have the argument, do argument string formatting + +HaveArg: + +; ArgLen = strlen (Str); + + lda Str + ldx Str+1 + jsr _strlen ; Get length of argument + sta ArgLen + stx ArgLen+1 + +; if (Prec && Prec < ArgLen) ArgLen = Prec; + + lda Prec + ora Prec+1 + beq @L1 + ldx Prec + cpx ArgLen + lda Prec+1 + tay + sbc ArgLen+1 + bcs @L1 + stx ArgLen + sty ArgLen+1 + +; if (Width > ArgLen) { +; Width -= ArgLen; /* padcount */ +; } else { +; Width = 0; +; } +; Since width is used as a counter below, calculate -(width+1) + +@L1: sec + lda Width + sbc ArgLen + tax + lda Width+1 + sbc ArgLen+1 + bcs @L2 + lda #0 + tax +@L2: eor #$FF + sta Width+1 + txa + eor #$FF + sta Width + +; /* Do padding on the left side if needed */ +; if (!leftjust) { +; /* argument right justified */ +; while (width) { +; fout (d, &padchar, 1); +; --width; +; } +; } + + lda LeftJust + bne @L3 + jsr OutputPadding + +; Output the argument itself + +@L3: jsr OutputArg + +; /* Output right padding bytes if needed */ +; if (leftjust) { +; /* argument left justified */ +; while (width) { +; fout (d, &padchar, 1); +; --width; +; } +; } + + lda LeftJust + beq @L4 + jsr OutputPadding + +; Done, parse next chars from format string + +@L4: jmp MainLoop + + +; ---------------------------------------------------------------------------- +; Local data (all static) + +.bss + +; Save area for the zero page registers +RegSave: .res regbanksize + +; One character argument for OutFunc +CharArg: .byte 0 + +; Format variables +FormatVars: +LeftJust: .byte 0 +AddSign: .byte 0 +AddBlank: .byte 0 +AltForm: .byte 0 +PadChar: .byte 0 +Width: .word 0 +Prec: .word 0 +IsLong: .byte 0 +Leader: .byte 0 +BufIdx: .byte 0 ; Argument string pointer +FormatVarSize = * - FormatVars + +; Argument buffer and pointer +Buf: .res 20 +Str: .word 0 +ArgLen: .res 2 + +.data + +; Stuff from OutData. Is used as a vector +CallOutFunc: jmp $0000 From 0fbf2af09d9cdff1f73a47d79b7735258db4a34b Mon Sep 17 00:00:00 2001 From: mrdudz Date: Fri, 7 May 2021 18:38:26 +0200 Subject: [PATCH 43/44] Fix the warning that is produced for unused functions --- src/cc65/error.c | 2 ++ src/cc65/error.h | 1 + src/cc65/symtab.c | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/src/cc65/error.c b/src/cc65/error.c index 0118d50b8..b1529d0b5 100644 --- a/src/cc65/error.c +++ b/src/cc65/error.c @@ -78,6 +78,7 @@ IntStack WarnUnreachableCode= INTSTACK(1); /* - unreachable code */ IntStack WarnUnusedLabel = INTSTACK(1); /* - unused labels */ IntStack WarnUnusedParam = INTSTACK(1); /* - unused parameters */ IntStack WarnUnusedVar = INTSTACK(1); /* - unused variables */ +IntStack WarnUnusedFunc = INTSTACK(1); /* - unused functions */ /* Map the name of a warning to the intstack that holds its state */ typedef struct WarnMapEntry WarnMapEntry; @@ -97,6 +98,7 @@ static WarnMapEntry WarnMap[] = { { &WarnStructParam, "struct-param" }, { &WarnUnknownPragma, "unknown-pragma" }, { &WarnUnreachableCode, "unreachable-code" }, + { &WarnUnusedFunc, "unused-func" }, { &WarnUnusedLabel, "unused-label" }, { &WarnUnusedParam, "unused-param" }, { &WarnUnusedVar, "unused-var" }, diff --git a/src/cc65/error.h b/src/cc65/error.h index 31c46f513..c4420c434 100644 --- a/src/cc65/error.h +++ b/src/cc65/error.h @@ -75,6 +75,7 @@ extern IntStack WarnUnreachableCode; /* - unreachable code */ extern IntStack WarnUnusedLabel; /* - unused labels */ extern IntStack WarnUnusedParam; /* - unused parameters */ extern IntStack WarnUnusedVar; /* - unused variables */ +extern IntStack WarnUnusedFunc; /* - unused functions */ /* Forward */ struct StrBuf; diff --git a/src/cc65/symtab.c b/src/cc65/symtab.c index 6ec255497..4073a38bc 100644 --- a/src/cc65/symtab.c +++ b/src/cc65/symtab.c @@ -173,6 +173,10 @@ static void CheckSymTable (SymTable* Tab) if (IS_Get (&WarnUnusedParam)) { Warning ("Parameter '%s' is never used", Entry->Name); } + } else if (Flags & SC_FUNC) { + if (IS_Get (&WarnUnusedFunc)) { + Warning ("Function '%s' is defined but never used", Entry->Name); + } } else { if (IS_Get (&WarnUnusedVar)) { Warning ("Variable '%s' is defined but never used", Entry->Name); From 3ea330f15fb3829dcab038647dd930481d51b7d1 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Fri, 7 May 2021 21:32:04 +0200 Subject: [PATCH 44/44] update docs --- doc/cc65.sgml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/cc65.sgml b/doc/cc65.sgml index dc754cb31..ae80b11b0 100644 --- a/doc/cc65.sgml +++ b/doc/cc65.sgml @@ -563,6 +563,8 @@ Here is a description of all the command line options: Warn about #pragmas that aren't recognized by cc65. Warn about unreachable code in cases of comparing constants, etc. + + Warn about unused functions. Warn about unused labels.