From 2d96f79bc732bf5ba36f9dc05cf425aa0e54a9da Mon Sep 17 00:00:00 2001 From: acqn Date: Wed, 1 Dec 2021 09:45:17 +0800 Subject: [PATCH 01/33] Added and used new utility type functions for bit-fields. Fixed GetUnderlyingTypeCode() for bit-fields with widths > 16. --- src/cc65/assignment.c | 34 ++++------------------ src/cc65/datatype.c | 66 ++++++++++++++++++++++++++++++++++++++++--- src/cc65/datatype.h | 6 ++++ src/cc65/expr.c | 4 +-- src/cc65/loadexpr.c | 36 ++++++++++------------- src/cc65/loadexpr.h | 5 +++- 6 files changed, 95 insertions(+), 56 deletions(-) diff --git a/src/cc65/assignment.c b/src/cc65/assignment.c index 05a6d9a96..e6d1e4526 100644 --- a/src/cc65/assignment.c +++ b/src/cc65/assignment.c @@ -156,19 +156,8 @@ void DoIncDecBitField (ExprDesc* Expr, long Val, unsigned KeepResult) unsigned ChunkFlags; const Type* ChunkType; - /* If the bit-field fits within one byte, do the following operations - ** with bytes. - */ - if ((Expr->Type->A.B.Width - 1U) / CHAR_BITS == - (Expr->Type->A.B.Offs + Expr->Type->A.B.Width - 1U) / CHAR_BITS) { - ChunkType = GetUnderlyingType (Expr->Type); - } else { - /* We use the declarartion integer type as the chunk type. - ** Note: A bit-field will not occupy bits located in bytes more than - ** that of its declaration type in cc65. So this is OK. - */ - ChunkType = Expr->Type + 1; - } + /* Determine the type to operate on the whole byte chunk containing the bit-field */ + ChunkType = GetBitFieldChunkType (Expr->Type); /* Determine code generator flags */ Flags = TypeOf (Expr->Type) | CF_FORCECHAR; @@ -254,19 +243,8 @@ static void OpAssignBitField (const GenDesc* Gen, ExprDesc* Expr, const char* Op ED_Init (&Expr2); Expr2.Flags |= Expr->Flags & E_MASK_KEEP_SUBEXPR; - /* If the bit-field fits within one byte, do the following operations - ** with bytes. - */ - if ((Expr->Type->A.B.Width - 1U) / CHAR_BITS == - (Expr->Type->A.B.Offs + Expr->Type->A.B.Width - 1U) / CHAR_BITS) { - ChunkType = GetUnderlyingType (Expr->Type); - } else { - /* We use the declarartion integer type as the chunk type. - ** Note: A bit-field will not occupy bits located in bytes more than - ** that of its declaration type in cc65. So this is OK. - */ - ChunkType = Expr->Type + 1; - } + /* Determine the type to operate on the whole byte chunk containing the bit-field */ + ChunkType = GetBitFieldChunkType (Expr->Type); /* Determine code generator flags */ Flags = TypeOf (Expr->Type) | CF_FORCECHAR; @@ -620,8 +598,8 @@ void OpAssign (const GenDesc* Gen, ExprDesc* Expr, const char* Op) if (IsClassStruct (ltype)) { /* Copy the struct or union by value */ CopyStruct (Expr, &Expr2); - } else if (IsTypeBitField (ltype)) { - /* Special care is needed for bit-field 'op=' */ + } else if (IsTypeFragBitField (ltype)) { + /* Special care is needed for bit-fields if they don't fit in full bytes */ OpAssignBitField (Gen, Expr, Op); } else { /* Normal straight 'op=' */ diff --git a/src/cc65/datatype.c b/src/cc65/datatype.c index cc313bd21..bb7c40476 100644 --- a/src/cc65/datatype.c +++ b/src/cc65/datatype.c @@ -551,6 +551,24 @@ unsigned long GetIntegerTypeMax (const Type* Type) +static unsigned GetBitFieldMinimalTypeSize (unsigned BitWidth) +/* Return the size of the smallest integer type that may have BitWidth bits */ +{ + /* Since all integer types supported in cc65 for bit-fields have sizes that + ** are powers of 2, we can just use this bit-twiddling trick. + */ + unsigned V = (int)(BitWidth - 1U) / (int)CHAR_BITS; + V |= V >> 1; + V |= V >> 2; + V |= V >> 4; + V |= V >> 8; + V |= V >> 16; + + /* Return the result size */ + return V + 1U; +} + + static unsigned TypeOfBySize (unsigned Size) /* Get the code generator replacement type of the object by its size */ { @@ -591,8 +609,7 @@ const Type* GetUnderlyingType (const Type* Type) ** bit-field, instead of the type used in the declaration, the truly ** underlying of the bit-field. */ - unsigned Size = (int)(Type->A.B.Width - 1) / (int)CHAR_BITS + 1; - switch (Size) { + switch (GetBitFieldMinimalTypeSize (Type->A.B.Width)) { case SIZEOF_CHAR: Type = IsSignSigned (Type) ? type_schar : type_uchar; break; case SIZEOF_INT: Type = IsSignSigned (Type) ? type_int : type_uint; break; case SIZEOF_LONG: Type = IsSignSigned (Type) ? type_long : type_ulong; break; @@ -646,8 +663,7 @@ TypeCode GetUnderlyingTypeCode (const Type* Type) ** bit-field, instead of the type used in the declaration, the truly ** underlying of the bit-field. */ - unsigned Size = (int)(Type->A.B.Width - 1) / (int)CHAR_BITS + 1; - switch (Size) { + switch (GetBitFieldMinimalTypeSize (Type->A.B.Width)) { case SIZEOF_CHAR: Underlying = T_CHAR; break; case SIZEOF_INT: Underlying = T_INT; break; case SIZEOF_LONG: Underlying = T_LONG; break; @@ -663,6 +679,39 @@ TypeCode GetUnderlyingTypeCode (const Type* Type) +const Type* GetBitFieldChunkType (const Type* Type) +/* Get the type needed to operate on the byte chunk containing the bit-field */ +{ + unsigned ChunkSize; + if ((Type->A.B.Width - 1U) / CHAR_BITS == + (Type->A.B.Offs + Type->A.B.Width - 1U) / CHAR_BITS) { + /* T bit-field fits within its underlying type */ + return GetUnderlyingType (Type); + } + + ChunkSize = GetBitFieldMinimalTypeSize (Type->A.B.Offs + Type->A.B.Width); + if (ChunkSize < SizeOf (Type + 1)) { + /* The end of the bit-field is offset by some bits so that it requires + ** more bytes to be accessed as a whole than its underlying type does. + ** Note: In cc65 the bit offset is always less than CHAR_BITS. + */ + switch (ChunkSize) { + case SIZEOF_CHAR: return IsSignSigned (Type) ? type_schar : type_uchar; + case SIZEOF_INT: return IsSignSigned (Type) ? type_int : type_uint; + case SIZEOF_LONG: return IsSignSigned (Type) ? type_long : type_ulong; + default: return IsSignSigned (Type) ? type_int : type_uint; + } + } + + /* We can always use the declarartion integer type as the chunk type. + ** Note: A bit-field will not occupy bits located in bytes more than that + ** of its declaration type in cc65. So this is OK. + */ + return Type + 1; +} + + + unsigned SizeOf (const Type* T) /* Compute size of object represented by type array. */ { @@ -1127,6 +1176,15 @@ Type* NewBitFieldType (const Type* T, unsigned BitOffs, unsigned BitWidth) +int IsTypeFragBitField (const Type* T) +/* Return true if this is a bit-field that shares byte space with other fields */ +{ + return IsTypeBitField (T) && + (T->A.B.Offs != 0 || T->A.B.Width != CHAR_BITS * SizeOf (T)); +} + + + int IsClassObject (const Type* T) /* Return true if this is a fully described object type */ { diff --git a/src/cc65/datatype.h b/src/cc65/datatype.h index e36d7c82e..c60023944 100644 --- a/src/cc65/datatype.h +++ b/src/cc65/datatype.h @@ -313,6 +313,9 @@ TypeCode GetUnderlyingTypeCode (const Type* Type); ** Return TCode if it is not scalar. */ +const Type* GetBitFieldChunkType (const Type* Type); +/* Get the type needed to operate on the byte chunk containing the bit-field */ + unsigned SizeOf (const Type* T); /* Compute size of object represented by type array. */ @@ -556,6 +559,9 @@ INLINE int IsTypeBitField (const Type* T) # define IsTypeBitField(T) (IsTypeSignedBitField (T) || IsTypeUnsignedBitField (T)) #endif +int IsTypeFragBitField (const Type* T); +/* Return true if this is a bit-field that shares byte space with other fields */ + #if defined(HAVE_INLINE) INLINE int IsTypeStruct (const Type* T) /* Return true if this is a struct type */ diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 7343702ea..3b3754665 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -398,7 +398,7 @@ static void DoInc (ExprDesc* Expr, unsigned KeepResult) Val = IsTypePtr (Expr->Type) ? CheckedSizeOf (Expr->Type + 1) : 1; /* Special treatment is needed for bit-fields */ - if (IsTypeBitField (Expr->Type)) { + if (IsTypeFragBitField (Expr->Type)) { DoIncDecBitField (Expr, Val, KeepResult); return; } @@ -485,7 +485,7 @@ static void DoDec (ExprDesc* Expr, unsigned KeepResult) Val = IsTypePtr (Expr->Type) ? CheckedSizeOf (Expr->Type + 1) : 1; /* Special treatment is needed for bit-fields */ - if (IsTypeBitField (Expr->Type)) { + if (IsTypeFragBitField (Expr->Type)) { DoIncDecBitField (Expr, -Val, KeepResult); return; } diff --git a/src/cc65/loadexpr.c b/src/cc65/loadexpr.c index a742087b7..4b7f8e279 100644 --- a/src/cc65/loadexpr.c +++ b/src/cc65/loadexpr.c @@ -110,6 +110,8 @@ static void LoadAddress (unsigned Flags, ExprDesc* Expr) void LoadExpr (unsigned Flags, struct ExprDesc* Expr) /* Load an expression into the primary register if it is not already there. +** If Flags contains any CF_TYPEMASK bits, it then overrides the codegen type +** info that would be otherwise taken from the expression type. ** Note: This function can't modify the content in Expr since there are many ** instances of the "GetCodePos + LoadExpr (maybe indirectly) + RemoveCode" ** code pattern here and there which assumes that Expr should be unchanged, @@ -125,32 +127,24 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr) int AdjustBitField = 0; unsigned BitFieldFullWidthFlags = 0; if ((Flags & CF_TYPEMASK) == 0) { - if (IsTypeBitField (Expr->Type)) { - unsigned EndBit = Expr->Type->A.B.Offs + Expr->Type->A.B.Width; - AdjustBitField = Expr->Type->A.B.Offs != 0 || (EndBit != CHAR_BITS && EndBit != INT_BITS); - - /* TODO: This probably needs to be guarded by AdjustBitField when long bit-fields are - ** supported. - */ - Flags |= (EndBit <= CHAR_BITS) ? CF_CHAR : CF_INT; - if (IsSignUnsigned (Expr->Type)) { - Flags |= CF_UNSIGNED; - } + if (IsTypeFragBitField (Expr->Type)) { + /* We need to adjust the bits in this case. */ + AdjustBitField = 1; /* Flags we need operate on the whole bit-field, without CF_FORCECHAR. */ - BitFieldFullWidthFlags = Flags; + BitFieldFullWidthFlags = Flags | TypeOf (Expr->Type); + + /* Flags we need operate on the whole chunk containing the bit-field. */ + Flags |= TypeOf (GetBitFieldChunkType (Expr->Type)); /* If we're adjusting, then only load a char (not an int) and do only char ops; - ** We will clear the high byte in the adjustment. CF_FORCECHAR does nothing if the - ** type is not CF_CHAR. + ** We will clear the high byte in the adjustment. CF_FORCECHAR does nothing if + ** the type is not CF_CHAR; + ** If adjusting, then we're sign extending manually, so do everything unsigned + ** to make shifts faster. */ - if (AdjustBitField) { - /* If adjusting, then we're sign extending manually, so do everything unsigned - ** to make shifts faster. - */ - Flags |= CF_UNSIGNED | CF_FORCECHAR; - BitFieldFullWidthFlags |= CF_UNSIGNED; - } + Flags |= CF_UNSIGNED | CF_FORCECHAR; + BitFieldFullWidthFlags |= CF_UNSIGNED; } else { /* If Expr is an incomplete ESY type, bail out */ if (IsIncompleteESUType (Expr->Type)) { diff --git a/src/cc65/loadexpr.h b/src/cc65/loadexpr.h index c9e70e1f6..90862e33a 100644 --- a/src/cc65/loadexpr.h +++ b/src/cc65/loadexpr.h @@ -55,7 +55,10 @@ struct ExprDesc; void LoadExpr (unsigned Flags, struct ExprDesc* Expr); -/* Load an expression into the primary register if it is not already there. */ +/* Load an expression into the primary register if it is not already there. +** If Flags contains any CF_TYPEMASK bits, it then overrides the codegen type +** info that would be otherwise taken from the expression type. +*/ From 970607cde5c0afc96fd8af35b4fdf27173a2a986 Mon Sep 17 00:00:00 2001 From: acqn Date: Sun, 5 Dec 2021 12:21:01 +0800 Subject: [PATCH 02/33] Optimized g_testbitfield() and g_extractbitfield() with enhanced support for long bit-fields. --- src/cc65/codegen.c | 295 ++++++++++++++++++++++++++++++++++----------- src/cc65/codegen.h | 4 +- 2 files changed, 229 insertions(+), 70 deletions(-) diff --git a/src/cc65/codegen.c b/src/cc65/codegen.c index 5bfc6696b..c79863d0e 100644 --- a/src/cc65/codegen.c +++ b/src/cc65/codegen.c @@ -43,6 +43,7 @@ #include "addrsize.h" #include "check.h" #include "cpu.h" +#include "shift.h" #include "strbuf.h" #include "xmalloc.h" #include "xsprintf.h" @@ -4560,110 +4561,268 @@ void g_initstatic (unsigned InitLabel, unsigned VarLabel, unsigned Size) void g_testbitfield (unsigned Flags, unsigned BitOffs, unsigned BitWidth) -/* Test bit-field in ax. */ +/* Test bit-field in primary. */ { - unsigned EndBit = BitOffs + BitWidth; + /* Since the end is inclusive and cannot be negative here, we subtract 1 from the sum */ + unsigned MSBit = BitOffs + BitWidth - 1U; + unsigned Bytes = MSBit / CHAR_BITS + 1U - BitOffs / CHAR_BITS; + unsigned HeadMask = (0xFF << (BitOffs % CHAR_BITS)) & 0xFF; + unsigned TailMask = ((1U << (MSBit % CHAR_BITS + 1U)) - 1U) & 0xFF; + unsigned UntestedBytes = ((1U << Bytes) - 1U) << (BitOffs / CHAR_BITS); + + /* We don't use these flags for now. Could CF_NOKEEP be potentially interesting? */ + Flags &= ~CF_STYPEMASK; /* If we need to do a test, then we avoid shifting (ASR only shifts one bit at a time, - ** so is slow) and just AND with the appropriate mask, then test the result of that. + ** so is slow) and just AND the head and tail bytes with the appropriate mask, then + ** OR the results with the rest bytes. */ - - /* Avoid overly large shift on host platform. */ - if (EndBit == sizeof (unsigned long) * CHAR_BIT) { - g_and (Flags | CF_CONST, (~0UL << BitOffs)); - } else { - g_and (Flags | CF_CONST, ((1UL << EndBit) - 1) & (~0UL << BitOffs)); + if (Bytes == 1) { + HeadMask = TailMask = HeadMask & TailMask; } - /* TODO: When long bit-fields are supported, an optimization to test only 3 bytes when - ** EndBit <= 24 is possible. - */ - g_test (Flags | CF_CONST); + /* Get the head byte */ + switch (BitOffs / CHAR_BITS) { + case 0: + if (HeadMask == 0xFF && Bytes == 1) { + AddCodeLine ("tax"); + UntestedBytes &= ~0x1; + } + break; + case 1: + if (HeadMask != 0xFF || TailMask == 0xFF) { + AddCodeLine ("txa"); + UntestedBytes &= ~0x2; + } + break; + case 2: + if (HeadMask != 0xFF || TailMask == 0xFF) { + AddCodeLine ("lda sreg"); + UntestedBytes &= ~0x4; + } + break; + case 3: + /* In this case we'd have HeadMask == TailMask and only 1 byte, but anyways... */ + if (HeadMask != 0xFF || TailMask == 0xFF) { + AddCodeLine ("lda sreg+1"); + UntestedBytes &= ~0x8; + } + break; + default: + break; + } + + /* Keep in mind that the head is NOT always "Byte 0" */ + if (HeadMask != 0xFF) { + AddCodeLine ("and #$%02X", HeadMask); + /* Abuse the "Byte 0" flag so that this head content will be saved by the routine */ + UntestedBytes |= 0x1; + } + + /* If there is only 1 byte to test, we have done with it */ + if (Bytes == 1) { + return; + } + + /* Handle the tail byte */ + if (TailMask != 0xFF) { + /* If we have to do any more masking operation, register A will be used for that, + ** and its current content in it must be saved. + */ + if (UntestedBytes & 0x1) { + AddCodeLine ("sta tmp1"); + } + + /* Test the tail byte */ + switch (MSBit / CHAR_BITS) { + case 1: + AddCodeLine ("txa"); + UntestedBytes &= ~0x2; + break; + case 2: + AddCodeLine ("lda sreg"); + UntestedBytes &= ~0x4; + break; + case 3: + AddCodeLine ("lda sreg+1"); + UntestedBytes &= ~0x8; + break; + default: + break; + } + AddCodeLine ("and #$%02X", TailMask); + + if (UntestedBytes & 0x1) { + AddCodeLine ("ora tmp1"); + } + } + + /* OR the rest bytes together, which could never need masking */ + if (UntestedBytes & 0x2) { + AddCodeLine ("stx tmp1"); + AddCodeLine ("ora tmp1"); + } + if (UntestedBytes & 0x4) { + AddCodeLine ("ora sreg"); + } + if (UntestedBytes & 0x8) { + AddCodeLine ("ora sreg+1"); + } } void g_extractbitfield (unsigned Flags, unsigned FullWidthFlags, int IsSigned, unsigned BitOffs, unsigned BitWidth) -/* Extract bits from bit-field in ax. */ +/* Extract bits from bit-field in primary. */ { unsigned EndBit = BitOffs + BitWidth; + unsigned long ZeroExtendMask = 0; /* Zero if we don't need to zero-extend. */ /* Shift right by the bit offset; no code is emitted if BitOffs is zero */ g_asr (Flags | CF_CONST, BitOffs); - /* Since we have now shifted down, we could do char ops when the width fits in a char, but we - ** also need to clear (or set) the high byte since we've been using CF_FORCECHAR up to now. - */ - unsigned Mask = (1U << BitWidth) - 1; - /* To zero-extend, we will and by the width if the field doesn't end on a char or ** int boundary. If it does end on a boundary, then zeros will have already been shifted in, ** but we need to clear the high byte for char. g_and emits no code if the mask is all ones. ** This is here so the signed and unsigned branches can use it. */ - unsigned ZeroExtendMask = 0; /* Zero if we don't need to zero-extend. */ if (EndBit == CHAR_BITS) { /* We need to clear the high byte, since CF_FORCECHAR was set. */ ZeroExtendMask = 0xFF; - } else if (EndBit != INT_BITS) { - ZeroExtendMask = (1U << BitWidth) - 1; + } else if (EndBit != INT_BITS && EndBit != LONG_BITS) { + ZeroExtendMask = shl_l (1UL, BitWidth) - 1UL; } /* Handle signed bit-fields. */ if (IsSigned) { - /* Save .A because the sign-bit test will destroy it. */ - AddCodeLine ("tay"); - - /* Check sign bit */ unsigned SignBitPos = BitWidth - 1U; unsigned SignBitByte = SignBitPos / CHAR_BITS; unsigned SignBitPosInByte = SignBitPos % CHAR_BITS; - unsigned SignBitMask = 1U << SignBitPosInByte; - /* Move the correct byte to .A. This can be only .X for now, - ** but more cases will be needed to support long. - */ - switch (SignBitByte) { - case 0: - break; - case 1: - AddCodeLine ("txa"); - break; - default: - FAIL ("Invalid Byte for sign bit"); - } - - /* Test the sign bit */ - AddCodeLine ("and #$%02X", SignBitMask); - unsigned ZeroExtendLabel = GetLocalLabel (); - AddCodeLine ("beq %s", LocalLabelName (ZeroExtendLabel)); - - /* Get back .A and sign-extend if required; operating on the full result needs - ** to sign-extend into the high byte, too. - */ - AddCodeLine ("tya"); - g_or (FullWidthFlags | CF_CONST, ~Mask); - - /* We can generate a branch, instead of a jump, here because we know - ** that only a few instructions will be put between here and where - ** DoneLabel will be defined. - */ - unsigned DoneLabel = GetLocalLabel (); - g_branch (DoneLabel); - - /* Get back .A, then zero-extend. We need to duplicate the TYA, rather than move it before - ** the branch to share with the other label, because TYA changes some condition codes. - */ - g_defcodelabel (ZeroExtendLabel); - AddCodeLine ("tya"); - - /* Zero the upper bits, the same as the unsigned path. */ if (ZeroExtendMask != 0) { - g_and (FullWidthFlags | CF_CONST, ZeroExtendMask); - } + /* The universal trick is: + ** x = bits & bit_mask + ** m = 1 << (bit_width - 1) + ** r = (x ^ m) - m + ** which works for long as well. + */ - g_defcodelabel (DoneLabel); + if (SignBitByte + 1U == sizeofarg (FullWidthFlags)) { + /* We can just sign-extend on the high byte if it is the only affected one */ + unsigned char SignBitMask = (1UL << SignBitPosInByte) & 0xFF; + unsigned char Mask = ((2UL << (SignBitPos % CHAR_BITS)) - 1UL) & 0xFF; + + /* Move the correct byte to .A */ + switch (SignBitByte) { + case 0: + break; + case 1: + AddCodeLine ("tay"); + AddCodeLine ("txa"); + break; + case 3: + AddCodeLine ("tay"); + AddCodeLine ("lda sreg+1"); + break; + default: + FAIL ("Invalid Byte for sign bit"); + } + + /* Use .A to do the ops on the correct byte */ + AddCodeLine ("and #$%02X", Mask); + AddCodeLine ("eor #$%02X", SignBitMask); + AddCodeLine ("sec"); + AddCodeLine ("sbc #$%02X", SignBitMask); + + /* Move the correct byte from .A */ + switch (SignBitByte) { + case 0: + break; + case 1: + AddCodeLine ("tax"); + AddCodeLine ("tya"); + break; + case 3: + AddCodeLine ("sta sreg+1"); + AddCodeLine ("tya"); + break; + default: + FAIL ("Invalid Byte for sign bit"); + } + } else { + unsigned long SignBitMask = 1UL << SignBitPos; + unsigned long Mask = (2UL << SignBitPos) - 1UL; + g_and (FullWidthFlags | CF_CONST, Mask); + g_xor (FullWidthFlags | CF_CONST, SignBitMask); + g_dec (FullWidthFlags | CF_CONST, SignBitMask); + } + } else { + unsigned char SignBitMask = (1UL << SignBitPosInByte) & 0xFF; + unsigned ZeroExtendLabel = GetLocalLabel (); + + /* Save .A because the sign-bit test will destroy it. */ + AddCodeLine ("tay"); + + /* Move the correct byte to .A */ + switch (SignBitByte) { + case 0: + break; + case 1: + AddCodeLine ("txa"); + break; + case 3: + AddCodeLine ("lda sreg+1"); + break; + default: + FAIL ("Invalid Byte for sign bit"); + } + + /* Test the sign bit */ + AddCodeLine ("and #$%02X", SignBitMask); + AddCodeLine ("beq %s", LocalLabelName (ZeroExtendLabel)); + + if (SignBitByte + 1U == sizeofarg (FullWidthFlags)) { + /* We can just sign-extend on the high byte if it is the only affected one */ + unsigned char Mask = ~((2UL << (SignBitPos % CHAR_BITS)) - 1UL) & 0xFF; + + /* Use .A to do the ops on the correct byte */ + switch (SignBitByte) { + case 0: + AddCodeLine ("tya"); + AddCodeLine ("ora #$%02X", Mask); + /* We could jump over the following tya instead, but that wouldn't be faster + ** than taking this extra tay and then the tya. + */ + AddCodeLine ("tay"); + break; + case 1: + AddCodeLine ("txa"); + AddCodeLine ("ora #$%02X", Mask); + AddCodeLine ("tax"); + break; + case 3: + AddCodeLine ("lda sreg+1"); + AddCodeLine ("ora #$%02X", Mask); + AddCodeLine ("sta sreg+1"); + break; + default: + FAIL ("Invalid Byte for sign bit"); + } + } else { + /* Since we are going to get back .A later anyways, we may just do the op on the + ** higher bytes with whatever content currently in it. + */ + unsigned long Mask = ~((2UL << SignBitPos) - 1UL); + g_or (FullWidthFlags | CF_CONST, Mask); + } + + /* Get back .A. We need to duplicate the TYA, rather than move it before + ** the branch to share with the other label, because TYA changes some condition codes. + */ + g_defcodelabel (ZeroExtendLabel); + AddCodeLine ("tya"); + } } else { /* Unsigned bit-field, needs only zero-extension. */ if (ZeroExtendMask != 0) { diff --git a/src/cc65/codegen.h b/src/cc65/codegen.h index 1de71e7d3..cb62d78bd 100644 --- a/src/cc65/codegen.h +++ b/src/cc65/codegen.h @@ -486,11 +486,11 @@ void g_initstatic (unsigned InitLabel, unsigned VarLabel, unsigned Size); /*****************************************************************************/ void g_testbitfield (unsigned Flags, unsigned BitOffs, unsigned BitWidth); -/* Test bit-field in ax. */ +/* Test bit-field in primary. */ void g_extractbitfield (unsigned Flags, unsigned FullWidthFlags, int IsSigned, unsigned BitOffs, unsigned BitWidth); -/* Extract bits from bit-field in ax. */ +/* Extract bits from bit-field in primary. */ /*****************************************************************************/ /* Switch statement */ From 21858b52e7a7b1574c9bc68a441be1ed983a31c4 Mon Sep 17 00:00:00 2001 From: acqn Date: Mon, 3 Jan 2022 13:10:32 +0800 Subject: [PATCH 03/33] Separated data initializer stuff from declaration stuff. --- src/cc65.vcxproj | 2 + src/cc65/compile.c | 1 + src/cc65/declare.c | 720 --------------------------------------- src/cc65/declare.h | 5 - src/cc65/expr.c | 1 + src/cc65/initdata.c | 800 ++++++++++++++++++++++++++++++++++++++++++++ src/cc65/initdata.h | 61 ++++ src/cc65/locals.c | 1 + 8 files changed, 866 insertions(+), 725 deletions(-) create mode 100644 src/cc65/initdata.c create mode 100644 src/cc65/initdata.h diff --git a/src/cc65.vcxproj b/src/cc65.vcxproj index 14500296d..5cddc1862 100644 --- a/src/cc65.vcxproj +++ b/src/cc65.vcxproj @@ -93,6 +93,7 @@ + @@ -170,6 +171,7 @@ + diff --git a/src/cc65/compile.c b/src/cc65/compile.c index 94dfc3ffb..85c9bd5a4 100644 --- a/src/cc65/compile.c +++ b/src/cc65/compile.c @@ -56,6 +56,7 @@ #include "funcdesc.h" #include "function.h" #include "global.h" +#include "initdata.h" #include "input.h" #include "litpool.h" #include "macrotab.h" diff --git a/src/cc65/declare.c b/src/cc65/declare.c index 017a69874..67e9a1783 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -66,22 +66,6 @@ -/*****************************************************************************/ -/* Data */ -/*****************************************************************************/ - - - -typedef struct StructInitData StructInitData; -struct StructInitData { - unsigned Size; /* Size of struct */ - unsigned Offs; /* Current offset in struct */ - unsigned BitVal; /* Summed up bit-field value */ - unsigned ValBits; /* Valid bits in Val */ -}; - - - /*****************************************************************************/ /* Forwards */ /*****************************************************************************/ @@ -92,9 +76,6 @@ static void ParseTypeSpec (DeclSpec* D, long Default, TypeCode Qualifiers, int* SignednessSpecified); /* Parse a type specifier */ -static unsigned ParseInitInternal (Type* T, int* Braces, int AllowFlexibleMembers); -/* Parse initialization of variables. Return the number of data bytes. */ - /*****************************************************************************/ @@ -2121,704 +2102,3 @@ void CheckEmptyDecl (const DeclSpec* D) Warning ("Useless declaration"); } } - - - -static void SkipInitializer (int BracesExpected) -/* Skip the remainder of an initializer in case of errors. Try to be somewhat -** smart so we don't have too many following errors. -*/ -{ - while (CurTok.Tok != TOK_CEOF && CurTok.Tok != TOK_SEMI && BracesExpected >= 0) { - switch (CurTok.Tok) { - case TOK_RCURLY: --BracesExpected; break; - case TOK_LCURLY: ++BracesExpected; break; - default: break; - } - if (BracesExpected >= 0) { - NextToken (); - } - } -} - - - -static unsigned OpeningCurlyBraces (unsigned BracesNeeded) -/* Accept any number of opening curly braces around an initialization, skip -** them and return the number. If the number of curly braces is less than -** BracesNeeded, issue a warning. -*/ -{ - unsigned BraceCount = 0; - while (CurTok.Tok == TOK_LCURLY) { - ++BraceCount; - NextToken (); - } - if (BraceCount < BracesNeeded) { - Error ("'{' expected"); - } - return BraceCount; -} - - - -static void ClosingCurlyBraces (unsigned BracesExpected) -/* Accept and skip the given number of closing curly braces together with -** an optional comma. Output an error messages, if the input does not contain -** the expected number of braces. -*/ -{ - while (BracesExpected) { - /* TODO: Skip all excess initializers until next closing curly brace */ - if (CurTok.Tok == TOK_RCURLY) { - NextToken (); - } else if (CurTok.Tok == TOK_COMMA && NextTok.Tok == TOK_RCURLY) { - NextToken (); - NextToken (); - } else { - Error ("'}' expected"); - return; - } - --BracesExpected; - } -} - - - -static void DefineData (ExprDesc* Expr) -/* Output a data definition for the given expression */ -{ - switch (ED_GetLoc (Expr)) { - - case E_LOC_NONE: - /* Immediate numeric value with no storage */ - g_defdata (CF_IMM | TypeOf (Expr->Type) | CF_CONST, Expr->IVal, 0); - break; - - case E_LOC_ABS: - /* Absolute numeric address */ - g_defdata (CF_ABSOLUTE | TypeOf (Expr->Type) | CF_CONST, Expr->IVal, 0); - break; - - case E_LOC_GLOBAL: - /* Global variable */ - g_defdata (CF_EXTERNAL, Expr->Name, Expr->IVal); - break; - - case E_LOC_STATIC: - /* Static variable */ - g_defdata (CF_STATIC, Expr->Name, Expr->IVal); - break; - - case E_LOC_LITERAL: - /* Literal in the literal pool */ - g_defdata (CF_LITERAL, Expr->Name, Expr->IVal); - break; - - case E_LOC_REGISTER: - /* Register variable. Taking the address is usually not - ** allowed. - */ - if (IS_Get (&AllowRegVarAddr) == 0) { - Error ("Cannot take the address of a register variable"); - } - g_defdata (CF_REGVAR, Expr->Name, Expr->IVal); - break; - - case E_LOC_CODE: - /* Code label location */ - g_defdata (CF_CODE, Expr->Name, Expr->IVal); - break; - - case E_LOC_STACK: - case E_LOC_PRIMARY: - case E_LOC_EXPR: - Error ("Non constant initializer"); - break; - - default: - Internal ("Unknown constant type: 0x%04X", ED_GetLoc (Expr)); - } -} - - - -static void DefineBitFieldData (StructInitData* SI) -/* Output bit field data */ -{ - /* Ignore if we have no data */ - if (SI->ValBits > 0) { - - /* Output the data */ - g_defdata (CF_CHAR | CF_UNSIGNED | CF_CONST, SI->BitVal, 0); - - /* Update the data from SI and account for the size */ - if (SI->ValBits >= CHAR_BITS) { - SI->BitVal >>= CHAR_BITS; - SI->ValBits -= CHAR_BITS; - } else { - SI->BitVal = 0; - SI->ValBits = 0; - } - SI->Offs += SIZEOF_CHAR; - } -} - - - -static void DefineStrData (Literal* Lit, unsigned Count) -{ - /* Translate into target charset */ - TranslateLiteral (Lit); - - /* Output the data */ - g_defbytes (GetLiteralStr (Lit), Count); -} - - - -static ExprDesc ParseScalarInitInternal (const Type* T) -/* Parse initializaton for scalar data types. This function will not output the -** data but return it in ED. -*/ -{ - /* Optional opening brace */ - unsigned BraceCount = OpeningCurlyBraces (0); - - /* We warn if an initializer for a scalar contains braces, because this is - ** quite unusual and often a sign for some problem in the input. - */ - if (BraceCount > 0) { - Warning ("Braces around scalar initializer"); - } - - /* Get the expression and convert it to the target type */ - ExprDesc ED = NoCodeConstExpr (hie1); - TypeConversion (&ED, T); - - /* Close eventually opening braces */ - ClosingCurlyBraces (BraceCount); - - return ED; -} - - - -static unsigned ParseScalarInit (const Type* T) -/* Parse initializaton for scalar data types. Return the number of data bytes. */ -{ - /* Parse initialization */ - ExprDesc ED = ParseScalarInitInternal (T); - - /* Output the data */ - DefineData (&ED); - - /* Do this anyways for safety */ - DoDeferred (SQP_KEEP_NONE, &ED); - - /* Done */ - return SizeOf (T); -} - - - -static unsigned ParsePointerInit (const Type* T) -/* Parse initializaton for pointer data types. Return the number of data bytes. */ -{ - /* Optional opening brace */ - unsigned BraceCount = OpeningCurlyBraces (0); - - /* Expression */ - ExprDesc ED = NoCodeConstExpr (hie1); - TypeConversion (&ED, T); - - /* Output the data */ - DefineData (&ED); - - /* Do this anyways for safety */ - DoDeferred (SQP_KEEP_NONE, &ED); - - /* Close eventually opening braces */ - ClosingCurlyBraces (BraceCount); - - /* Done */ - return SIZEOF_PTR; -} - - - -static unsigned ParseArrayInit (Type* T, int* Braces, int AllowFlexibleMembers) -/* Parse initializaton for arrays. Return the number of data bytes. */ -{ - int Count; - int HasCurly = 0; - - /* Get the array data */ - Type* ElementType = IndirectModifiable (T); - unsigned ElementSize = SizeOf (ElementType); - long ElementCount = GetElementCount (T); - - /* Special handling for a character array initialized by a literal */ - if (IsClassChar (ElementType) && - (CurTok.Tok == TOK_SCONST || CurTok.Tok == TOK_WCSCONST || - (CurTok.Tok == TOK_LCURLY && - (NextTok.Tok == TOK_SCONST || NextTok.Tok == TOK_WCSCONST)))) { - - /* Char array initialized by string constant */ - int NeedParen; - - /* If we initializer is enclosed in brackets, remember this fact and - ** skip the opening bracket. - */ - NeedParen = (CurTok.Tok == TOK_LCURLY); - if (NeedParen) { - NextToken (); - } - - /* If the array is one too small for the string literal, omit the - ** trailing zero. - */ - Count = GetLiteralSize (CurTok.SVal); - if (ElementCount != UNSPECIFIED && - ElementCount != FLEXIBLE && - Count == ElementCount + 1) { - /* Omit the trailing zero */ - --Count; - } - - /* Output the data */ - DefineStrData (CurTok.SVal, Count); - - /* Skip the string */ - NextToken (); - - /* If the initializer was enclosed in curly braces, we need a closing - ** one. - */ - if (NeedParen) { - ConsumeRCurly (); - } - - } else { - - /* Arrays can be initialized without a pair of curly braces */ - if (*Braces == 0 || CurTok.Tok == TOK_LCURLY) { - /* Consume the opening curly brace */ - HasCurly = ConsumeLCurly (); - *Braces += HasCurly; - } - - /* Initialize the array members */ - Count = 0; - while (CurTok.Tok != TOK_RCURLY) { - /* Flexible array members may not be initialized within - ** an array (because the size of each element may differ - ** otherwise). - */ - ParseInitInternal (ElementType, Braces, 0); - ++Count; - if (CurTok.Tok != TOK_COMMA) - break; - NextToken (); - } - - if (HasCurly) { - /* Closing curly braces */ - ConsumeRCurly (); - } - } - - /* Size of 'void' elements are determined after initialization */ - if (ElementSize == 0) { - ElementSize = SizeOf (ElementType); - } - - if (ElementCount == UNSPECIFIED) { - /* Number of elements determined by initializer */ - SetElementCount (T, Count); - ElementCount = Count; - } else if (ElementCount == FLEXIBLE) { - if (AllowFlexibleMembers) { - /* In non ANSI mode, allow initialization of flexible array - ** members. - */ - ElementCount = Count; - } else { - /* Forbid */ - Error ("Initializing flexible array member is forbidden"); - ElementCount = Count; - } - } else if (Count < ElementCount) { - g_zerobytes ((ElementCount - Count) * ElementSize); - } else if (Count > ElementCount && HasCurly) { - Error ("Excess elements in array initializer"); - } - return ElementCount * ElementSize; -} - - - -static unsigned ParseStructInit (Type* T, int* Braces, int AllowFlexibleMembers) -/* Parse initialization of a struct or union. Return the number of data bytes. */ -{ - SymEntry* Sym; - SymTable* Tab; - StructInitData SI; - int HasCurly = 0; - int SkipComma = 0; - - - /* Fields can be initialized without a pair of curly braces */ - if (*Braces == 0 || CurTok.Tok == TOK_LCURLY) { - /* Consume the opening curly brace */ - HasCurly = ConsumeLCurly (); - *Braces += HasCurly; - } - - /* Get a pointer to the struct entry from the type */ - Sym = GetESUSymEntry (T); - - /* Get the size of the struct from the symbol table entry */ - SI.Size = Sym->V.S.Size; - - /* Check if this struct definition has a field table. If it doesn't, it - ** is an incomplete definition. - */ - Tab = Sym->V.S.SymTab; - if (Tab == 0) { - Error ("Cannot initialize variables with incomplete type"); - /* Try error recovery */ - SkipInitializer (HasCurly); - /* Nothing initialized */ - return 0; - } - - /* Get a pointer to the list of symbols */ - Sym = Tab->SymHead; - - /* Initialize fields */ - SI.Offs = 0; - SI.BitVal = 0; - SI.ValBits = 0; - while (CurTok.Tok != TOK_RCURLY) { - - /* Check for excess elements */ - if (Sym == 0) { - /* Is there just one trailing comma before a closing curly? */ - if (NextTok.Tok == TOK_RCURLY && CurTok.Tok == TOK_COMMA) { - /* Skip comma and exit scope */ - NextToken (); - break; - } - - if (HasCurly) { - Error ("Excess elements in %s initializer", GetBasicTypeName (T)); - SkipInitializer (HasCurly); - } - return SI.Offs; - } - - /* Check for special members that don't consume the initializer */ - if ((Sym->Flags & SC_ALIAS) == SC_ALIAS) { - /* Just skip */ - goto NextMember; - } - - /* This may be an anonymous bit-field, in which case it doesn't - ** have an initializer. - */ - if (SymIsBitField (Sym) && (IsAnonName (Sym->Name))) { - /* Account for the data and output it if we have at least a full - ** word. We may have more if there was storage unit overlap, for - ** example two consecutive 10 bit fields. These will be packed - ** into 3 bytes. - */ - SI.ValBits += Sym->Type->A.B.Width; - /* TODO: Generalize this so any type can be used. */ - CHECK (SI.ValBits <= CHAR_BITS + INT_BITS - 2); - while (SI.ValBits >= CHAR_BITS) { - DefineBitFieldData (&SI); - } - /* Avoid consuming the comma if any */ - goto NextMember; - } - - /* Skip comma this round */ - if (SkipComma) { - NextToken (); - SkipComma = 0; - } - - if (SymIsBitField (Sym)) { - - /* Parse initialization of one field. Bit-fields need a special - ** handling. - */ - ExprDesc ED; - ED_Init (&ED); - unsigned Val; - unsigned Shift; - - /* Calculate the bitmask from the bit-field data */ - unsigned Mask = (1U << Sym->Type->A.B.Width) - 1U; - - /* Safety ... */ - CHECK (Sym->V.Offs * CHAR_BITS + Sym->Type->A.B.Offs == - SI.Offs * CHAR_BITS + SI.ValBits); - - /* Read the data, check for a constant integer, do a range check */ - ED = ParseScalarInitInternal (IntPromotion (Sym->Type)); - if (!ED_IsConstAbsInt (&ED)) { - Error ("Constant initializer expected"); - ED_MakeConstAbsInt (&ED, 1); - } - - /* Truncate the initializer value to the width of the bit-field and check if we lost - ** any useful bits. - */ - Val = (unsigned) ED.IVal & Mask; - if (IsSignUnsigned (Sym->Type)) { - if (ED.IVal < 0 || (unsigned long) ED.IVal != Val) { - Warning ("Implicit truncation from '%s' to '%s : %u' in bit-field initializer" - " changes value from %ld to %u", - GetFullTypeName (ED.Type), GetFullTypeName (Sym->Type), - Sym->Type->A.B.Width, ED.IVal, Val); - } - } else { - /* Sign extend back to full width of host long. */ - unsigned ShiftBits = sizeof (long) * CHAR_BIT - Sym->Type->A.B.Width; - long RestoredVal = asr_l(asl_l (Val, ShiftBits), ShiftBits); - if (ED.IVal != RestoredVal) { - Warning ("Implicit truncation from '%s' to '%s : %u' in bit-field initializer " - "changes value from %ld to %ld", - GetFullTypeName (ED.Type), GetFullTypeName (Sym->Type), - Sym->Type->A.B.Width, ED.IVal, RestoredVal); - } - } - - /* Add the value to the currently stored bit-field value */ - Shift = (Sym->V.Offs - SI.Offs) * CHAR_BITS + Sym->Type->A.B.Offs; - SI.BitVal |= (Val << Shift); - - /* Account for the data and output any full bytes we have. */ - SI.ValBits += Sym->Type->A.B.Width; - /* Make sure unsigned is big enough to hold the value, 22 bits. - ** This is 22 bits because the most we can have is 7 bits left - ** over from the previous OutputBitField call, plus 15 bits - ** from this field. A 16-bit bit-field will always be byte - ** aligned, so will have padding before it. - */ - CHECK (SI.ValBits <= CHAR_BIT * sizeof(SI.BitVal)); - /* TODO: Generalize this so any type can be used. */ - CHECK (SI.ValBits <= CHAR_BITS + INT_BITS - 2); - while (SI.ValBits >= CHAR_BITS) { - DefineBitFieldData (&SI); - } - - } else { - - /* Standard member. We should never have stuff from a - ** bit-field left because an anonymous member was added - ** for padding by ParseStructDecl. - */ - CHECK (SI.ValBits == 0); - - /* Flexible array members may only be initialized if they are - ** the last field (or part of the last struct field). - */ - SI.Offs += ParseInitInternal (Sym->Type, Braces, AllowFlexibleMembers && Sym->NextSym == 0); - } - - /* More initializers? */ - if (CurTok.Tok != TOK_COMMA) { - break; - } - - /* Skip the comma next round */ - SkipComma = 1; - -NextMember: - /* Next member. For unions, only the first one can be initialized */ - if (IsTypeUnion (T)) { - /* Union */ - Sym = 0; - } else { - /* Struct */ - Sym = Sym->NextSym; - } - } - - if (HasCurly) { - /* Consume the closing curly brace */ - ConsumeRCurly (); - } - - /* If we have data from a bit-field left, output it now */ - CHECK (SI.ValBits < CHAR_BITS); - DefineBitFieldData (&SI); - - /* If there are struct fields left, reserve additional storage */ - if (SI.Offs < SI.Size) { - g_zerobytes (SI.Size - SI.Offs); - SI.Offs = SI.Size; - } - - /* Return the actual number of bytes initialized. This number may be - ** larger than sizeof (Struct) if flexible array members are present and - ** were initialized (possible in non ANSI mode). - */ - return SI.Offs; -} - - - -static unsigned ParseVoidInit (Type* T) -/* Parse an initialization of a void variable (special cc65 extension). -** Return the number of bytes initialized. -*/ -{ - unsigned Size; - - /* Opening brace */ - ConsumeLCurly (); - - /* Allow an arbitrary list of values */ - Size = 0; - do { - ExprDesc Expr = NoCodeConstExpr (hie1); - switch (GetUnderlyingTypeCode (&Expr.Type[0])) { - - case T_SCHAR: - case T_UCHAR: - if (ED_IsConstAbsInt (&Expr)) { - /* Make it byte sized */ - Expr.IVal &= 0xFF; - } - DefineData (&Expr); - Size += SIZEOF_CHAR; - break; - - case T_SHORT: - case T_USHORT: - case T_INT: - case T_UINT: - case T_PTR: - case T_ARRAY: - if (ED_IsConstAbsInt (&Expr)) { - /* Make it word sized */ - Expr.IVal &= 0xFFFF; - } - DefineData (&Expr); - Size += SIZEOF_INT; - break; - - case T_LONG: - case T_ULONG: - if (ED_IsConstAbsInt (&Expr)) { - /* Make it dword sized */ - Expr.IVal &= 0xFFFFFFFF; - } - DefineData (&Expr); - Size += SIZEOF_LONG; - break; - - default: - Error ("Illegal type in initialization"); - break; - - } - - if (CurTok.Tok != TOK_COMMA) { - break; - } - NextToken (); - - } while (CurTok.Tok != TOK_RCURLY); - - /* Closing brace */ - ConsumeRCurly (); - - /* Number of bytes determined by initializer */ - if (T->A.U != 0 && T->A.U != Size) { - Error ("'void' array initialized with elements of variant sizes"); - } else { - T->A.U = Size; - } - - /* Return the number of bytes initialized */ - return Size; -} - - - -static unsigned ParseInitInternal (Type* T, int *Braces, int AllowFlexibleMembers) -/* Parse initialization of variables. Return the number of data bytes. */ -{ - switch (GetUnderlyingTypeCode (T)) { - - case T_SCHAR: - case T_UCHAR: - case T_SHORT: - case T_USHORT: - case T_INT: - case T_UINT: - case T_LONG: - case T_ULONG: - case T_FLOAT: - case T_DOUBLE: - return ParseScalarInit (T); - - case T_PTR: - return ParsePointerInit (T); - - case T_ARRAY: - return ParseArrayInit (T, Braces, AllowFlexibleMembers); - - case T_STRUCT: - case T_UNION: - return ParseStructInit (T, Braces, AllowFlexibleMembers); - - case T_ENUM: - /* Incomplete enum type must have already raised errors. - ** Just proceed to consume the value. - */ - return ParseScalarInit (T); - - case T_VOID: - if (IS_Get (&Standard) == STD_CC65) { - /* Special cc65 extension in non-ANSI mode */ - return ParseVoidInit (T); - } - /* FALLTHROUGH */ - - default: - Error ("Illegal type"); - return SIZEOF_CHAR; - - } -} - - - -unsigned ParseInit (Type* T) -/* Parse initialization of variables. Return the number of data bytes. */ -{ - /* Current curly braces layers */ - int Braces = 0; - - /* Parse the initialization. Flexible array members can only be initialized - ** in cc65 mode. - */ - unsigned Size = ParseInitInternal (T, &Braces, IS_Get (&Standard) == STD_CC65); - - /* The initialization may not generate code on global level, because code - ** outside function scope will never get executed. - */ - if (HaveGlobalCode ()) { - Error ("Non constant initializers"); - RemoveGlobalCode (); - } - - /* Return the size needed for the initialization */ - return Size; -} diff --git a/src/cc65/declare.h b/src/cc65/declare.h index 3293a0dcb..2b8b36f1c 100644 --- a/src/cc65/declare.h +++ b/src/cc65/declare.h @@ -114,11 +114,6 @@ void CheckEmptyDecl (const DeclSpec* D); ** warning if not. */ -unsigned ParseInit (Type* T); -/* Parse initialization of variables. Return the number of initialized data -** bytes. -*/ - /* End of declare.h */ diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 3b3754665..0275e61a3 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -25,6 +25,7 @@ #include "funcdesc.h" #include "function.h" #include "global.h" +#include "initdata.h" #include "litpool.h" #include "loadexpr.h" #include "macrotab.h" diff --git a/src/cc65/initdata.c b/src/cc65/initdata.c new file mode 100644 index 000000000..1f8b35ce4 --- /dev/null +++ b/src/cc65/initdata.c @@ -0,0 +1,800 @@ +/*****************************************************************************/ +/* */ +/* initdata.c */ +/* */ +/* Parse and generate initializer data */ +/* */ +/* */ +/* */ +/* (C) 1998-2015, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ +/* warranty. In no event will the authors be held liable for any damages */ +/* arising from the use of this software. */ +/* */ +/* Permission is granted to anyone to use this software for any purpose, */ +/* including commercial applications, and to alter it and redistribute it */ +/* freely, subject to the following restrictions: */ +/* */ +/* 1. The origin of this software must not be misrepresented; you must not */ +/* claim that you wrote the original software. If you use this software */ +/* in a product, an acknowledgment in the product documentation would be */ +/* appreciated but is not required. */ +/* 2. Altered source versions must be plainly marked as such, and must not */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ +/*****************************************************************************/ + + + +#include +#include +#include +#include + +/* common */ +#include "addrsize.h" +#include "mmodel.h" +#include "shift.h" +#include "xmalloc.h" + +/* cc65 */ +#include "anonname.h" +#include "codegen.h" +#include "datatype.h" +#include "declattr.h" +#include "error.h" +#include "expr.h" +#include "exprdesc.h" +#include "funcdesc.h" +#include "function.h" +#include "global.h" +#include "litpool.h" +#include "pragma.h" +#include "scanner.h" +#include "shift.h" +#include "standard.h" +#include "symtab.h" +#include "wrappedcall.h" +#include "typeconv.h" +#include "initdata.h" + + + +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +typedef struct StructInitData StructInitData; +struct StructInitData { + unsigned Size; /* Size of struct */ + unsigned Offs; /* Current offset in struct */ + unsigned BitVal; /* Summed up bit-field value */ + unsigned ValBits; /* Valid bits in Val */ +}; + + + +/*****************************************************************************/ +/* Forwards */ +/*****************************************************************************/ + + + +static unsigned ParseInitInternal (Type* T, int* Braces, int AllowFlexibleMembers); +/* Parse initialization of variables. Return the number of data bytes. */ + + + +/*****************************************************************************/ +/* code */ +/*****************************************************************************/ + + + +static void SkipInitializer (int BracesExpected) +/* Skip the remainder of an initializer in case of errors. Try to be somewhat +** smart so we don't have too many following errors. +*/ +{ + while (CurTok.Tok != TOK_CEOF && CurTok.Tok != TOK_SEMI && BracesExpected >= 0) { + switch (CurTok.Tok) { + case TOK_RCURLY: --BracesExpected; break; + case TOK_LCURLY: ++BracesExpected; break; + default: break; + } + if (BracesExpected >= 0) { + NextToken (); + } + } +} + + + +static unsigned OpeningCurlyBraces (unsigned BracesNeeded) +/* Accept any number of opening curly braces around an initialization, skip +** them and return the number. If the number of curly braces is less than +** BracesNeeded, issue a warning. +*/ +{ + unsigned BraceCount = 0; + while (CurTok.Tok == TOK_LCURLY) { + ++BraceCount; + NextToken (); + } + if (BraceCount < BracesNeeded) { + Error ("'{' expected"); + } + return BraceCount; +} + + + +static void ClosingCurlyBraces (unsigned BracesExpected) +/* Accept and skip the given number of closing curly braces together with +** an optional comma. Output an error messages, if the input does not contain +** the expected number of braces. +*/ +{ + while (BracesExpected) { + /* TODO: Skip all excess initializers until next closing curly brace */ + if (CurTok.Tok == TOK_RCURLY) { + NextToken (); + } else if (CurTok.Tok == TOK_COMMA && NextTok.Tok == TOK_RCURLY) { + NextToken (); + NextToken (); + } else { + Error ("'}' expected"); + return; + } + --BracesExpected; + } +} + + + +static void DefineData (ExprDesc* Expr) +/* Output a data definition for the given expression */ +{ + switch (ED_GetLoc (Expr)) { + + case E_LOC_NONE: + /* Immediate numeric value with no storage */ + g_defdata (CF_IMM | TypeOf (Expr->Type) | CF_CONST, Expr->IVal, 0); + break; + + case E_LOC_ABS: + /* Absolute numeric address */ + g_defdata (CF_ABSOLUTE | TypeOf (Expr->Type) | CF_CONST, Expr->IVal, 0); + break; + + case E_LOC_GLOBAL: + /* Global variable */ + g_defdata (CF_EXTERNAL, Expr->Name, Expr->IVal); + break; + + case E_LOC_STATIC: + /* Static variable */ + g_defdata (CF_STATIC, Expr->Name, Expr->IVal); + break; + + case E_LOC_LITERAL: + /* Literal in the literal pool */ + g_defdata (CF_LITERAL, Expr->Name, Expr->IVal); + break; + + case E_LOC_REGISTER: + /* Register variable. Taking the address is usually not + ** allowed. + */ + if (IS_Get (&AllowRegVarAddr) == 0) { + Error ("Cannot take the address of a register variable"); + } + g_defdata (CF_REGVAR, Expr->Name, Expr->IVal); + break; + + case E_LOC_CODE: + /* Code label location */ + g_defdata (CF_CODE, Expr->Name, Expr->IVal); + break; + + case E_LOC_STACK: + case E_LOC_PRIMARY: + case E_LOC_EXPR: + Error ("Non constant initializer"); + break; + + default: + Internal ("Unknown constant type: 0x%04X", ED_GetLoc (Expr)); + } +} + + + +static void DefineBitFieldData (StructInitData* SI) +/* Output bit field data */ +{ + /* Ignore if we have no data */ + if (SI->ValBits > 0) { + + /* Output the data */ + g_defdata (CF_CHAR | CF_UNSIGNED | CF_CONST, SI->BitVal, 0); + + /* Update the data from SI and account for the size */ + if (SI->ValBits >= CHAR_BITS) { + SI->BitVal >>= CHAR_BITS; + SI->ValBits -= CHAR_BITS; + } else { + SI->BitVal = 0; + SI->ValBits = 0; + } + SI->Offs += SIZEOF_CHAR; + } +} + + + +static void DefineStrData (Literal* Lit, unsigned Count) +{ + /* Translate into target charset */ + TranslateLiteral (Lit); + + /* Output the data */ + g_defbytes (GetLiteralStr (Lit), Count); +} + + + +static ExprDesc ParseScalarInitInternal (const Type* T) +/* Parse initializaton for scalar data types. This function will not output the +** data but return it in ED. +*/ +{ + /* Optional opening brace */ + unsigned BraceCount = OpeningCurlyBraces (0); + + /* We warn if an initializer for a scalar contains braces, because this is + ** quite unusual and often a sign for some problem in the input. + */ + if (BraceCount > 0) { + Warning ("Braces around scalar initializer"); + } + + /* Get the expression and convert it to the target type */ + ExprDesc ED = NoCodeConstExpr (hie1); + TypeConversion (&ED, T); + + /* Close eventually opening braces */ + ClosingCurlyBraces (BraceCount); + + return ED; +} + + + +static unsigned ParseScalarInit (const Type* T) +/* Parse initializaton for scalar data types. Return the number of data bytes. */ +{ + /* Parse initialization */ + ExprDesc ED = ParseScalarInitInternal (T); + + /* Output the data */ + DefineData (&ED); + + /* Do this anyways for safety */ + DoDeferred (SQP_KEEP_NONE, &ED); + + /* Done */ + return SizeOf (T); +} + + + +static unsigned ParsePointerInit (const Type* T) +/* Parse initializaton for pointer data types. Return the number of data bytes. */ +{ + /* Optional opening brace */ + unsigned BraceCount = OpeningCurlyBraces (0); + + /* Expression */ + ExprDesc ED = NoCodeConstExpr (hie1); + TypeConversion (&ED, T); + + /* Output the data */ + DefineData (&ED); + + /* Do this anyways for safety */ + DoDeferred (SQP_KEEP_NONE, &ED); + + /* Close eventually opening braces */ + ClosingCurlyBraces (BraceCount); + + /* Done */ + return SIZEOF_PTR; +} + + + +static unsigned ParseArrayInit (Type* T, int* Braces, int AllowFlexibleMembers) +/* Parse initializaton for arrays. Return the number of data bytes. */ +{ + int Count; + int HasCurly = 0; + + /* Get the array data */ + Type* ElementType = IndirectModifiable (T); + unsigned ElementSize = SizeOf (ElementType); + long ElementCount = GetElementCount (T); + + /* Special handling for a character array initialized by a literal */ + if (IsClassChar (ElementType) && + (CurTok.Tok == TOK_SCONST || CurTok.Tok == TOK_WCSCONST || + (CurTok.Tok == TOK_LCURLY && + (NextTok.Tok == TOK_SCONST || NextTok.Tok == TOK_WCSCONST)))) { + + /* Char array initialized by string constant */ + int NeedParen; + + /* If we initializer is enclosed in brackets, remember this fact and + ** skip the opening bracket. + */ + NeedParen = (CurTok.Tok == TOK_LCURLY); + if (NeedParen) { + NextToken (); + } + + /* If the array is one too small for the string literal, omit the + ** trailing zero. + */ + Count = GetLiteralSize (CurTok.SVal); + if (ElementCount != UNSPECIFIED && + ElementCount != FLEXIBLE && + Count == ElementCount + 1) { + /* Omit the trailing zero */ + --Count; + } + + /* Output the data */ + DefineStrData (CurTok.SVal, Count); + + /* Skip the string */ + NextToken (); + + /* If the initializer was enclosed in curly braces, we need a closing + ** one. + */ + if (NeedParen) { + ConsumeRCurly (); + } + + } else { + + /* Arrays can be initialized without a pair of curly braces */ + if (*Braces == 0 || CurTok.Tok == TOK_LCURLY) { + /* Consume the opening curly brace */ + HasCurly = ConsumeLCurly (); + *Braces += HasCurly; + } + + /* Initialize the array members */ + Count = 0; + while (CurTok.Tok != TOK_RCURLY) { + /* Flexible array members may not be initialized within + ** an array (because the size of each element may differ + ** otherwise). + */ + ParseInitInternal (ElementType, Braces, 0); + ++Count; + if (CurTok.Tok != TOK_COMMA) + break; + NextToken (); + } + + if (HasCurly) { + /* Closing curly braces */ + ConsumeRCurly (); + } + } + + /* Size of 'void' elements are determined after initialization */ + if (ElementSize == 0) { + ElementSize = SizeOf (ElementType); + } + + if (ElementCount == UNSPECIFIED) { + /* Number of elements determined by initializer */ + SetElementCount (T, Count); + ElementCount = Count; + } else if (ElementCount == FLEXIBLE) { + if (AllowFlexibleMembers) { + /* In non ANSI mode, allow initialization of flexible array + ** members. + */ + ElementCount = Count; + } else { + /* Forbid */ + Error ("Initializing flexible array member is forbidden"); + ElementCount = Count; + } + } else if (Count < ElementCount) { + g_zerobytes ((ElementCount - Count) * ElementSize); + } else if (Count > ElementCount && HasCurly) { + Error ("Excess elements in array initializer"); + } + return ElementCount * ElementSize; +} + + + +static unsigned ParseStructInit (Type* T, int* Braces, int AllowFlexibleMembers) +/* Parse initialization of a struct or union. Return the number of data bytes. */ +{ + SymEntry* Sym; + SymTable* Tab; + StructInitData SI; + int HasCurly = 0; + int SkipComma = 0; + + + /* Fields can be initialized without a pair of curly braces */ + if (*Braces == 0 || CurTok.Tok == TOK_LCURLY) { + /* Consume the opening curly brace */ + HasCurly = ConsumeLCurly (); + *Braces += HasCurly; + } + + /* Get a pointer to the struct entry from the type */ + Sym = GetESUSymEntry (T); + + /* Get the size of the struct from the symbol table entry */ + SI.Size = Sym->V.S.Size; + + /* Check if this struct definition has a field table. If it doesn't, it + ** is an incomplete definition. + */ + Tab = Sym->V.S.SymTab; + if (Tab == 0) { + Error ("Cannot initialize variables with incomplete type"); + /* Try error recovery */ + SkipInitializer (HasCurly); + /* Nothing initialized */ + return 0; + } + + /* Get a pointer to the list of symbols */ + Sym = Tab->SymHead; + + /* Initialize fields */ + SI.Offs = 0; + SI.BitVal = 0; + SI.ValBits = 0; + while (CurTok.Tok != TOK_RCURLY) { + + /* Check for excess elements */ + if (Sym == 0) { + /* Is there just one trailing comma before a closing curly? */ + if (NextTok.Tok == TOK_RCURLY && CurTok.Tok == TOK_COMMA) { + /* Skip comma and exit scope */ + NextToken (); + break; + } + + if (HasCurly) { + Error ("Excess elements in %s initializer", GetBasicTypeName (T)); + SkipInitializer (HasCurly); + } + return SI.Offs; + } + + /* Check for special members that don't consume the initializer */ + if ((Sym->Flags & SC_ALIAS) == SC_ALIAS) { + /* Just skip */ + goto NextMember; + } + + /* This may be an anonymous bit-field, in which case it doesn't + ** have an initializer. + */ + if (SymIsBitField (Sym) && (IsAnonName (Sym->Name))) { + /* Account for the data and output it if we have at least a full + ** word. We may have more if there was storage unit overlap, for + ** example two consecutive 10 bit fields. These will be packed + ** into 3 bytes. + */ + SI.ValBits += Sym->Type->A.B.Width; + /* TODO: Generalize this so any type can be used. */ + CHECK (SI.ValBits <= CHAR_BITS + INT_BITS - 2); + while (SI.ValBits >= CHAR_BITS) { + DefineBitFieldData (&SI); + } + /* Avoid consuming the comma if any */ + goto NextMember; + } + + /* Skip comma this round */ + if (SkipComma) { + NextToken (); + SkipComma = 0; + } + + if (SymIsBitField (Sym)) { + + /* Parse initialization of one field. Bit-fields need a special + ** handling. + */ + ExprDesc ED; + ED_Init (&ED); + unsigned Val; + unsigned Shift; + + /* Calculate the bitmask from the bit-field data */ + unsigned Mask = (1U << Sym->Type->A.B.Width) - 1U; + + /* Safety ... */ + CHECK (Sym->V.Offs * CHAR_BITS + Sym->Type->A.B.Offs == + SI.Offs * CHAR_BITS + SI.ValBits); + + /* Read the data, check for a constant integer, do a range check */ + ED = ParseScalarInitInternal (IntPromotion (Sym->Type)); + if (!ED_IsConstAbsInt (&ED)) { + Error ("Constant initializer expected"); + ED_MakeConstAbsInt (&ED, 1); + } + + /* Truncate the initializer value to the width of the bit-field and check if we lost + ** any useful bits. + */ + Val = (unsigned) ED.IVal & Mask; + if (IsSignUnsigned (Sym->Type)) { + if (ED.IVal < 0 || (unsigned long) ED.IVal != Val) { + Warning ("Implicit truncation from '%s' to '%s : %u' in bit-field initializer" + " changes value from %ld to %u", + GetFullTypeName (ED.Type), GetFullTypeName (Sym->Type), + Sym->Type->A.B.Width, ED.IVal, Val); + } + } else { + /* Sign extend back to full width of host long. */ + unsigned ShiftBits = sizeof (long) * CHAR_BIT - Sym->Type->A.B.Width; + long RestoredVal = asr_l(asl_l (Val, ShiftBits), ShiftBits); + if (ED.IVal != RestoredVal) { + Warning ("Implicit truncation from '%s' to '%s : %u' in bit-field initializer " + "changes value from %ld to %ld", + GetFullTypeName (ED.Type), GetFullTypeName (Sym->Type), + Sym->Type->A.B.Width, ED.IVal, RestoredVal); + } + } + + /* Add the value to the currently stored bit-field value */ + Shift = (Sym->V.Offs - SI.Offs) * CHAR_BITS + Sym->Type->A.B.Offs; + SI.BitVal |= (Val << Shift); + + /* Account for the data and output any full bytes we have. */ + SI.ValBits += Sym->Type->A.B.Width; + /* Make sure unsigned is big enough to hold the value, 22 bits. + ** This is 22 bits because the most we can have is 7 bits left + ** over from the previous OutputBitField call, plus 15 bits + ** from this field. A 16-bit bit-field will always be byte + ** aligned, so will have padding before it. + */ + CHECK (SI.ValBits <= CHAR_BIT * sizeof(SI.BitVal)); + /* TODO: Generalize this so any type can be used. */ + CHECK (SI.ValBits <= CHAR_BITS + INT_BITS - 2); + while (SI.ValBits >= CHAR_BITS) { + DefineBitFieldData (&SI); + } + + } else { + + /* Standard member. We should never have stuff from a + ** bit-field left because an anonymous member was added + ** for padding by ParseStructDecl. + */ + CHECK (SI.ValBits == 0); + + /* Flexible array members may only be initialized if they are + ** the last field (or part of the last struct field). + */ + SI.Offs += ParseInitInternal (Sym->Type, Braces, AllowFlexibleMembers && Sym->NextSym == 0); + } + + /* More initializers? */ + if (CurTok.Tok != TOK_COMMA) { + break; + } + + /* Skip the comma next round */ + SkipComma = 1; + +NextMember: + /* Next member. For unions, only the first one can be initialized */ + if (IsTypeUnion (T)) { + /* Union */ + Sym = 0; + } else { + /* Struct */ + Sym = Sym->NextSym; + } + } + + if (HasCurly) { + /* Consume the closing curly brace */ + ConsumeRCurly (); + } + + /* If we have data from a bit-field left, output it now */ + CHECK (SI.ValBits < CHAR_BITS); + DefineBitFieldData (&SI); + + /* If there are struct fields left, reserve additional storage */ + if (SI.Offs < SI.Size) { + g_zerobytes (SI.Size - SI.Offs); + SI.Offs = SI.Size; + } + + /* Return the actual number of bytes initialized. This number may be + ** larger than sizeof (Struct) if flexible array members are present and + ** were initialized (possible in non ANSI mode). + */ + return SI.Offs; +} + + + +static unsigned ParseVoidInit (Type* T) +/* Parse an initialization of a void variable (special cc65 extension). +** Return the number of bytes initialized. +*/ +{ + unsigned Size; + + /* Opening brace */ + ConsumeLCurly (); + + /* Allow an arbitrary list of values */ + Size = 0; + do { + ExprDesc Expr = NoCodeConstExpr (hie1); + switch (GetUnderlyingTypeCode (&Expr.Type[0])) { + + case T_SCHAR: + case T_UCHAR: + if (ED_IsConstAbsInt (&Expr)) { + /* Make it byte sized */ + Expr.IVal &= 0xFF; + } + DefineData (&Expr); + Size += SIZEOF_CHAR; + break; + + case T_SHORT: + case T_USHORT: + case T_INT: + case T_UINT: + case T_PTR: + case T_ARRAY: + if (ED_IsConstAbsInt (&Expr)) { + /* Make it word sized */ + Expr.IVal &= 0xFFFF; + } + DefineData (&Expr); + Size += SIZEOF_INT; + break; + + case T_LONG: + case T_ULONG: + if (ED_IsConstAbsInt (&Expr)) { + /* Make it dword sized */ + Expr.IVal &= 0xFFFFFFFF; + } + DefineData (&Expr); + Size += SIZEOF_LONG; + break; + + default: + Error ("Illegal type in initialization"); + break; + + } + + if (CurTok.Tok != TOK_COMMA) { + break; + } + NextToken (); + + } while (CurTok.Tok != TOK_RCURLY); + + /* Closing brace */ + ConsumeRCurly (); + + /* Number of bytes determined by initializer */ + if (T->A.U != 0 && T->A.U != Size) { + Error ("'void' array initialized with elements of variant sizes"); + } else { + T->A.U = Size; + } + + /* Return the number of bytes initialized */ + return Size; +} + + + +static unsigned ParseInitInternal (Type* T, int *Braces, int AllowFlexibleMembers) +/* Parse initialization of variables. Return the number of data bytes. */ +{ + switch (GetUnderlyingTypeCode (T)) { + + case T_SCHAR: + case T_UCHAR: + case T_SHORT: + case T_USHORT: + case T_INT: + case T_UINT: + case T_LONG: + case T_ULONG: + case T_FLOAT: + case T_DOUBLE: + return ParseScalarInit (T); + + case T_PTR: + return ParsePointerInit (T); + + case T_ARRAY: + return ParseArrayInit (T, Braces, AllowFlexibleMembers); + + case T_STRUCT: + case T_UNION: + return ParseStructInit (T, Braces, AllowFlexibleMembers); + + case T_ENUM: + /* Incomplete enum type must have already raised errors. + ** Just proceed to consume the value. + */ + return ParseScalarInit (T); + + case T_VOID: + if (IS_Get (&Standard) == STD_CC65) { + /* Special cc65 extension in non-ANSI mode */ + return ParseVoidInit (T); + } + /* FALLTHROUGH */ + + default: + Error ("Illegal type"); + return SIZEOF_CHAR; + + } +} + + + +unsigned ParseInit (Type* T) +/* Parse initialization of variables. Return the number of data bytes. */ +{ + /* Current curly braces layers */ + int Braces = 0; + + /* Parse the initialization. Flexible array members can only be initialized + ** in cc65 mode. + */ + unsigned Size = ParseInitInternal (T, &Braces, IS_Get (&Standard) == STD_CC65); + + /* The initialization may not generate code on global level, because code + ** outside function scope will never get executed. + */ + if (HaveGlobalCode ()) { + Error ("Non constant initializers"); + RemoveGlobalCode (); + } + + /* Return the size needed for the initialization */ + return Size; +} diff --git a/src/cc65/initdata.h b/src/cc65/initdata.h new file mode 100644 index 000000000..6fa3f20b3 --- /dev/null +++ b/src/cc65/initdata.h @@ -0,0 +1,61 @@ +/*****************************************************************************/ +/* */ +/* initdata.h */ +/* */ +/* Parse and generate initializer data */ +/* */ +/* */ +/* */ +/* (C) 1998-2009, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ +/* warranty. In no event will the authors be held liable for any damages */ +/* arising from the use of this software. */ +/* */ +/* Permission is granted to anyone to use this software for any purpose, */ +/* including commercial applications, and to alter it and redistribute it */ +/* freely, subject to the following restrictions: */ +/* */ +/* 1. The origin of this software must not be misrepresented; you must not */ +/* claim that you wrote the original software. If you use this software */ +/* in a product, an acknowledgment in the product documentation would be */ +/* appreciated but is not required. */ +/* 2. Altered source versions must be plainly marked as such, and must not */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ +/*****************************************************************************/ + + + +#ifndef INITDATA_H +#define INITDATA_H + + + +/* cc65 */ +#include "datatype.h" + + + +/*****************************************************************************/ +/* Code */ +/*****************************************************************************/ + + + +unsigned ParseInit (Type* T); +/* Parse initialization of variables. Return the number of initialized data +** bytes. +*/ + + + +/* End of initdata.h */ + +#endif diff --git a/src/cc65/locals.c b/src/cc65/locals.c index d3902f329..297994455 100644 --- a/src/cc65/locals.c +++ b/src/cc65/locals.c @@ -46,6 +46,7 @@ #include "expr.h" #include "function.h" #include "global.h" +#include "initdata.h" #include "loadexpr.h" #include "locals.h" #include "stackptr.h" From 4f4487cb032a26478a0ac27fcaf0d29812118d7f Mon Sep 17 00:00:00 2001 From: acqn Date: Tue, 4 Jan 2022 18:23:04 +0800 Subject: [PATCH 04/33] Added supports for long bit-fields. --- src/cc65/datatype.c | 13 +++++++-- src/cc65/declare.c | 10 +++---- src/cc65/initdata.c | 65 +++++++++++++++++++++++++-------------------- 3 files changed, 51 insertions(+), 37 deletions(-) diff --git a/src/cc65/datatype.c b/src/cc65/datatype.c index bb7c40476..e43af238e 100644 --- a/src/cc65/datatype.c +++ b/src/cc65/datatype.c @@ -1016,9 +1016,18 @@ const Type* IntPromotion (const Type* T) */ if (IsTypeBitField (T)) { - /* The standard rule is OK for now as we don't support bit-fields with widths > 16. + /* As we now support long bit-fields, we need modified rules for them: + ** - If an int can represent all values of the bit-field, the bit-field is converted + ** to an int; + ** - Otherwise, if an unsigned int can represent all values of the bit-field, the + ** bit-field is converted to an unsigned int; + ** - Otherwise, the bit-field will have its declared integer type. + ** These rules are borrowed from C++ and seem to be consistent with GCC/Clang's. */ - return T->A.B.Width >= INT_BITS && IsSignUnsigned (T) ? type_uint : type_int; + if (T->A.B.Width > INT_BITS) { + return IsSignUnsigned (T) ? type_ulong : type_long; + } + return T->A.B.Width == INT_BITS && IsSignUnsigned (T) ? type_uint : type_int; } else if (IsTypeChar (T)) { /* An integer can represent all values from either signed or unsigned char, so convert ** chars to int. diff --git a/src/cc65/declare.c b/src/cc65/declare.c index 67e9a1783..7cc7444b6 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -746,12 +746,10 @@ static int ParseFieldWidth (Declaration* D) D->Type[0].C = T_INT; } - /* TODO: This can be relaxed to be any integral type, but - ** ParseStructInit currently supports only up to int. - */ - if (SizeOf (D->Type) > SizeOf (type_uint)) { - /* Only int-sized or smaller types may be used for bit-fields, for now */ - Error ("cc65 currently supports only char-sized and int-sized bit-field types"); + /* We currently support integral types up to long */ + if (SizeOf (D->Type) > SizeOf (type_ulong)) { + /* Only long-sized or smaller types may be used for bit-fields, for now */ + Error ("cc65 currently supports only long-sized and smaller bit-field types"); /* Avoid a diagnostic storm */ D->Type[0].C = T_INT; diff --git a/src/cc65/initdata.c b/src/cc65/initdata.c index 1f8b35ce4..99dacdca9 100644 --- a/src/cc65/initdata.c +++ b/src/cc65/initdata.c @@ -505,13 +505,14 @@ static unsigned ParseStructInit (Type* T, int* Braces, int AllowFlexibleMembers) */ if (SymIsBitField (Sym) && (IsAnonName (Sym->Name))) { /* Account for the data and output it if we have at least a full - ** word. We may have more if there was storage unit overlap, for - ** example two consecutive 10 bit fields. These will be packed - ** into 3 bytes. + ** byte. We may have more if there was storage unit overlap, for + ** example two consecutive 7 bit fields. Those would be packed + ** into 2 bytes. */ SI.ValBits += Sym->Type->A.B.Width; + CHECK (SI.ValBits <= CHAR_BIT * sizeof(SI.BitVal)); /* TODO: Generalize this so any type can be used. */ - CHECK (SI.ValBits <= CHAR_BITS + INT_BITS - 2); + CHECK (SI.ValBits <= LONG_BITS); while (SI.ValBits >= CHAR_BITS) { DefineBitFieldData (&SI); } @@ -530,45 +531,51 @@ static unsigned ParseStructInit (Type* T, int* Braces, int AllowFlexibleMembers) /* Parse initialization of one field. Bit-fields need a special ** handling. */ - ExprDesc ED; - ED_Init (&ED); - unsigned Val; + ExprDesc Field; + ED_Init (&Field); + unsigned long Val; unsigned Shift; /* Calculate the bitmask from the bit-field data */ - unsigned Mask = (1U << Sym->Type->A.B.Width) - 1U; + unsigned long Mask = shl_l (1UL, Sym->Type->A.B.Width) - 1UL; /* Safety ... */ CHECK (Sym->V.Offs * CHAR_BITS + Sym->Type->A.B.Offs == SI.Offs * CHAR_BITS + SI.ValBits); /* Read the data, check for a constant integer, do a range check */ - ED = ParseScalarInitInternal (IntPromotion (Sym->Type)); - if (!ED_IsConstAbsInt (&ED)) { + Field = ParseScalarInitInternal (IntPromotion (Sym->Type)); + if (!ED_IsConstAbsInt (&Field)) { Error ("Constant initializer expected"); - ED_MakeConstAbsInt (&ED, 1); + ED_MakeConstAbsInt (&Field, 1); } /* Truncate the initializer value to the width of the bit-field and check if we lost ** any useful bits. */ - Val = (unsigned) ED.IVal & Mask; + Val = (unsigned long) Field.IVal & Mask; if (IsSignUnsigned (Sym->Type)) { - if (ED.IVal < 0 || (unsigned long) ED.IVal != Val) { - Warning ("Implicit truncation from '%s' to '%s : %u' in bit-field initializer" - " changes value from %ld to %u", - GetFullTypeName (ED.Type), GetFullTypeName (Sym->Type), - Sym->Type->A.B.Width, ED.IVal, Val); + if (Field.IVal < 0 || (unsigned long) Field.IVal != Val) { + Warning (IsSignUnsigned (Field.Type) ? + "Implicit truncation from '%s' to '%s : %u' in bit-field initializer" + " changes value from %lu to %lu" : + "Implicit truncation from '%s' to '%s : %u' in bit-field initializer" + " changes value from %ld to %lu", + GetFullTypeName (Field.Type), GetFullTypeName (Sym->Type), + Sym->Type->A.B.Width, Field.IVal, Val); } } else { /* Sign extend back to full width of host long. */ unsigned ShiftBits = sizeof (long) * CHAR_BIT - Sym->Type->A.B.Width; - long RestoredVal = asr_l(asl_l (Val, ShiftBits), ShiftBits); - if (ED.IVal != RestoredVal) { - Warning ("Implicit truncation from '%s' to '%s : %u' in bit-field initializer " - "changes value from %ld to %ld", - GetFullTypeName (ED.Type), GetFullTypeName (Sym->Type), - Sym->Type->A.B.Width, ED.IVal, RestoredVal); + long RestoredVal = asr_l (asl_l (Val, ShiftBits), ShiftBits); + if (Field.IVal != RestoredVal) { + Warning (IsSignUnsigned (Field.Type) ? + "Implicit truncation from '%s' to '%s : %u' in bit-field initializer" + " changes value from %lu to %ld" : + "Implicit truncation from '%s' to '%s : %u' in bit-field initializer" + " changes value from %ld to %ld", + GetFullTypeName (Field.Type), GetFullTypeName (Sym->Type), + Sym->Type->A.B.Width, Field.IVal, RestoredVal); } } @@ -578,15 +585,15 @@ static unsigned ParseStructInit (Type* T, int* Braces, int AllowFlexibleMembers) /* Account for the data and output any full bytes we have. */ SI.ValBits += Sym->Type->A.B.Width; - /* Make sure unsigned is big enough to hold the value, 22 bits. - ** This is 22 bits because the most we can have is 7 bits left - ** over from the previous OutputBitField call, plus 15 bits - ** from this field. A 16-bit bit-field will always be byte - ** aligned, so will have padding before it. + /* Make sure unsigned is big enough to hold the value, 32 bits. + ** This cannot be more than 32 bits because a 16-bit or 32-bit + ** bit-field will always be byte-aligned with padding before it + ** if there are bits from prior fields that haven't been output + ** yet. */ CHECK (SI.ValBits <= CHAR_BIT * sizeof(SI.BitVal)); /* TODO: Generalize this so any type can be used. */ - CHECK (SI.ValBits <= CHAR_BITS + INT_BITS - 2); + CHECK (SI.ValBits <= LONG_BITS); while (SI.ValBits >= CHAR_BITS) { DefineBitFieldData (&SI); } From 67594cca70e21cf29caf16b1cda065d2b5858814 Mon Sep 17 00:00:00 2001 From: acqn Date: Thu, 3 Mar 2022 16:14:26 +0800 Subject: [PATCH 05/33] Testcases for long bit-fields. --- test/val/{enum-bitfield.c => bitfield-enum.c} | 162 ++++++++- test/val/bitfield-packing-char.c | 278 ++++++++++++++++ test/val/bitfield-packing-long.c | 315 ++++++++++++++++++ test/val/{bitfield.c => bitfield-packing.c} | 18 +- test/val/bitfield-plain.c | 180 ++++++++++ test/val/bitfield-signed.c | 180 ++++++++++ test/val/plain-int-bitfield.c | 63 ---- 7 files changed, 1123 insertions(+), 73 deletions(-) rename test/val/{enum-bitfield.c => bitfield-enum.c} (61%) create mode 100644 test/val/bitfield-packing-char.c create mode 100644 test/val/bitfield-packing-long.c rename test/val/{bitfield.c => bitfield-packing.c} (93%) create mode 100644 test/val/bitfield-plain.c create mode 100644 test/val/bitfield-signed.c delete mode 100644 test/val/plain-int-bitfield.c diff --git a/test/val/enum-bitfield.c b/test/val/bitfield-enum.c similarity index 61% rename from test/val/enum-bitfield.c rename to test/val/bitfield-enum.c index 5669978c9..ce74b062e 100644 --- a/test/val/enum-bitfield.c +++ b/test/val/bitfield-enum.c @@ -1,5 +1,5 @@ /* - Copyright 2020 The cc65 Authors + Copyright 2020-2022 The cc65 Authors This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -247,7 +247,7 @@ static void test_enum_bitfield_char(void) failures++; } if (e8scbf.y != 5) { - printf ("Got e8scbf.y = %d, expected 10.\n", e8scbf.y); + printf ("Got e8scbf.y = %d, expected 5.\n", e8scbf.y); failures++; } if (e8scbf.z != 100) { @@ -273,12 +273,170 @@ static void test_enum_bitfield_char(void) } } +/* Enum with underlying type unsigned long. */ +enum e20ul { + E20UL_10 = 10, + E20UL_1000 = 1000, + E20UL_1000000000 = 1000000000L, +}; + +static struct enum_bitfield_ulong { + enum e20ul x : 4; + enum e20ul y : 16; + enum e20ul z : CHAR_BIT * sizeof (enum e20ul); +} e20ulbf = {E20UL_10, E20UL_1000, E20UL_1000000000}; + +static void test_enum_bitfield_ulong(void) +{ + if (sizeof (struct enum_bitfield_ulong) != 7) { + printf ("Got sizeof(struct enum_bitfield_ulong) = %zu, expected 7.\n", + sizeof(struct enum_bitfield_ulong)); + failures++; + } + + if (e20ulbf.x != 10) { + printf ("Got e20ulbf.x = %u, expected 10.\n", e20ulbf.x); + failures++; + } + if (e20ulbf.y != 1000) { + printf ("Got e20ulbf.y = %u, expected 1000.\n", e20ulbf.y); + failures++; + } + if (e20ulbf.z != 1000000000L) { + printf ("Got e20ulbf.z = %ul, expected 1000000000.\n", e20ulbf.z); + failures++; + } + + e20ulbf.x = 8; + e20ulbf.y = -1; /* Will store 65535. */ + e20ulbf.z = 1048575L; + + if (e20ulbf.x != 8) { + printf ("Got e20ulbf.x = %ld, expected 8.\n", (long)e20ulbf.x); + failures++; + } + + /* Check signedness, should be signed. */ + { + if (e20ulbf.x - 9 >= 0) { + printf ("Got non-negative e20ulbf.x - 9 = %lu, expected negative.\n", (unsigned long)(e20ulbf.x - 9)); + failures++; + } + } + + if (e20ulbf.y != 65535L) { + printf ("Got e20ulbf.y = %ld, expected 65535.\n", (long)e20ulbf.y); + failures++; + } + + /* Check signedness, should be signed. */ + { + if (e20ulbf.y - 65536L >= 0) { + printf ("Got non-negative e20ulbf.y - 65536L = %lu, expected negative.\n", (unsigned long)(e20ulbf.y - 65536L)); + failures++; + } + } + + if (e20ulbf.z != 1048575L) { + printf ("Got e20ulbf.z = %lu, expected 1048575.\n", (unsigned long)e20ulbf.z); + failures++; + } + + /* Check signedness, should be unsigned. */ + { + if (e20ulbf.z - 1048576L < 0) { + printf ("Got negative e20ulbf.z - 1048576 = %ld, expected positive.\n", (long)(e20ulbf.z - 1048576L)); + failures++; + } + } +} + +/* Enum with underlying type signed long. */ +enum e20sl { + E20SL_M1 = -1, + E20SL_1000 = 1000, + E20SL_1000000000 = 1000000000L, +}; + +static struct enum_bitfield_long { + enum e20sl x : 2; + enum e20sl y : 16; + enum e20sl z : CHAR_BIT * sizeof (enum e20sl); +} e20slbf = {E20SL_M1, E20SL_1000, E20SL_1000000000}; + +static void test_enum_bitfield_long(void) +{ + if (sizeof (struct enum_bitfield_long) != 7) { + printf ("Got sizeof(struct enum_bitfield_long) = %zu, expected 8.\n", + sizeof(struct enum_bitfield_long)); + failures++; + } + + if (e20slbf.x != -1) { + printf ("Got e20slbf.x = %ld, expected -1.\n", (long)e20slbf.x); + failures++; + } + if (e20slbf.y != 1000) { + printf ("Got e20slbf.y = %ld, expected 1000.\n", (long)e20slbf.y); + failures++; + } + if (e20slbf.z != 1000000000L) { + printf ("Got e20slbf.z = %ld, expected 1000000000.\n", (long)e20slbf.z); + failures++; + } + + e20slbf.x = 1; + e20slbf.y = 257; + e20slbf.z = 1048575L; + + if (e20slbf.x != 1) { + printf ("Got e20slbf.x = %d, expected 1.\n", e20slbf.x); + failures++; + } + + /* Check signedness, should be signed. */ + { + if (e20slbf.x - 2 >= 0) { + printf ("Got non-negative e20slbf.x - 2 = %lu, expected negative.\n", (unsigned long)(e20slbf.x - 2)); + failures++; + } + } + + if (e20slbf.y != 257) { + printf ("Got e20slbf.y = %ld, expected 257.\n", (long)e20slbf.y); + failures++; + } + + /* Check signedness, should be signed. */ + { + if (e20slbf.y - 258 >= 0) { + printf ("Got non-negative e20slbf.y - 258 = %lu, expected negative.\n", (unsigned long)(e20slbf.y - 258)); + failures++; + } + } + + if (e20slbf.z != 1048575L) { + printf ("Got e20slbf.z = %ld, expected 1048575.\n", (long)e20slbf.z); + failures++; + } + + /* Check signedness, should be signed. */ + { + if (e20slbf.z - 1048576L >= 0) { + printf ("Got non-negative e20slbf.z - 1048576L = %ld, expected negative.\n", (long)(e20slbf.z - 1048576L)); + failures++; + } + } +} + int main(void) { test_enum_bitfield_uint(); test_enum_bitfield_int(); test_enum_bitfield_uchar(); test_enum_bitfield_char(); + test_enum_bitfield_ulong(); + test_enum_bitfield_long(); printf("failures: %u\n", failures); return failures; } diff --git a/test/val/bitfield-packing-char.c b/test/val/bitfield-packing-char.c new file mode 100644 index 000000000..18621e0eb --- /dev/null +++ b/test/val/bitfield-packing-char.c @@ -0,0 +1,278 @@ +/* + Copyright 2020-2022 The cc65 Authors + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + Tests of char bit-field packing and typedef works with them; see issues below + - packing issue: https://github.com/cc65/cc65/issues/1054 + - typedef issue: https://github.com/cc65/cc65/pull/1662 + - char bit-field support: https://github.com/cc65/cc65/issues/1047 +*/ + +#include + +static unsigned char failures = 0; + +typedef unsigned char field_type; + +static struct four_bits { + field_type x : 4; +} fb = {1}; + +static void test_four_bits(void) +{ + if (sizeof(struct four_bits) != 1) { + printf("Got sizeof(struct four_bits) = %zu, expected 1.\n", + sizeof(struct four_bits)); + failures++; + } + + if (fb.x != 1) { + printf("Got fb.x = %u, expected 1.\n", fb.x); + failures++; + } + + fb.x = 3; + + if (fb.x != 3) { + printf("Got fb.x = %u, expected 3.\n", fb.x); + failures++; + } +} + +/* + Logic is somewhat diferent for bit-fields that end a struct vs + having additional fields. +*/ + +static struct four_bits_with_char { + field_type x : 4; + field_type y; +} fbi = {1, 2}; + +static void test_four_bits_with_char(void) +{ + /* The first 4-bit bit-field just takes one byte, so the size is 2. */ + if (sizeof(struct four_bits_with_char) != 2) { + printf("Got sizeof(struct four_bits_with_char) = %zu, expected 2.\n", + sizeof(struct four_bits_with_char)); + failures++; + } + + if (fbi.x != 1) { + printf("Got fbi.x = %u, expected 1.\n", fbi.x); + failures++; + } + + if (fbi.y != 2) { + printf("Got fbi.y = %u, expected 2.\n", fbi.y); + failures++; + } + + fbi.x = 3; + fbi.y = 17; + + if (fbi.x != 3) { + printf("Got fbi.x = %u, expected 3.\n", fbi.x); + failures++; + } + + if (fbi.y != 17) { + printf("Got fbi.y = %u, expected 17.\n", fbi.y); + failures++; + } +} + +static struct overlap { + field_type x : 6; + field_type y : 6; +} o = {11, 22}; + +/* Tests that bit-fields can share allocation units. */ +static void test_overlap(void) +{ + if (sizeof(struct overlap) != 2) { + printf("Got sizeof(struct overlap) = %zu, expected 2.\n", + sizeof(struct overlap)); + failures++; + } + + if (o.x != 11) { + printf("Got o.x = %u, expected 11.\n", o.x); + failures++; + } + + if (o.y != 22) { + printf("Got o.y = %u, expected 22.\n", o.y); + failures++; + } + + o.x = 33; + o.y = 44; + + if (o.x != 33) { + printf("Got o.x = %u, expected 33.\n", o.x); + failures++; + } + + if (o.y != 44) { + printf("Got o.y = %u, expected 44.\n", o.y); + failures++; + } +} + +static struct overlap_with_char { + field_type x : 6; + field_type y : 6; + field_type z; +} oi = {11, 22, 33}; + +static void test_overlap_with_char(void) +{ + /* First two fields in 2 bytes, then another 1 byte. */ + if (sizeof(struct overlap_with_char) != 3) { + printf("Got sizeof(struct overlap_with_char) = %zu, expected 3.\n", + sizeof(struct overlap_with_char)); + failures++; + } + + if (oi.x != 11) { + printf("Got oi.x = %u, expected 11.\n", oi.x); + failures++; + } + + if (oi.y != 22) { + printf("Got oi.y = %u, expected 22.\n", oi.y); + failures++; + } + + if (oi.z != 33) { + printf("Got oi.z = %u, expected 33.\n", oi.z); + failures++; + } + + oi.x = 44; + oi.y = 55; + oi.z = 66; + + if (oi.x != 44) { + printf("Got oi.x = %u, expected 44.\n", oi.x); + failures++; + } + + if (oi.y != 55) { + printf("Got oi.y = %u, expected 55.\n", oi.y); + failures++; + } + + if (oi.z != 66) { + printf("Got oi.z = %u, expected 66.\n", oi.z); + failures++; + } +} + +static struct full_width { + field_type x : 8; + field_type y : 8; +} fw = {255, 17}; + +static void test_full_width(void) +{ + if (sizeof(struct full_width) != 2) { + printf("Got sizeof(struct full_width) = %zu, expected 2.\n", + sizeof(struct full_width)); + failures++; + } + + if (fw.x != 255) { + printf("Got fw.x = %u, expected 255.\n", fw.x); + failures++; + } + + if (fw.y != 17) { + printf("Got fw.y = %u, expected 17.\n", fw.y); + failures++; + } + + fw.x = 42; + fw.y = 255; + + if (fw.x != 42) { + printf("Got fw.x = %u, expected 42.\n", fw.x); + failures++; + } + + if (fw.y != 255) { + printf("Got fw.y = %u, expected 255.\n", fw.y); + failures++; + } +} + +static struct aligned_end { + field_type : 2; + field_type x : 6; + /* y crosses a byte boundary, but fits in a byte when shifted. */ + field_type : 6; + field_type y : 7; +} ae = {63, 17}; + +static void test_aligned_end(void) +{ + if (sizeof(struct aligned_end) != 3) { + printf("Got sizeof(struct aligned_end) = %zu, expected 3.\n", + sizeof(struct aligned_end)); + failures++; + } + + if (ae.x != 63) { + printf("Got ae.x = %u, expected 63.\n", ae.x); + failures++; + } + + if (ae.y != 17) { + printf("Got ae.y = %u, expected 17.\n", ae.y); + failures++; + } + + ae.x = 42; + ae.y = 127; + + if (ae.x != 42) { + printf("Got ae.x = %u, expected 42.\n", ae.x); + failures++; + } + + if (ae.y != 127) { + printf("Got ae.y = %u, expected 127.\n", ae.y); + failures++; + } + +} + +int main(void) +{ + test_four_bits(); + test_four_bits_with_char(); + test_overlap(); + test_overlap_with_char(); + test_full_width(); + test_aligned_end(); + printf("failures: %u\n", failures); + return failures; +} diff --git a/test/val/bitfield-packing-long.c b/test/val/bitfield-packing-long.c new file mode 100644 index 000000000..fcc8eb7fe --- /dev/null +++ b/test/val/bitfield-packing-long.c @@ -0,0 +1,315 @@ +/* + Copyright 2020-2022 The cc65 Authors + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + Tests of long bit-field packing and typedef works with them; see issues below + - packing: https://github.com/cc65/cc65/issues/1054 + - typedef: https://github.com/cc65/cc65/pull/1662 + - long bit-field support: https://github.com/cc65/cc65/issues/1131 +*/ + +#include + +static unsigned char failures = 0; + +typedef unsigned long field_type; + +static struct four_bits { + field_type x : 4; +} fb = {1}; + +static void test_four_bits(void) +{ + if (sizeof(struct four_bits) != 1) { + printf("Got sizeof(struct four_bits) = %zu, expected 1.\n", + sizeof(struct four_bits)); + failures++; + } + + if (fb.x != 1) { + printf("Got fb.x = %u, expected 1.\n", fb.x); + failures++; + } + + fb.x = 3; + + if (fb.x != 3) { + printf("Got fb.x = %u, expected 3.\n", fb.x); + failures++; + } +} + +/* + Logic is somewhat diferent for bit-fields that end a struct vs + having additional fields. +*/ + +static struct four_bits_with_long { + field_type x : 4; + field_type y; +} fbi = {1, 2}; + +static void test_four_bits_with_long(void) +{ + /* The first 4-bit bit-field just takes one byte, so the size is 5. */ + if (sizeof(struct four_bits_with_long) != 5) { + printf("Got sizeof(struct four_bits_with_long) = %zu, expected 5.\n", + sizeof(struct four_bits_with_long)); + failures++; + } + + if (fbi.x != 1) { + printf("Got fbi.x = %u, expected 1.\n", fbi.x); + failures++; + } + + if (fbi.y != 2) { + printf("Got fbi.y = %lu, expected 2.\n", fbi.y); + failures++; + } + + fbi.x = 3; + fbi.y = 65537; + + if (fbi.x != 3) { + printf("Got fbi.x = %u, expected 3.\n", fbi.x); + failures++; + } + + if (fbi.y != 65537) { + printf("Got fbi.y = %lu, expected 65537.\n", fbi.y); + failures++; + } +} + +static struct overlap { + field_type x : 10; + field_type y : 10; +} o = {11, 22}; + +/* Tests that bit-fields can share allocation units. */ +static void test_overlap(void) +{ + if (sizeof(struct overlap) != 3) { + printf("Got sizeof(struct overlap) = %zu, expected 3.\n", + sizeof(struct overlap)); + failures++; + } + + if (o.x != 11) { + printf("Got o.x = %u, expected 11.\n", o.x); + failures++; + } + + if (o.y != 22) { + printf("Got o.y = %u, expected 22.\n", o.y); + failures++; + } + + o.x = 33; + o.y = 44; + + if (o.x != 33) { + printf("Got o.x = %u, expected 33.\n", o.x); + failures++; + } + + if (o.y != 44) { + printf("Got o.y = %u, expected 44.\n", o.y); + failures++; + } +} + +static struct overlap_with_long { + field_type x : 10; + field_type y : 10; + field_type z; +} oi = {111, 222, 333}; + +static void test_overlap_with_long(void) +{ + /* First two fields in 3 bytes, then another 4 bytes. */ + if (sizeof(struct overlap_with_long) != 7) { + printf("Got sizeof(struct overlap_with_long) = %zu, expected 7.\n", + sizeof(struct overlap_with_long)); + failures++; + } + + if (oi.x != 111) { + printf("Got oi.x = %u, expected 111.\n", oi.x); + failures++; + } + + if (oi.y != 222) { + printf("Got oi.y = %u, expected 222.\n", oi.y); + failures++; + } + + if (oi.z != 333) { + printf("Got oi.z = %u, expected 333.\n", oi.z); + failures++; + } + + oi.x = 444; + oi.y = 555; + oi.z = 4294967295; + + if (oi.x != 444) { + printf("Got oi.x = %u, expected 444.\n", oi.x); + failures++; + } + + if (oi.y != 555) { + printf("Got oi.y = %u, expected 555.\n", oi.y); + failures++; + } + + if (oi.z != 4294967295) { + printf("Got oi.z = %lu, expected 4294967295.\n", oi.z); + failures++; + } +} + +static struct full_width { + field_type x : 8; + field_type y : 16; + field_type z : 32; +} fw = {255, 17, 1}; + +static void test_full_width(void) +{ + if (sizeof(struct full_width) != 7) { + printf("Got sizeof(struct full_width) = %zu, expected 7.\n", + sizeof(struct full_width)); + failures++; + } + + if (fw.x != 255) { + printf("Got fw.x = %u, expected 255.\n", fw.x); + failures++; + } + + if (fw.y != 17) { + printf("Got fw.y = %u, expected 17.\n", fw.y); + failures++; + } + + if (fw.z != 1) { + printf("Got fw.z = %lu, expected 1.\n", fw.z); + failures++; + } + + fw.x = 42; + fw.y = 1023; + fw.z = 65537; + + if (fw.x != 42) { + printf("Got fw.x = %u, expected 42.\n", fw.x); + failures++; + } + + if (fw.y != 1023) { + printf("Got fw.y = %u, expected 1023.\n", fw.y); + failures++; + } + + if (fw.z != 65537) { + printf("Got fw.z = %lu, expected 65537.\n", fw.z); + failures++; + } +} + +static struct aligned_end { + field_type : 2; + field_type x : 6; + field_type : 3; + field_type y : 13; + field_type : 14; + field_type z : 18; + /* w crosses a byte boundary, but fits in a byte when shifted. */ + field_type : 6; + field_type w : 7; +} ae = {63, 17, 1, 100}; + +static void test_aligned_end(void) +{ + if (sizeof(struct aligned_end) != 9) { + printf("Got sizeof(struct aligned_end) = %zu, expected 9.\n", + sizeof(struct aligned_end)); + failures++; + } + + if (ae.x != 63) { + printf("Got ae.x = %u, expected 63.\n", ae.x); + failures++; + } + + if (ae.y != 17) { + printf("Got ae.y = %u, expected 17.\n", ae.y); + failures++; + } + + if (ae.z != 1) { + printf("Got ae.z = %lu, expected 1.\n", ae.z); + failures++; + } + + if (ae.w != 100) { + printf("Got ae.w = %u, expected 100.\n", ae.w); + failures++; + } + + ae.x = 42; + ae.y = 1023; + ae.z = 262143; + ae.w = 66; + + if (ae.x != 42) { + printf("Got ae.x = %u, expected 42.\n", ae.x); + failures++; + } + + if (ae.y != 1023) { + printf("Got ae.y = %u, expected 1023.\n", ae.y); + failures++; + } + + if (ae.z != 262143) { + printf("Got ae.z = %lu, expected 262143.\n", ae.z); + failures++; + } + + if (ae.w != 66) { + printf("Got ae.w = %u, expected 66.\n", ae.w); + failures++; + } +} + +int main(void) +{ + test_four_bits(); + test_four_bits_with_long(); + test_overlap(); + test_overlap_with_long(); + test_full_width(); + test_aligned_end(); + printf("failures: %u\n", failures); + return failures; +} diff --git a/test/val/bitfield.c b/test/val/bitfield-packing.c similarity index 93% rename from test/val/bitfield.c rename to test/val/bitfield-packing.c index 1de19777a..5786d6906 100644 --- a/test/val/bitfield.c +++ b/test/val/bitfield-packing.c @@ -1,5 +1,5 @@ /* - Copyright 2020 The cc65 Authors + Copyright 2020-2022 The cc65 Authors This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,7 +19,9 @@ */ /* - Tests of bit-field packing; see https://github.com/cc65/cc65/issues/1054 + Tests of int bit-field packing and typedef works with them; see issues below + - packing issue: https://github.com/cc65/cc65/issues/1054 + - typedef issue: https://github.com/cc65/cc65/pull/1662 */ #include @@ -83,15 +85,15 @@ static void test_four_bits_with_int(void) } fbi.x = 3; - fbi.y = 17; + fbi.y = 257; if (fbi.x != 3) { printf("Got fbi.x = %u, expected 3.\n", fbi.x); failures++; } - if (fbi.y != 17) { - printf("Got fbi.y = %u, expected 17.\n", fbi.y); + if (fbi.y != 257) { + printf("Got fbi.y = %u, expected 257.\n", fbi.y); failures++; } } @@ -166,7 +168,7 @@ static void test_overlap_with_int(void) oi.x = 444; oi.y = 555; - oi.z = 666; + oi.z = 65535; if (oi.x != 444) { printf("Got oi.x = %u, expected 444.\n", oi.x); @@ -178,8 +180,8 @@ static void test_overlap_with_int(void) failures++; } - if (oi.z != 666) { - printf("Got oi.z = %u, expected 666.\n", oi.z); + if (oi.z != 65535) { + printf("Got oi.z = %u, expected 65535.\n", oi.z); failures++; } } diff --git a/test/val/bitfield-plain.c b/test/val/bitfield-plain.c new file mode 100644 index 000000000..735f3dc87 --- /dev/null +++ b/test/val/bitfield-plain.c @@ -0,0 +1,180 @@ +/* + Copyright 2020-2022 The cc65 Authors + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + Tests that plain bit-fields are unsigned; see issues below + - unsigned integer types by default: https://github.com/cc65/cc65/issues/1095 + - char bit-field support: https://github.com/cc65/cc65/issues/1047 + - long bit-field support: https://github.com/cc65/cc65/issues/1131 +*/ + +#include + +static unsigned char failures = 0; + +static struct plain_ints { + int x : 4; + int y : 10; +} pi = {15, 700}; + +static void test_plain_int_bitfields (void) +{ + if (pi.x != 15) { + printf ("Got pi.x = %ld, expected 15.\n", (long)pi.x); + failures++; + } + if (pi.y != 700) { + printf ("Got pi.y = %ld, expected 700.\n", (long)pi.y); + failures++; + } + + pi.x = 3; + pi.y = 1023; + + if (pi.x != 3) { + printf ("Got pi.x = %ld, expected 3.\n", (long)pi.x); + failures++; + } + if (pi.y != 1023) { + printf ("Got pi.y = %ld, expected 1023.\n", (long)pi.y); + failures++; + } +} + +static struct plain_shorts { + short x : 4; + short y : 10; +} ps = {15, 700}; + +static void test_plain_short_bitfields (void) +{ + if (ps.x != 15) { + printf ("Got ps.x = %ld, expected 15.\n", (long)ps.x); + failures++; + } + if (ps.y != 700) { + printf ("Got ps.y = %ld, expected 700.\n", (long)ps.y); + failures++; + } + + ps.x = 3; + ps.y = 1023; + + if (ps.x != 3) { + printf ("Got ps.x = %ld, expected 3.\n", (long)ps.x); + failures++; + } + if (ps.y != 1023) { + printf ("Got ps.y = %ld, expected 1023.\n", (long)ps.y); + failures++; + } +} + +static struct plain_chars { + char x : 4; +} pc = {15}; + +static void test_plain_char_bitfields (void) +{ + if (pc.x != 15) { + printf ("Got pc.x = %ld, expected 15.\n", (long)pc.x); + failures++; + } + + pc.x = 3; + + if (pc.x != 3) { + printf ("Got pc.x = %ld, expected 3.\n", (long)pc.x); + failures++; + } +} + +static struct plain_longs { + long x : 4; + long y : 10; + long z : 18; +} pl = {15, 700, 200000}; + +static void test_plain_long_bitfields (void) +{ + if (pl.x != 15) { + if (pl.x < 0) { + printf ("Got pl.x = %ld, expected 15.\n", (long)pl.x); + } else { + printf ("Got pl.x = %lu, expected 15.\n", (unsigned long)pl.x); + } + failures++; + } + if (pl.y != 700) { + if (pl.y < 0) { + printf ("Got pl.y = %ld, expected 700.\n", (long)pl.y); + } else { + printf ("Got pl.y = %lu, expected 700.\n", (unsigned long)pl.y); + } + failures++; + } + if (pl.z != 200000) { + if (pl.z < 0) { + printf ("Got pl.z = %ld, expected 200000.\n", (long)pl.z); + } else { + printf ("Got pl.z = %lu, expected 200000.\n", (unsigned long)pl.z); + } + failures++; + } + + pl.x = 3; + pl.y = 1023; + pl.z = 262143; + + if (pl.x != 3) { + if (pl.x < 0) { + printf ("Got pl.x = %ld, expected 3.\n", (long)pl.x); + } else { + printf ("Got pl.x = %lu, expected 3.\n", (unsigned long)pl.x); + } + failures++; + } + if (pl.y != 1023) { + if (pl.y < 0) { + printf ("Got pl.y = %ld, expected 1023.\n", (long)pl.y); + } else { + printf ("Got pl.y = %lu, expected 1023.\n", (unsigned long)pl.y); + } + failures++; + } + if (pl.z != 262143) { + if (pl.z < 0) { + printf ("Got pl.z = %ld, expected 262143.\n", (long)pl.z); + } else { + printf ("Got pl.z = %lu, expected 262143.\n", (unsigned long)pl.z); + } + failures++; + } +} + +int main (void) +{ + test_plain_int_bitfields (); + test_plain_short_bitfields (); + test_plain_char_bitfields (); + test_plain_long_bitfields (); + printf ("failures: %u\n", failures); + return failures; +} diff --git a/test/val/bitfield-signed.c b/test/val/bitfield-signed.c new file mode 100644 index 000000000..68f36f92a --- /dev/null +++ b/test/val/bitfield-signed.c @@ -0,0 +1,180 @@ +/* + Copyright 2020-2022 The cc65 Authors + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be signedly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + Tests that signed bit-fields are indeed signed; see issues below + - unsigned integer types by default: https://github.com/cc65/cc65/issues/1095 + - char bit-field support: https://github.com/cc65/cc65/issues/1047 + - long bit-field support: https://github.com/cc65/cc65/issues/1131 +*/ + +#include + +static unsigned char failures = 0; + +static struct signed_ints { + signed int x : 4; + signed int y : 10; +} pi = {-8, -500}; + +static void test_signed_int_bitfields (void) +{ + if (pi.x != -8) { + printf ("Got pi.x = %ld, expected -8.\n", (long)pi.x); + failures++; + } + if (pi.y != -500) { + printf ("Got pi.y = %ld, expected -500.\n", (long)pi.y); + failures++; + } + + pi.x = -3; + pi.y = -512; + + if (pi.x != -3) { + printf ("Got pi.x = %ld, expected -3.\n", (long)pi.x); + failures++; + } + if (pi.y != -512) { + printf ("Got pi.y = %ld, expected -512.\n", (long)pi.y); + failures++; + } +} + +static struct signed_shorts { + signed short x : 4; + signed short y : 10; +} ps = {-8, -500}; + +static void test_signed_short_bitfields (void) +{ + if (ps.x != -8) { + printf ("Got ps.x = %ld, expected -8.\n", (long)ps.x); + failures++; + } + if (ps.y != -500) { + printf ("Got ps.y = %ld, expected -500.\n", (long)ps.y); + failures++; + } + + ps.x = -3; + ps.y = -512; + + if (ps.x != -3) { + printf ("Got ps.x = %ld, expected -3.\n", (long)ps.x); + failures++; + } + if (ps.y != -512) { + printf ("Got ps.y = %ld, expected -512.\n", (long)ps.y); + failures++; + } +} + +static struct signed_chars { + signed char x : 4; +} pc = {-8}; + +static void test_signed_char_bitfields (void) +{ + if (pc.x != -8) { + printf ("Got pc.x = %ld, expected -8.\n", (long)pc.x); + failures++; + } + + pc.x = -3; + + if (pc.x != -3) { + printf ("Got pc.x = %ld, expected -3.\n", (long)pc.x); + failures++; + } +} + +static struct signed_longs { + signed long x : 4; + signed long y : 10; + signed long z : 18; +} pl = {-8, -500, -70000}; + +static void test_signed_long_bitfields (void) +{ + if (pl.x != -8) { + if (pl.x < 0) { + printf ("Got pl.x = %ld, expected -8.\n", (long)pl.x); + } else { + printf ("Got pl.x = %lu, expected -8.\n", (unsigned long)pl.x); + } + failures++; + } + if (pl.y != -500) { + if (pl.y < 0) { + printf ("Got pl.y = %ld, expected -500.\n", (long)pl.y); + } else { + printf ("Got pl.y = %lu, expected -500.\n", (unsigned long)pl.y); + } + failures++; + } + if (pl.z != -70000) { + if (pl.z < 0) { + printf ("Got pl.z = %ld, expected -70000.\n", (long)pl.z); + } else { + printf ("Got pl.z = %lu, expected -70000.\n", (unsigned long)pl.z); + } + failures++; + } + + pl.x = -3; + pl.y = -512; + pl.z = -131072; + + if (pl.x != -3) { + if (pl.x < 0) { + printf ("Got pl.x = %ld, expected -3.\n", (long)pl.x); + } else { + printf ("Got pl.x = %lu, expected -3.\n", (unsigned long)pl.x); + } + failures++; + } + if (pl.y != -512) { + if (pl.y < 0) { + printf ("Got pl.y = %ld, expected -512.\n", (long)pl.y); + } else { + printf ("Got pl.y = %lu, expected -512.\n", (unsigned long)pl.y); + } + failures++; + } + if (pl.z != -131072) { + if (pl.z < 0) { + printf ("Got pl.z = %ld, expected -131072.\n", (long)pl.z); + } else { + printf ("Got pl.z = %lu, expected -131072.\n", (unsigned long)pl.z); + } + failures++; + } +} + +int main (void) +{ + test_signed_int_bitfields (); + test_signed_short_bitfields (); + test_signed_char_bitfields (); + test_signed_long_bitfields (); + printf ("failures: %u\n", failures); + return failures; +} diff --git a/test/val/plain-int-bitfield.c b/test/val/plain-int-bitfield.c deleted file mode 100644 index 4d158eca9..000000000 --- a/test/val/plain-int-bitfield.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright 2020 The cc65 Authors - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/* - Tests that plain int bit-fields are unsigned. -*/ - -#include - -static unsigned char failures = 0; - -static struct plain_ints { - int x : 4; - int y : 10; -} pi = {15, 700}; - -static void test_plain_int_bitfields (void) -{ - if (pi.x != 15) { - printf ("Got pi.x = %u, expected 15.\n", pi.x); - failures++; - } - if (pi.y != 700) { - printf ("Got pi.y = %u, expected 700.\n", pi.y); - failures++; - } - - pi.x = 3; - pi.y = 1023; - - if (pi.x != 3) { - printf ("Got pi.x = %u, expected 3.\n", pi.x); - failures++; - } - if (pi.y != 1023) { - printf ("Got pi.y = %u, expected 1023.\n", pi.y); - failures++; - } -} - -int main (void) -{ - test_plain_int_bitfields (); - printf ("failures: %u\n", failures); - return failures; -} From f74ce463b2cda253568b48ea6f23c5469984652b Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 16 Apr 2022 15:24:41 +0200 Subject: [PATCH 06/33] add gitignores --- util/.gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 util/.gitignore diff --git a/util/.gitignore b/util/.gitignore new file mode 100644 index 000000000..4da436acb --- /dev/null +++ b/util/.gitignore @@ -0,0 +1,3 @@ +/atari/ataricvt +/gamate/gamate-fixcart +/zlib/deflater From e385ec1b5ed4c32b97111ca74e072a67ba838263 Mon Sep 17 00:00:00 2001 From: Bob Andrews Date: Sat, 16 Apr 2022 16:17:50 +0200 Subject: [PATCH 07/33] Create Contributing.md Starting to move info hidden elsewhere into this file --- Contributing.md | 89 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Contributing.md diff --git a/Contributing.md b/Contributing.md new file mode 100644 index 000000000..1aeae7786 --- /dev/null +++ b/Contributing.md @@ -0,0 +1,89 @@ +This document contains all kinds of information that you should know if you want to contribute to the cc65 project. Before you start, please read all of it. If something is not clear to you, please ask - this document is an ongoing effort and may well be incomplete. + +(''Note:'' The word "must" indicates a requirement. The word "should" indicates a recomendation.) + +# generally + +* You must obey these rules when contributing new code or documentation to cc65. We are well aware that not all existing code may respect all rules outlined here - but this is no reason for you not to respect them. +* One commit/patch/PR per issue. Do not mix several things unless they are very closely related. + +# Codestyle rules + +## All Sources + +* TAB characters must be expanded to spaces. +* All text files must end with new-line characters. Don't leave the last line "dangling". +* 80 characters is the desired maximum width of files. But, it isn't a "strong" rule; sometimes, you will want to type longer lines, in order to keep the parts of expressions or comments together on the same line. +* You should avoid typing non-ASCII characters. +* If you change "normal" source code into comments, then you must add a comment about why that code is a comment. +* When you want to create a comment from several lines of code, you should use preprocessor lines, instead of ```/* */``` or "```;```". Example: +
+#if 0
+    one ();
+    two ();
+    three = two () + one ();
+#endif
+
+* You should type upper case characters for hex values. +* When you type zero-page addresses in hexadecimal, you should type two hex characters (after the hex prefix). When you type non-zero-page addresses in hex, you should type four hex characters. +* When you type lists of addresses, it is a good idea to sort them in ascending numerical order. That makes it easier for readers to build mental pictures of where things are in an address space. And, it is easier to see how big the variables and buffers are. Example: +
+xCoord := $0703
+yCoord := $0705        ; (this address implies that xCoord is 16 bits)
+cmdbuf := $0706        ; (this address implies that yCoord is 8 bits)
+cmdlen := $0786        ; (this address implies that cmdbuf is 128 bytes)
+color  := $0787
+
+ +## C Sources + +* Your files should obey the C89 standard. +* All declarations in a block must be at the beginning of that block. +* You should put a blank line between a list of local variable declarations and the first line of code. +* You must use ANSI C comments (```/* */```); you must not use C++ comments (```//```). +* The normal indentation width should be four spaces. +* When a function's argument list wraps around to a next line, you should indent that next line by either the normal width or enough spaces to align it with the arguments on the previous line. +* When you add functions to an existing file, you should separate them by the same number of blank lines that separate the functions that already are in that file. + +(The next two rules will be changed at some time in the future; but, for now:) + +* You must separate function names and parameter/argument lists by one space. +* When declaring/defining pointers, you must put the asterisk (```*```) next to the data type, with a space between it and the variable's name. Examples: +
+    int* namedPtr[5];
+    char* nextLine (FILE* f);
+
+ +## Assembly Sources + +* Op-code mnemonics must have lower-case letters. The names of instruction macroes may have upper-case letters. +* Hexadecimal number constants should be used except where decimal or binary numbers make much more sense in that constant's context. +* Hexadecimal letters should be upper-case. +* When you set two registers or two memory locations to an immediate 16-bit zero, you should use the expressions ```#<$0000``` and ```#>$0000``` (they make it obvious where you are putting the lower and upper bytes). +* If a function is declared to return a char-sized value, it actually must return an integer-sized value. (When cc65 promotes a returned value, it sometimes assumes that the value already is an integer.) +* Functions, that are intended for a platform's system library, should be optimized as much as possible. +* Sometimes, there must be a trade-off between size and speed. If you think that a library function won't be used often, then you should make it small. Otherwise, you should make it fast. +* Comments that are put on the right side of instructions must be aligned (start in the same character columns). +* Assembly source fields (label, operation, operand, comment) should start ''after'' character columns that are multiples of eight (such as 1, 9, 17, 33, and 41). + +## LinuxDoc Sources + +* TAB characters must be expanded to spaces. +* All text files must end with new-line characters. Don't leave the last line "dangling". +* 80 characters is the desired maximum width of files. +* You should avoid typing non-ASCII characters. + +* You should put blank lines between LinuxDoc sections: + * Three blank lines between `````` sections. + * Two blank lines between `````` sections. + * One blank line between other sections. + +# Documentation rules + +## User manual (LinuxDoc) + +* This is the primary documentation. + +## Wiki + +* The Wiki is strictly for additional information that does not fit into the regular user manual (LinuxDoc). The wiki must not duplicate any information that is present in the user manual From 72e548fa84af596ecc268f658d5f5152ecc38b7c Mon Sep 17 00:00:00 2001 From: Bob Andrews Date: Sat, 16 Apr 2022 16:20:48 +0200 Subject: [PATCH 08/33] Update README.md link Contributing.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 009fca78b..fa23b1be2 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@ [Documentation](https://cc65.github.io/doc) -[Wiki](https://github.com/cc65/wiki/wiki) +[Contributing](Contributing.md) to the CC65 project. + +The [Wiki](https://github.com/cc65/wiki/wiki) contains extra info that does not fit into the regular documentation. [![Snapshot Build](https://github.com/cc65/cc65/actions/workflows/snapshot-on-push-master.yml/badge.svg?branch=master)](https://github.com/cc65/cc65/actions/workflows/snapshot-on-push-master.yml) From 3dd9ed0414a3fcfc695a70dad14f6f0499dfcb3b Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 16 Apr 2022 17:36:25 +0200 Subject: [PATCH 09/33] remove literal TABs --- doc/using-make.sgml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/using-make.sgml b/doc/using-make.sgml index e324b7484..9898e9626 100644 --- a/doc/using-make.sgml +++ b/doc/using-make.sgml @@ -76,13 +76,13 @@ ifneq ($(MAKECMDGOALS),clean) endif %.o: %.c - $(CC) -c $(CFLAGS) -o $@ $< + $(CC) -c $(CFLAGS) -o $@ $< $(PROGRAM): $(SOURCES:.c=.o) - $(CC) $(LDFLAGS) -o $@ $^ + $(CC) $(LDFLAGS) -o $@ $^ clean: - $(RM) $(SOURCES:.c=.o) $(SOURCES:.c=.d) $(PROGRAM) $(PROGRAM).map + $(RM) $(SOURCES:.c=.o) $(SOURCES:.c=.d) $(PROGRAM) $(PROGRAM).map Date: Sat, 16 Apr 2022 18:16:14 +0200 Subject: [PATCH 10/33] remove a bunch of TABs --- libsrc/atari7800/clock.s | 18 ++-- libsrc/atari7800/clocks_per_sec.s | 14 +-- libsrc/atari7800/crt0.s | 24 ++--- libsrc/atari7800/exehdr.s | 34 +++--- libsrc/atari7800/get_tv.s | 86 +++++++-------- libsrc/atari7800/irq.s | 6 +- libsrc/atari7800/joy/atari7800-stdjoy.s | 134 ++++++++++++------------ libsrc/lynx/bootldr.s | 2 +- samples/sym1/symNotepad.c | 26 ++--- test/val/bug1696.c | 20 ++-- 10 files changed, 182 insertions(+), 182 deletions(-) diff --git a/libsrc/atari7800/clock.s b/libsrc/atari7800/clock.s index 3b259cfcf..03ae1e970 100644 --- a/libsrc/atari7800/clock.s +++ b/libsrc/atari7800/clock.s @@ -9,12 +9,12 @@ .constructor init_clock .import sreg: zp - .import _zonecounter + .import _zonecounter .include "atari7800.inc" .macpack generic - .code + .code ;----------------------------------------------------------------------------- ; Read the clock counter. @@ -38,9 +38,9 @@ ; _zonecounter == 1 (from 1st visible scanline to last visible scanline) ; update_clock: - lda _zonecounter - and #01 - beq @L1 + lda _zonecounter + and #01 + beq @L1 inc clock_count bne @L1 inc clock_count+1 @@ -54,10 +54,10 @@ update_clock: ; .segment "ONCE" init_clock: - lda #0 - sta clock_count+2 - sta clock_count+1 - sta clock_count + lda #0 + sta clock_count+2 + sta clock_count+1 + sta clock_count rts ;----------------------------------------------------------------------------- diff --git a/libsrc/atari7800/clocks_per_sec.s b/libsrc/atari7800/clocks_per_sec.s index dc09c4396..e2c7d9d8d 100644 --- a/libsrc/atari7800/clocks_per_sec.s +++ b/libsrc/atari7800/clocks_per_sec.s @@ -7,12 +7,12 @@ .export __clocks_per_sec .import sreg: zp - .import _paldetected + .import _paldetected .include "atari7800.inc" .macpack generic - .code + .code ;----------------------------------------------------------------------------- ; Return the number of clock ticks in one second. @@ -20,15 +20,15 @@ .proc __clocks_per_sec lda #0 - tax + tax sta sreg ; return 32 bits sta sreg+1 lda _paldetected - bne pal - lda #60 ; NTSC - 60Hz - rts + bne pal + lda #60 ; NTSC - 60Hz + rts pal: - lda #50 ; PAL - 50Hz + lda #50 ; PAL - 50Hz rts .endproc diff --git a/libsrc/atari7800/crt0.s b/libsrc/atari7800/crt0.s index d7cf307ee..cefe16730 100644 --- a/libsrc/atari7800/crt0.s +++ b/libsrc/atari7800/crt0.s @@ -1,14 +1,14 @@ - .export _zonecounter - .export __STARTUP__ : absolute = 1 - .export _exit - .import __ROM_START__ - .import __RAM3_START__, __RAM3_SIZE__ - .import initlib, donelib - .import zerobss, copydata - .import IRQStub - .import push0, _main - .include "atari7800.inc" - .include "zeropage.inc" + .export _zonecounter + .export __STARTUP__ : absolute = 1 + .export _exit + .import __ROM_START__ + .import __RAM3_START__, __RAM3_SIZE__ + .import initlib, donelib + .import zerobss, copydata + .import IRQStub + .import push0, _main + .include "atari7800.inc" + .include "zeropage.inc" INPTCTRL = $01 @@ -50,7 +50,7 @@ _exit: NMIHandler: inc _zonecounter - jmp IRQStub + jmp IRQStub IRQHandler: rti diff --git a/libsrc/atari7800/exehdr.s b/libsrc/atari7800/exehdr.s index 618164cd4..99e62e3d6 100644 --- a/libsrc/atari7800/exehdr.s +++ b/libsrc/atari7800/exehdr.s @@ -4,15 +4,15 @@ ; This header contains data for emulators ; .export __EXEHDR__: absolute = 1 - .import __CARTSIZE__ + .import __CARTSIZE__ ; ------------------------------------------------------------------------ ; EXE header - .segment "EXEHDR" - .byte 3 ; version - .byte 'A','T','A','R','I','7','8','0','0',' ',' ',' ',' ',' ',' ',' ' - .byte 'G','a','m','e',' ','n','a','m','e',0,0,0,0,0,0,0 - .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .byte 0,0,>__CARTSIZE__,0 ; Set the cart size in the cfg file + .segment "EXEHDR" + .byte 3 ; version + .byte 'A','T','A','R','I','7','8','0','0',' ',' ',' ',' ',' ',' ',' ' + .byte 'G','a','m','e',' ','n','a','m','e',0,0,0,0,0,0,0 + .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + .byte 0,0,>__CARTSIZE__,0 ; Set the cart size in the cfg file ; bit 0 - pokey at 4000 ; bit 1 - supergame bank switched ; bit 2 - supergame ram at $4000 @@ -28,19 +28,19 @@ ; bit 12 - souper ; bit 13-15 - Special ; 0 = Normal cart - .byte 0,0 ; 0 = Normal cart - .byte 1 ; 1 = Joystick, 2 = lightgun - .byte 0 ; No joystick 2 - .byte 0 ; bit0 = 0:NTSC,1:PAL bit1 = 0:component,1:composite - .byte 0 ; Save data peripheral - 1 byte (version 2) + .byte 0,0 ; 0 = Normal cart + .byte 1 ; 1 = Joystick, 2 = lightgun + .byte 0 ; No joystick 2 + .byte 0 ; bit0 = 0:NTSC,1:PAL bit1 = 0:component,1:composite + .byte 0 ; Save data peripheral - 1 byte (version 2) ; 0 = None / unknown (default) ; 1 = High Score Cart (HSC) ; 2 = SaveKey - .byte 0 ; 63 Expansion module + .byte 0 ; 63 Expansion module ; 0 = No expansion module (default on all currently released games) ; 1 = Expansion module required - .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .byte 0,0,0,0,0,0,0,0 - .byte 'A','C','T','U','A','L',' ','C','A','R','T',' ','D','A','T','A',' ','S','T','A','R','T','S',' ','H','E','R','E' + .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + .byte 0,0,0,0,0,0,0,0 + .byte 'A','C','T','U','A','L',' ','C','A','R','T',' ','D','A','T','A',' ','S','T','A','R','T','S',' ','H','E','R','E' diff --git a/libsrc/atari7800/get_tv.s b/libsrc/atari7800/get_tv.s index 3eb94d54d..12c54f807 100644 --- a/libsrc/atari7800/get_tv.s +++ b/libsrc/atari7800/get_tv.s @@ -3,63 +3,63 @@ ; ; unsigned char get_tv (void) ; - .include "atari7800.inc" - .include "get_tv.inc" - .export _get_tv - .export _paldetected + .include "atari7800.inc" + .include "get_tv.inc" + .export _get_tv + .export _paldetected -.segment "DATA" +.segment "DATA" _paldetected: - .byte $FF + .byte $FF ; --------------------------------------------------------------- ; unsigned char get_tv (void) ; --------------------------------------------------------------- -.segment "CODE" +.segment "CODE" -.proc _get_tv: near +.proc _get_tv: near -.segment "CODE" +.segment "CODE" - ldx #$00 - lda #$FF - cmp _paldetected - bne L8 -L1: lda MSTAT - and #$80 - bne L1 -L2: lda MSTAT - and #$80 - beq L2 -L3: lda MSTAT - and #$80 - bne L3 - lda #$00 - sta M0001 - jmp L5 -L4: sta MWSYNC - sta MWSYNC - dec M0001 -L5: lda MSTAT - and #$80 - beq L4 - lda M0001 - cmp #$78 - bcc L6 - lda #TV::NTSC - jmp L7 -L6: lda #TV::PAL -L7: sta _paldetected - ldx #$00 -L8: lda _paldetected - rts + ldx #$00 + lda #$FF + cmp _paldetected + bne L8 +L1: lda MSTAT + and #$80 + bne L1 +L2: lda MSTAT + and #$80 + beq L2 +L3: lda MSTAT + and #$80 + bne L3 + lda #$00 + sta M0001 + jmp L5 +L4: sta MWSYNC + sta MWSYNC + dec M0001 +L5: lda MSTAT + and #$80 + beq L4 + lda M0001 + cmp #$78 + bcc L6 + lda #TV::NTSC + jmp L7 +L6: lda #TV::PAL +L7: sta _paldetected + ldx #$00 +L8: lda _paldetected + rts -.segment "BSS" +.segment "BSS" M0001: - .res 1,$00 + .res 1,$00 .endproc diff --git a/libsrc/atari7800/irq.s b/libsrc/atari7800/irq.s index ed315a1b7..3cfc74541 100644 --- a/libsrc/atari7800/irq.s +++ b/libsrc/atari7800/irq.s @@ -8,7 +8,7 @@ .include "atari7800.inc" - .code + .code ; ------------------------------------------------------------------------ initirq: @@ -27,10 +27,10 @@ IRQStub: tya pha jsr callirq ; Call the functions - pla + pla tay pla tax -@L1: pla +@L1: pla rti diff --git a/libsrc/atari7800/joy/atari7800-stdjoy.s b/libsrc/atari7800/joy/atari7800-stdjoy.s index 00bb57dcf..cea6625a4 100644 --- a/libsrc/atari7800/joy/atari7800-stdjoy.s +++ b/libsrc/atari7800/joy/atari7800-stdjoy.s @@ -88,74 +88,74 @@ COUNT: ; READ: Read a particular joystick passed in A for 2 fire buttons. readbuttons: - ; Y has joystick of interest 0/1 - ; return value: - ; $00: no button, - ; $01: left/B button, - ; $02: right/A button, - ; $03: both buttons - ; preserves X - tya - beq L5 - ; Joystick 1 processing - ; 7800 joystick 1 buttons - ldy #0 ; ........ - bit INPT2 ; Check for right button - bpl L1 - ldy #2 ; ......2. -L1: bit INPT3 ;Check for left button - bpl L2 - iny ; ......21 -L2: tya - bne L4 ; 7800 mode joystick worked - ; 2600 Joystick 1 - bit INPT5 - bmi L4 -L3: iny ; .......1 - lda #0 ; Fallback to 2600 joystick mode - sta CTLSWB -L4: tya ; ......21 - rts + ; Y has joystick of interest 0/1 + ; return value: + ; $00: no button, + ; $01: left/B button, + ; $02: right/A button, + ; $03: both buttons + ; preserves X + tya + beq L5 + ; Joystick 1 processing + ; 7800 joystick 1 buttons + ldy #0 ; ........ + bit INPT2 ; Check for right button + bpl L1 + ldy #2 ; ......2. +L1: bit INPT3 ;Check for left button + bpl L2 + iny ; ......21 +L2: tya + bne L4 ; 7800 mode joystick worked + ; 2600 Joystick 1 + bit INPT5 + bmi L4 +L3: iny ; .......1 + lda #0 ; Fallback to 2600 joystick mode + sta CTLSWB +L4: tya ; ......21 + rts -L5: ; Joystick 0 processing - ; 7800 joystick 0 buttons - ldy #0 ; ........ - bit INPT0 ; Check for right button - bpl L6 - ldy #2 ; ......2. -L6: bit INPT1 ;Check for left button - bpl L7 - iny ; ......21 -L7: tya - bne L4 ; 7800 mode joystick worked - ; 2600 Joystick 0 - bit INPT4 - bmi L4 - bpl L3 +L5: ; Joystick 0 processing + ; 7800 joystick 0 buttons + ldy #0 ; ........ + bit INPT0 ; Check for right button + bpl L6 + ldy #2 ; ......2. +L6: bit INPT1 ;Check for left button + bpl L7 + iny ; ......21 +L7: tya + bne L4 ; 7800 mode joystick worked + ; 2600 Joystick 0 + bit INPT4 + bmi L4 + bpl L3 READ: - tay ; Store joystick 0/1 in Y - beq L8 - lda SWCHA ; Read directions of joystick 1 - rol ; ...RLDU. - rol ; ..RLDU.. - rol ; .RLDU... - joystick 1 - jmp L9 -L8: lda SWCHA ; Read directions of joystick 0 - ror ; .RLDU... - joystick 0 -L9: tax - jsr readbuttons ; A = ......21, X = .RLDU... - ror ; A = .......2 1 - tay ; Y = .......2 - txa ; A = .RLDU... - ror ; A = 1.RLDU.. - tax ; X = 1.RLDU.. - tya ; A = .......2 - ror ; A = ........ 2 - txa ; A = 1.RLDU.. - rol ; A = .RLDU..2 1 - rol ; A = RLDU..21 - eor #$F0 ; The direction buttons were inversed - and #$F3 - rts + tay ; Store joystick 0/1 in Y + beq L8 + lda SWCHA ; Read directions of joystick 1 + rol ; ...RLDU. + rol ; ..RLDU.. + rol ; .RLDU... - joystick 1 + jmp L9 +L8: lda SWCHA ; Read directions of joystick 0 + ror ; .RLDU... - joystick 0 +L9: tax + jsr readbuttons ; A = ......21, X = .RLDU... + ror ; A = .......2 1 + tay ; Y = .......2 + txa ; A = .RLDU... + ror ; A = 1.RLDU.. + tax ; X = 1.RLDU.. + tya ; A = .......2 + ror ; A = ........ 2 + txa ; A = 1.RLDU.. + rol ; A = .RLDU..2 1 + rol ; A = RLDU..21 + eor #$F0 ; The direction buttons were inversed + and #$F3 + rts diff --git a/libsrc/lynx/bootldr.s b/libsrc/lynx/bootldr.s index 58f04afc6..c8b4ca402 100644 --- a/libsrc/lynx/bootldr.s +++ b/libsrc/lynx/bootldr.s @@ -61,7 +61,7 @@ ; 00 00 00 00 ; spares ; 00 ; End of encrypted header mark ; -; .reloc +; .reloc ;********************************** ; After compilation, encryption and obfuscation it turns into this. ;********************************** diff --git a/samples/sym1/symNotepad.c b/samples/sym1/symNotepad.c index 1d0541ab6..6fb6db902 100644 --- a/samples/sym1/symNotepad.c +++ b/samples/sym1/symNotepad.c @@ -68,7 +68,7 @@ int main (void) { } else { memset ( tapio, 0, TAPIO_MAX_SIZE ); - } + } while ( running ) { @@ -138,21 +138,21 @@ int main (void) { } else { - for ( l = 0; l <= heap_size; l++ ) { - buffer[l] = tapio[l]; - } + for ( l = 0; l <= heap_size; l++ ) { + buffer[l] = tapio[l]; + } - p = strlen ( buffer ); + p = strlen ( buffer ); - putchar ( '\r' ); - for ( l = 0; l < 25; l++ ) { - putchar ( '\n' ); - } - puts ("===================== Sym-1 Notepad ====================\n"); + putchar ( '\r' ); + for ( l = 0; l < 25; l++ ) { + putchar ( '\n' ); + } + puts ("===================== Sym-1 Notepad ====================\n"); - for ( l = 0; l <= p; l++ ) { - putchar ( buffer[l] ); - } + for ( l = 0; l <= p; l++ ) { + putchar ( buffer[l] ); + } } } else if ( c == 0x03 ) { // Clear diff --git a/test/val/bug1696.c b/test/val/bug1696.c index c31dc257b..72cf9cc7e 100644 --- a/test/val/bug1696.c +++ b/test/val/bug1696.c @@ -29,16 +29,16 @@ static unsigned char failures = 0; int main(void) { - unsigned int x = 65535; - unsigned short y = 65535; - if (!(x > 1L)) { - printf("x = %ld but x > 1L failed\n", (long)x); - ++failures; - } - if (!(y == 65535L)) { - printf("y = %ld but y == 65535L failed\n", (long)y); - ++failures; - } + unsigned int x = 65535; + unsigned short y = 65535; + if (!(x > 1L)) { + printf("x = %ld but x > 1L failed\n", (long)x); + ++failures; + } + if (!(y == 65535L)) { + printf("y = %ld but y == 65535L failed\n", (long)y); + ++failures; + } printf("failures: %u\n", failures); return failures; } From 4b492ed4e56a449d3439ea892631b121bbeb66bd Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 16 Apr 2022 18:18:51 +0200 Subject: [PATCH 11/33] added TAB checker script, to be added to the PR checker action --- .github/checks/Makefile | 7 +++++++ .github/checks/tabs.sh | 16 ++++++++++++++++ Makefile | 5 ++++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .github/checks/Makefile create mode 100755 .github/checks/tabs.sh diff --git a/.github/checks/Makefile b/.github/checks/Makefile new file mode 100644 index 000000000..3e85c0fd7 --- /dev/null +++ b/.github/checks/Makefile @@ -0,0 +1,7 @@ + +.PHONY: tabs + +check: tabs + +tabs: tabs.sh + @./tabs.sh diff --git a/.github/checks/tabs.sh b/.github/checks/tabs.sh new file mode 100755 index 000000000..ad10dfe14 --- /dev/null +++ b/.github/checks/tabs.sh @@ -0,0 +1,16 @@ +#! /bin/bash +OLDCWD=`pwd` +SCRIPT_PATH=`dirname $0` +cd $SCRIPT_PATH/../../ + +FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.c -o -name \*.s -o -name \*.h -o -name \*.asm -o -name \*.sgml \) -print | xargs grep -l $'\t' | grep -v "libwrk/" | grep -v "testwrk/"` + +cd $OLDCWD + +if [ x"$FILES"x != xx ]; then + echo "error: found TABs in the following files:" + for n in $FILES; do + echo $n + done + exit -1 +fi diff --git a/Makefile b/Makefile index 540c214fc..f565727e6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples test util +.PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples test util check .SUFFIXES: @@ -24,6 +24,9 @@ samples: test: @$(MAKE) -C test --no-print-directory $@ +check: + @$(MAKE) -C .github/checks --no-print-directory $@ + util: @$(MAKE) -C util --no-print-directory $@ From 4c5875706408f36dbfca755c9422101339f7f5b9 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 16 Apr 2022 18:21:57 +0200 Subject: [PATCH 12/33] run style checks on PR --- .github/workflows/build-on-pull-request.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-on-pull-request.yml b/.github/workflows/build-on-pull-request.yml index 6ab8543de..e9176f8c4 100644 --- a/.github/workflows/build-on-pull-request.yml +++ b/.github/workflows/build-on-pull-request.yml @@ -21,6 +21,9 @@ jobs: - name: Checkout Source uses: actions/checkout@v2 + - name: Do some simple style checks + shell: bash + run: make -j2 check - name: Build the tools. shell: bash run: make -j2 bin USER_CFLAGS=-Werror From fd6662bb6499f7c1be5152aca38c2fd811d8ef18 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 16 Apr 2022 18:32:49 +0200 Subject: [PATCH 13/33] add check action also to the snapshot build --- .github/workflows/snapshot-on-push-master.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/snapshot-on-push-master.yml b/.github/workflows/snapshot-on-push-master.yml index fb4b3aa13..47abc3564 100644 --- a/.github/workflows/snapshot-on-push-master.yml +++ b/.github/workflows/snapshot-on-push-master.yml @@ -46,6 +46,9 @@ jobs: - name: Checkout Source uses: actions/checkout@v2 + - name: Do some simple style checks + shell: bash + run: make -j2 check - name: Build the tools. shell: bash run: | From 8cacfa70d5dc99077f08bdc77f45afaf0162b943 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 16 Apr 2022 19:51:48 +0200 Subject: [PATCH 14/33] add missing newline to a bunch of files --- libsrc/apple2/color.s | 2 +- libsrc/geos-cbm/system/initdoneio.s | 4 ++-- libsrc/geos-cbm/system/tobasic.s | 2 +- libsrc/geos-common/memory/crc.s | 1 - libsrc/geos-common/menuicon/doicons.s | 2 +- libsrc/geos-common/menuicon/domenu.s | 2 +- libsrc/geos-common/menuicon/dopreviousmenu.s | 2 +- libsrc/geos-common/menuicon/gotofirstmenu.s | 2 +- libsrc/geos-common/menuicon/recoverallmenus.s | 2 +- libsrc/geos-common/menuicon/recovermenu.s | 2 +- libsrc/geos-common/menuicon/redomenu.s | 2 +- .../geos-common/mousesprite/clearmousemode.s | 2 +- libsrc/geos-common/mousesprite/disablsprite.s | 2 +- libsrc/geos-common/mousesprite/drawsprite.s | 2 +- libsrc/geos-common/mousesprite/enablsprite.s | 2 +- .../geos-common/mousesprite/inittextprompt.s | 2 +- libsrc/geos-common/mousesprite/mouseoff.s | 2 +- libsrc/geos-common/mousesprite/mouseup.s | 2 +- libsrc/geos-common/mousesprite/possprite.s | 2 +- .../geos-common/mousesprite/startmousemode.s | 2 +- libsrc/geos-common/system/callroutine.s | 2 +- libsrc/geos-common/system/firstinit.s | 2 +- libsrc/geos-common/system/panic.s | 2 +- libsrc/osic1p/osiscreen.inc | 23 ++++++++++--------- test/err/cc65091001.c | 2 +- test/ref/cc65070303.c | 2 +- test/ref/cc65080227.c | 2 +- test/ref/cc65101209.c | 2 +- test/ref/cc65101216.c | 2 +- test/val/cc65091020.c | 2 +- 30 files changed, 41 insertions(+), 41 deletions(-) diff --git a/libsrc/apple2/color.s b/libsrc/apple2/color.s index 3b0c5b6d4..c54207288 100644 --- a/libsrc/apple2/color.s +++ b/libsrc/apple2/color.s @@ -13,4 +13,4 @@ _textcolor := return1 _bgcolor := return0 -_bordercolor := return0 \ No newline at end of file +_bordercolor := return0 diff --git a/libsrc/geos-cbm/system/initdoneio.s b/libsrc/geos-cbm/system/initdoneio.s index b5e51524a..4b8762bad 100644 --- a/libsrc/geos-cbm/system/initdoneio.s +++ b/libsrc/geos-cbm/system/initdoneio.s @@ -11,5 +11,5 @@ .include "jumptab.inc" _InitForIO = InitForIO - -_DoneWithIO = DoneWithIO \ No newline at end of file + +_DoneWithIO = DoneWithIO diff --git a/libsrc/geos-cbm/system/tobasic.s b/libsrc/geos-cbm/system/tobasic.s index cb47da531..59bdc2936 100644 --- a/libsrc/geos-cbm/system/tobasic.s +++ b/libsrc/geos-cbm/system/tobasic.s @@ -9,4 +9,4 @@ .include "jumptab.inc" -_ToBASIC = ToBASIC \ No newline at end of file +_ToBASIC = ToBASIC diff --git a/libsrc/geos-common/memory/crc.s b/libsrc/geos-common/memory/crc.s index 9ec2feb0c..94ab98f34 100644 --- a/libsrc/geos-common/memory/crc.s +++ b/libsrc/geos-common/memory/crc.s @@ -17,4 +17,3 @@ _CRC: lda r2L ldx r2H rts - \ No newline at end of file diff --git a/libsrc/geos-common/menuicon/doicons.s b/libsrc/geos-common/menuicon/doicons.s index 5ddf06d01..b0456e67f 100644 --- a/libsrc/geos-common/menuicon/doicons.s +++ b/libsrc/geos-common/menuicon/doicons.s @@ -13,4 +13,4 @@ _DoIcons: sta r0L stx r0H - jmp DoIcons \ No newline at end of file + jmp DoIcons diff --git a/libsrc/geos-common/menuicon/domenu.s b/libsrc/geos-common/menuicon/domenu.s index 1624a3852..43a2b5a0c 100644 --- a/libsrc/geos-common/menuicon/domenu.s +++ b/libsrc/geos-common/menuicon/domenu.s @@ -14,4 +14,4 @@ _DoMenu: sta r0L stx r0H lda #0 - jmp DoMenu \ No newline at end of file + jmp DoMenu diff --git a/libsrc/geos-common/menuicon/dopreviousmenu.s b/libsrc/geos-common/menuicon/dopreviousmenu.s index 5ac19b57a..1a92e1fe1 100644 --- a/libsrc/geos-common/menuicon/dopreviousmenu.s +++ b/libsrc/geos-common/menuicon/dopreviousmenu.s @@ -9,4 +9,4 @@ .include "jumptab.inc" -_DoPreviousMenu = DoPreviousMenu \ No newline at end of file +_DoPreviousMenu = DoPreviousMenu diff --git a/libsrc/geos-common/menuicon/gotofirstmenu.s b/libsrc/geos-common/menuicon/gotofirstmenu.s index b5f2306db..a8d00b132 100644 --- a/libsrc/geos-common/menuicon/gotofirstmenu.s +++ b/libsrc/geos-common/menuicon/gotofirstmenu.s @@ -9,4 +9,4 @@ .include "jumptab.inc" -_GotoFirstMenu = GotoFirstMenu \ No newline at end of file +_GotoFirstMenu = GotoFirstMenu diff --git a/libsrc/geos-common/menuicon/recoverallmenus.s b/libsrc/geos-common/menuicon/recoverallmenus.s index 03a8368bf..0420e88be 100644 --- a/libsrc/geos-common/menuicon/recoverallmenus.s +++ b/libsrc/geos-common/menuicon/recoverallmenus.s @@ -9,4 +9,4 @@ .include "jumptab.inc" -_RecoverAllMenus = RecoverAllMenus \ No newline at end of file +_RecoverAllMenus = RecoverAllMenus diff --git a/libsrc/geos-common/menuicon/recovermenu.s b/libsrc/geos-common/menuicon/recovermenu.s index 638d03d16..a8a6870c7 100644 --- a/libsrc/geos-common/menuicon/recovermenu.s +++ b/libsrc/geos-common/menuicon/recovermenu.s @@ -9,4 +9,4 @@ .include "jumptab.inc" -_RecoverMenu = RecoverMenu \ No newline at end of file +_RecoverMenu = RecoverMenu diff --git a/libsrc/geos-common/menuicon/redomenu.s b/libsrc/geos-common/menuicon/redomenu.s index 44d62e807..818102f8b 100644 --- a/libsrc/geos-common/menuicon/redomenu.s +++ b/libsrc/geos-common/menuicon/redomenu.s @@ -9,4 +9,4 @@ .include "jumptab.inc" -_ReDoMenu = ReDoMenu \ No newline at end of file +_ReDoMenu = ReDoMenu diff --git a/libsrc/geos-common/mousesprite/clearmousemode.s b/libsrc/geos-common/mousesprite/clearmousemode.s index 01e659567..635a0fcd4 100644 --- a/libsrc/geos-common/mousesprite/clearmousemode.s +++ b/libsrc/geos-common/mousesprite/clearmousemode.s @@ -9,4 +9,4 @@ .include "jumptab.inc" -_ClearMouseMode = ClearMouseMode \ No newline at end of file +_ClearMouseMode = ClearMouseMode diff --git a/libsrc/geos-common/mousesprite/disablsprite.s b/libsrc/geos-common/mousesprite/disablsprite.s index 95d298094..e6c769e29 100644 --- a/libsrc/geos-common/mousesprite/disablsprite.s +++ b/libsrc/geos-common/mousesprite/disablsprite.s @@ -12,4 +12,4 @@ _DisablSprite: sta r3L - jmp DisablSprite \ No newline at end of file + jmp DisablSprite diff --git a/libsrc/geos-common/mousesprite/drawsprite.s b/libsrc/geos-common/mousesprite/drawsprite.s index 0f4d611c0..90382c63c 100644 --- a/libsrc/geos-common/mousesprite/drawsprite.s +++ b/libsrc/geos-common/mousesprite/drawsprite.s @@ -16,4 +16,4 @@ _DrawSprite: stx r4H jsr popa sta r3L - jmp DrawSprite \ No newline at end of file + jmp DrawSprite diff --git a/libsrc/geos-common/mousesprite/enablsprite.s b/libsrc/geos-common/mousesprite/enablsprite.s index a271d2cdb..404a7cb05 100644 --- a/libsrc/geos-common/mousesprite/enablsprite.s +++ b/libsrc/geos-common/mousesprite/enablsprite.s @@ -12,4 +12,4 @@ _EnablSprite: sta r3L - jmp EnablSprite \ No newline at end of file + jmp EnablSprite diff --git a/libsrc/geos-common/mousesprite/inittextprompt.s b/libsrc/geos-common/mousesprite/inittextprompt.s index 2fc5e58fc..e0c4cc1cd 100644 --- a/libsrc/geos-common/mousesprite/inittextprompt.s +++ b/libsrc/geos-common/mousesprite/inittextprompt.s @@ -9,4 +9,4 @@ .include "jumptab.inc" -_InitTextPrompt = InitTextPrompt \ No newline at end of file +_InitTextPrompt = InitTextPrompt diff --git a/libsrc/geos-common/mousesprite/mouseoff.s b/libsrc/geos-common/mousesprite/mouseoff.s index a918bb612..b48d30807 100644 --- a/libsrc/geos-common/mousesprite/mouseoff.s +++ b/libsrc/geos-common/mousesprite/mouseoff.s @@ -9,4 +9,4 @@ .include "jumptab.inc" -_MouseOff = MouseOff \ No newline at end of file +_MouseOff = MouseOff diff --git a/libsrc/geos-common/mousesprite/mouseup.s b/libsrc/geos-common/mousesprite/mouseup.s index 45b4e83c2..8f7b4e0f6 100644 --- a/libsrc/geos-common/mousesprite/mouseup.s +++ b/libsrc/geos-common/mousesprite/mouseup.s @@ -9,4 +9,4 @@ .include "jumptab.inc" -_MouseUp = MouseUp \ No newline at end of file +_MouseUp = MouseUp diff --git a/libsrc/geos-common/mousesprite/possprite.s b/libsrc/geos-common/mousesprite/possprite.s index 24e8bd14c..5543cb3c6 100644 --- a/libsrc/geos-common/mousesprite/possprite.s +++ b/libsrc/geos-common/mousesprite/possprite.s @@ -26,4 +26,4 @@ _PosSprite: sta r5L jsr popa sta r3L - jmp PosSprite \ No newline at end of file + jmp PosSprite diff --git a/libsrc/geos-common/mousesprite/startmousemode.s b/libsrc/geos-common/mousesprite/startmousemode.s index 06a547714..26d969744 100644 --- a/libsrc/geos-common/mousesprite/startmousemode.s +++ b/libsrc/geos-common/mousesprite/startmousemode.s @@ -11,4 +11,4 @@ _StartMouseMode: clc - jmp StartMouseMode \ No newline at end of file + jmp StartMouseMode diff --git a/libsrc/geos-common/system/callroutine.s b/libsrc/geos-common/system/callroutine.s index 54de4cac7..3213d507e 100644 --- a/libsrc/geos-common/system/callroutine.s +++ b/libsrc/geos-common/system/callroutine.s @@ -9,4 +9,4 @@ .include "jumptab.inc" -_CallRoutine = CallRoutine \ No newline at end of file +_CallRoutine = CallRoutine diff --git a/libsrc/geos-common/system/firstinit.s b/libsrc/geos-common/system/firstinit.s index c0695ee47..617ecf4d6 100644 --- a/libsrc/geos-common/system/firstinit.s +++ b/libsrc/geos-common/system/firstinit.s @@ -9,4 +9,4 @@ .include "jumptab.inc" -_FirstInit = FirstInit \ No newline at end of file +_FirstInit = FirstInit diff --git a/libsrc/geos-common/system/panic.s b/libsrc/geos-common/system/panic.s index 9ea916023..d34b74a5a 100644 --- a/libsrc/geos-common/system/panic.s +++ b/libsrc/geos-common/system/panic.s @@ -9,4 +9,4 @@ .include "jumptab.inc" -_Panic = Panic \ No newline at end of file +_Panic = Panic diff --git a/libsrc/osic1p/osiscreen.inc b/libsrc/osic1p/osiscreen.inc index 9399d7eee..ee2e52174 100644 --- a/libsrc/osic1p/osiscreen.inc +++ b/libsrc/osic1p/osiscreen.inc @@ -3,7 +3,7 @@ ; .include "extzp.inc" - + .linecont + ; @@ -13,7 +13,7 @@ ; Macro implementation of internal screensize ; function for given width and height in ; characters - + .export screensize .proc screensize @@ -34,11 +34,11 @@ lda #ScrBase ; memset appropriately jsr pushax - + lda #' ' ldx #$00 jsr pushax - + lda #ScrRamSize jsr _memset @@ -46,7 +46,7 @@ lda #$00 ; Cursor in upper left corner sta CURS_X sta CURS_Y - + jmp plot ; Set the cursor position .endproc @@ -112,12 +112,12 @@ newline: lda #<(ScrBase + ScrFirstChar) ldx #>(ScrBase + ScrFirstChar) jsr pushax - + ; Scroll source address lda #<(ScrBase + ScrFirstChar + ScrollDist) ldx #>(ScrBase + ScrFirstChar + ScrollDist) jsr pushax - + ; Number of characters to move lda #ScrollLength @@ -129,7 +129,7 @@ newline: sta ptr1 lda #>(ScrBase + ScrFirstChar + ScrollLength) sta ptr1+1 - + ldy #ScrWidth ; Fill last line with blanks lda #' ' clrln: sta (ptr1),y @@ -150,7 +150,7 @@ putchar: ldy CURS_X sta (SCREEN_PTR),y ; Set char rts - + .endmacro .macro osi_screen_funcs ScrBase, ScrRamSize, ScrFirstChar, \ @@ -167,12 +167,13 @@ ScrTabLo: .repeat ScrHeight, I .byte <(ScrBase + ScrFirstChar + I * ScrollDist) .endrep - + ScrTabHi: .repeat ScrHeight, I .byte >(ScrBase + ScrFirstChar + I * ScrollDist) .endrep + .code osi_cputfuncs ScrBase, ScrFirstChar, ScrWidth, ScrHeight, \ @@ -180,4 +181,4 @@ osi_cputfuncs ScrBase, ScrFirstChar, ScrWidth, ScrHeight, \ osi_screensize ScrWidth, ScrHeight osi_clrscr ScrBase, ScrRamSize -.endmacro \ No newline at end of file +.endmacro diff --git a/test/err/cc65091001.c b/test/err/cc65091001.c index 65ce6ec83..8bcf158ac 100644 --- a/test/err/cc65091001.c +++ b/test/err/cc65091001.c @@ -27,4 +27,4 @@ int main() { printf("it works :)\n"); return 0; -} \ No newline at end of file +} diff --git a/test/ref/cc65070303.c b/test/ref/cc65070303.c index 6dbceeefc..049f14c40 100644 --- a/test/ref/cc65070303.c +++ b/test/ref/cc65070303.c @@ -35,4 +35,4 @@ seems to work. greetings,    Andreas -*/ \ No newline at end of file +*/ diff --git a/test/ref/cc65080227.c b/test/ref/cc65080227.c index 78afbb2c2..b6d068b2a 100644 --- a/test/ref/cc65080227.c +++ b/test/ref/cc65080227.c @@ -36,4 +36,4 @@ int main(void) 000023r 1 A4 rr ldy sreg 000025r 1 8C rr rr sty _b+2 000028r 1 8C rr rr sty _b+3 ; lost 4th BYTE ! -*/ \ No newline at end of file +*/ diff --git a/test/ref/cc65101209.c b/test/ref/cc65101209.c index c14543640..daeab8509 100644 --- a/test/ref/cc65101209.c +++ b/test/ref/cc65101209.c @@ -35,4 +35,4 @@ So testing with 999 gives: 999 mod 999 is 0 This seems to be systematic. -*/ \ No newline at end of file +*/ diff --git a/test/ref/cc65101216.c b/test/ref/cc65101216.c index eaaf0b3e4..1f6101afa 100644 --- a/test/ref/cc65101216.c +++ b/test/ref/cc65101216.c @@ -24,4 +24,4 @@ int main() printf("a / b = %d", c); return 0; -} \ No newline at end of file +} diff --git a/test/val/cc65091020.c b/test/val/cc65091020.c index d23b70a06..8f6b11761 100644 --- a/test/val/cc65091020.c +++ b/test/val/cc65091020.c @@ -24,4 +24,4 @@ int main() { return 0; } -/* Assert fails. (SVN rev 4381) */ \ No newline at end of file +/* Assert fails. (SVN rev 4381) */ From c977afe0b82884c32030e0e4d8764bd9e3a481c8 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 16 Apr 2022 19:59:25 +0200 Subject: [PATCH 15/33] add comment explaining what the empty file is about --- libsrc/cx16/cpeeks.s | 1 + 1 file changed, 1 insertion(+) diff --git a/libsrc/cx16/cpeeks.s b/libsrc/cx16/cpeeks.s index e69de29bb..281cbd75d 100644 --- a/libsrc/cx16/cpeeks.s +++ b/libsrc/cx16/cpeeks.s @@ -0,0 +1 @@ +; empty file to prevent cbm/cpeeks.s being pulled into the cx16 lib From eb04ce8190260e6add52730f35fba3fe864bf5be Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 16 Apr 2022 20:00:10 +0200 Subject: [PATCH 16/33] add more style checks --- .github/checks/Makefile | 10 +++++++++- .github/checks/lastline.sh | 22 ++++++++++++++++++++++ .github/checks/spaces.sh | 16 ++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100755 .github/checks/lastline.sh create mode 100755 .github/checks/spaces.sh diff --git a/.github/checks/Makefile b/.github/checks/Makefile index 3e85c0fd7..827606d01 100644 --- a/.github/checks/Makefile +++ b/.github/checks/Makefile @@ -1,7 +1,15 @@ .PHONY: tabs -check: tabs +check: tabs lastline tabs: tabs.sh @./tabs.sh + +lastline: lastline.sh + @./lastline.sh + +# checks that will currently fail (on a lot of files), so they are not included +# in the general "check" action +spaces: spaces.sh + @./spaces.sh diff --git a/.github/checks/lastline.sh b/.github/checks/lastline.sh new file mode 100755 index 000000000..d455481d1 --- /dev/null +++ b/.github/checks/lastline.sh @@ -0,0 +1,22 @@ +#! /bin/bash +OLDCWD=`pwd` +SCRIPT_PATH=`dirname $0` +cd $SCRIPT_PATH/../../ + +nl=' +' +nl=$'\n' +FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.c -o -name \*.s -o -name \*.h -o -name \*.asm -o -name \*.sgml \) -print | while read f; do + t=$(tail -c2 $f; printf x); r1="${nl}$"; + [[ ${t%x} =~ $r1 ]] || echo "$f" +done` + +cd $OLDCWD + +if [ x"$FILES"x != xx ]; then + echo "error: found following files that have no newline at the end:" + for n in $FILES; do + echo $n + done + exit -1 +fi diff --git a/.github/checks/spaces.sh b/.github/checks/spaces.sh new file mode 100755 index 000000000..309ba9ac1 --- /dev/null +++ b/.github/checks/spaces.sh @@ -0,0 +1,16 @@ +#! /bin/bash +OLDCWD=`pwd` +SCRIPT_PATH=`dirname $0` +cd $SCRIPT_PATH/../../ + +FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.c -o -name \*.s -o -name \*.h -o -name \*.asm -o -name \*.sgml \) -print | xargs grep -l ' $' | grep -v "libwrk/" | grep -v "testwrk/"` + +cd $OLDCWD + +if [ x"$FILES"x != xx ]; then + echo "error: found dangling spaces in the following files:" + for n in $FILES; do + echo $n + done + exit -1 +fi From 945291fd69d9eed21a4ccd1b1859423222d0a250 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 16 Apr 2022 22:08:03 +0200 Subject: [PATCH 17/33] updated a bit --- Contributing.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Contributing.md b/Contributing.md index 1aeae7786..c8681c7ee 100644 --- a/Contributing.md +++ b/Contributing.md @@ -11,8 +11,19 @@ This document contains all kinds of information that you should know if you want ## All Sources +### TABs and spaces + +This is an ongoing controversial topic - everyone knows that. However, the following is how we do it :) + * TAB characters must be expanded to spaces. +* 4 spaces per indention level (rather than 8) are preferred, especially if there are many different levels. +* No extra spaces at the end of lines. * All text files must end with new-line characters. Don't leave the last line "dangling". + +The (bash) scipts used to check the above rules can be found in ```.github/check``` + +### misc + * 80 characters is the desired maximum width of files. But, it isn't a "strong" rule; sometimes, you will want to type longer lines, in order to keep the parts of expressions or comments together on the same line. * You should avoid typing non-ASCII characters. * If you change "normal" source code into comments, then you must add a comment about why that code is a comment. @@ -78,6 +89,19 @@ color := $0787 * Two blank lines between `````` sections. * One blank line between other sections. +# Library implementation rules + +* By default the toolchain must output a "standard" binary for the platform, no emulator formats, no extra headers used by tools. If the resulting binaries can not be run as is on emulators or eg flash cartridges, the process of converting them to something that can be used with these should be documented in the user manual. +* Generally every function should live in a seperate source file - unless the functions are so closely related that splitting makes no sense. +* Source files should not contain commented out code - if they do, there should be a comment that explains why that commented out code exists. + +# Makefile rules + +* Makefiles must generally work on both *nix (ba)sh and windows cmd.exe. +* Makefiles must not use external tools that are not provided by the cc65 toolchain itself. + +The only exception to the above are actions that are exclusive to the github actions - those may rely on bash and/or linux tools. + # Documentation rules ## User manual (LinuxDoc) From bfb8568a5f45e9138bd3850be22675615c650265 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 17 Apr 2022 16:04:58 +0200 Subject: [PATCH 18/33] remove dangling spaces --- asminc/_file.inc | 2 +- asminc/atari5200.inc | 14 ++++++------ asminc/atari_antic.inc | 14 ++++++------ asminc/em-kernel.inc | 2 +- asminc/errno.inc | 2 +- asminc/lynx.inc | 16 ++++++------- asminc/opcodes.inc | 34 +++++++++++++-------------- asminc/telestrat.inc | 48 +++++++++++++++++++-------------------- asminc/tgi-vectorfont.inc | 2 +- asminc/utsname.inc | 2 +- asminc/zeropage.inc | 2 +- 11 files changed, 69 insertions(+), 69 deletions(-) diff --git a/asminc/_file.inc b/asminc/_file.inc index 2f9938a3e..a9ac1e34a 100644 --- a/asminc/_file.inc +++ b/asminc/_file.inc @@ -24,4 +24,4 @@ _FPUSHBACK = $08 ; File table .global __filetab - + diff --git a/asminc/atari5200.inc b/asminc/atari5200.inc index a17268de2..b560c06af 100644 --- a/asminc/atari5200.inc +++ b/asminc/atari5200.inc @@ -7,7 +7,7 @@ ;------------------------------------------------------------------------- ; ATASCII CHARACTER DEFS ;------------------------------------------------------------------------- - + ATEOL = $9B ; END-OF-LINE, used by CONIO ;------------------------------------------------------------------------- @@ -27,9 +27,9 @@ CH_VLINE = $01 ; exclamation mark POKMSK = $00 ; Mask for Pokey IRQ enable RTCLOK = $01 ; 60 hz. clock -JUMP = $01 +JUMP = $01 CRITIC = $03 ; Critical section -ATRACT = $04 ; Attract Mode +ATRACT = $04 ; Attract Mode SDLSTL = $05 ; DLISTL Shadow SDLSTH = $06 ; DLISTH " @@ -66,20 +66,20 @@ SAVMSC = $1B ; pointer to screen memory (conio) ;------------------------------------------------------------------------- ;Interrupt Vectors - -VIMIRQ = $0200 ; Immediate IRQ + +VIMIRQ = $0200 ; Immediate IRQ ; Preset $FC03 (SYSIRQ) VVBLKI = $0202 ; Vblank immediate ; Preset $FCB8 (SYSVBL) VVBLKD = $0204 ; Vblank deferred ; Preset $FCB2 (XITVBL) -VDSLST = $0206 ; Display List +VDSLST = $0206 ; Display List ; Preset $FEA1 (OSDLI) VKYBDI = $0208 ; Keyboard immediate ; Preset $FD02 (SYSKBD) VKYBDF = $020A ; Deferred Keyboard ; Preset $FCB2 (XITVBL) -VTRIGR = $020C ; Soft Trigger +VTRIGR = $020C ; Soft Trigger VBRKOP = $020E ; BRK Opcode VSERIN = $0210 ; Serial in Ready VSEROR = $0212 ; Serial Out Ready diff --git a/asminc/atari_antic.inc b/asminc/atari_antic.inc index a4557c7b4..9a097e05a 100644 --- a/asminc/atari_antic.inc +++ b/asminc/atari_antic.inc @@ -76,13 +76,13 @@ DL_CHR20x8x2 = 6 ; colour (duochrome per character), 20 character DL_CHR20x16x2 = 7 ; colour (duochrome per character), 20 character & 16 scanlines per mode line (GR. 2) DL_MAP40x8x4 = 8 ; colour, 40 pixel & 8 scanlines per mode line (GR. 3) -DL_MAP80x4x2 = 9 ; 'duochrome', 80 pixel & 4 scanlines per mode line (GR.4) -DL_MAP80x4x4 = 10 ; colour, 80 pixel & 4 scanlines per mode line (GR.5) -DL_MAP160x2x2 = 11 ; 'duochrome', 160 pixel & 2 scanlines per mode line (GR.6) -DL_MAP160x1x2 = 12 ; 'duochrome', 160 pixel & 1 scanline per mode line (GR.14) -DL_MAP160x2x4 = 13 ; 4 colours, 160 pixel & 2 scanlines per mode line (GR.7) -DL_MAP160x1x4 = 14 ; 4 colours, 160 pixel & 1 scanline per mode line (GR.15) -DL_MAP320x1x1 = 15 ; monochrome, 320 pixel & 1 scanline per mode line (GR.8) +DL_MAP80x4x2 = 9 ; 'duochrome', 80 pixel & 4 scanlines per mode line (GR.4) +DL_MAP80x4x4 = 10 ; colour, 80 pixel & 4 scanlines per mode line (GR.5) +DL_MAP160x2x2 = 11 ; 'duochrome', 160 pixel & 2 scanlines per mode line (GR.6) +DL_MAP160x1x2 = 12 ; 'duochrome', 160 pixel & 1 scanline per mode line (GR.14) +DL_MAP160x2x4 = 13 ; 4 colours, 160 pixel & 2 scanlines per mode line (GR.7) +DL_MAP160x1x4 = 14 ; 4 colours, 160 pixel & 1 scanline per mode line (GR.15) +DL_MAP320x1x1 = 15 ; monochrome, 320 pixel & 1 scanline per mode line (GR.8) ; modifiers on mode lines... diff --git a/asminc/em-kernel.inc b/asminc/em-kernel.inc index 889ffba98..9e89b6f4e 100644 --- a/asminc/em-kernel.inc +++ b/asminc/em-kernel.inc @@ -75,7 +75,7 @@ EMD_API_VERSION = $02 ;------------------------------------------------------------------------------ ; Driver entry points - + .global emd_install .global emd_uninstall .global emd_pagecount diff --git a/asminc/errno.inc b/asminc/errno.inc index 6e5cce42b..1efe88cda 100644 --- a/asminc/errno.inc +++ b/asminc/errno.inc @@ -1,4 +1,4 @@ -; +; ; Ullrich von Bassewitz, 16.05.2000 ; diff --git a/asminc/lynx.inc b/asminc/lynx.inc index 81a60bf2e..403d15d07 100644 --- a/asminc/lynx.inc +++ b/asminc/lynx.inc @@ -135,35 +135,35 @@ STIMCTLB = $FD1F TIM0BKUP = $FD00 TIM0CTLA = $FD01 TIM0CNT = $FD02 -TIM0CTLB = $FD03 +TIM0CTLB = $FD03 TIM1BKUP = $FD04 TIM1CTLA = $FD05 TIM1CNT = $FD06 -TIM1CTLB = $FD07 +TIM1CTLB = $FD07 TIM2BKUP = $FD08 TIM2CTLA = $FD09 TIM2CNT = $FD0A -TIM2CTLB = $FD0B +TIM2CTLB = $FD0B TIM3BKUP = $FD0C TIM3CTLA = $FD0D TIM3CNT = $FD0E -TIM3CTLB = $FD0F +TIM3CTLB = $FD0F TIM4BKUP = $FD10 TIM4CTLA = $FD11 TIM4CNT = $FD12 -TIM4CTLB = $FD13 +TIM4CTLB = $FD13 TIM5BKUP = $FD14 TIM5CTLA = $FD15 TIM5CNT = $FD16 -TIM5CTLB = $FD17 +TIM5CTLB = $FD17 TIM6BKUP = $FD18 TIM6CTLA = $FD19 TIM6CNT = $FD1A -TIM6CTLB = $FD1B +TIM6CTLB = $FD1B TIM7BKUP = $FD1C TIM7CTLA = $FD1D TIM7CNT = $FD1E -TIM7CTLB = $FD1F +TIM7CTLB = $FD1F ; Mikey Audio diff --git a/asminc/opcodes.inc b/asminc/opcodes.inc index e6b7e73df..b610360e1 100644 --- a/asminc/opcodes.inc +++ b/asminc/opcodes.inc @@ -3,23 +3,23 @@ ; ; Christian Krüger, latest change: 18-Sep-2010 ; -; This software is provided 'as-is', without any expressed or implied -; warranty. In no event will the authors be held liable for any damages -; arising from the use of this software. -; -; Permission is granted to anyone to use this software for any purpose, -; including commercial applications, and to alter it and redistribute it -; freely, subject to the following restrictions: -; -; 1. The origin of this software must not be misrepresented; you must not -; claim that you wrote the original software. If you use this software -; in a product, an acknowledgment in the product documentation would be -; appreciated but is not required. -; 2. Altered source versions must be plainly marked as such, and must not -; be misrepresented as being the original software. -; 3. This notice may not be removed or altered from any source -; distribution. -; +; This software is provided 'as-is', without any expressed or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not +; be misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source +; distribution. +; ; Opcode-Table ; ------------ diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index 79ac2d566..703dbaa3b 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -17,7 +17,7 @@ FNAME_LEN = 11 ; Maximum length of file-name ; --------------------------------------------------------------------------- ; I/O Identifier ; Theses identifers are used for channel management -; +; XKBD = $80 ; Keyboard XRSE = $83 ; RS232 in @@ -87,27 +87,27 @@ HRSFB := $57 VABKP1 := $58 ; RS232T -; b0-b3 : speed +; b0-b3 : speed ; 1111 => 19200 bps (please note that telestrat can't handle this speed without stopping all IRQ except ACIA's one) ; 1100 => 9600 bps (default from TELEMON) -; 1110 => 4800 bps -; 1010 => 2400 bps -; 1000 => 1200 bps -; 0111 => 600 bps -; 0110 => 300 bps -; 0101 => 150 bps -; 0010 => 75 bps +; 1110 => 4800 bps +; 1010 => 2400 bps +; 1000 => 1200 bps +; 0111 => 600 bps +; 0110 => 300 bps +; 0101 => 150 bps +; 0010 => 75 bps ; b4 : 0 external clock, 1 internal clock ; b6-b5 : 00 8 bits ; 01 7 bits ; 10 6 bits ; 11 5 bits -; b7 : 0 a stop +; b7 : 0 a stop RS232T := $59 -; RS232C +; RS232C ; b0-b3 : 0 ; b4 : 1 if echo ; b5 : 1 if parity @@ -218,7 +218,7 @@ SCREEN := $BB80 ; TELEMON primitives (2.4 & 3.x) -; all values are used to call bank 7 of telestrat cardridge. It works with 'brk value' +; all values are used to call bank 7 of telestrat cardridge. It works with 'brk value' XOP0 = $00 ; Open device on channel 0 XOP1 = $01 ; Open device on channel 1 XOP2 = $02 ; Open device on channel 2 @@ -281,8 +281,8 @@ XWRCLK = $3E ; Displays clock in the address in A & Y registe XSONPS = $40 ; Send data to PSG register (14 values) XOUPS = $42 ; Send Oups sound into PSG XPLAY = $43 ; Play a sound -XSOUND = $44 -XMUSIC = $45 +XSOUND = $44 +XMUSIC = $45 XZAP = $46 ; Send Zap sound to PSG XSHOOT = $47 @@ -303,13 +303,13 @@ XFWR = $4E ; Put a char on the first screen. Only available ; Keyboard primitives XALLKB = $50 ; Read Keyboard, and populate KBDCOL XKBDAS = $51 ; Ascii conversion -XGOKBD = $52 ; Swap keyboard type (Qwerty, French ...) +XGOKBD = $52 ; Swap keyboard type (Qwerty, French ...) ; Buffer management XECRBU = $54 ; Write A or AY in the buffer XLISBU = $55 ; Read A or AY in the buffer XTSTBU = $56 -XVIDBU = $57 ; Flush the buffer +XVIDBU = $57 ; Flush the buffer XINIBU = $58 ; Initialize the buffer X XDEFBU = $59 ; Reset all value of the buffer XBUSY = $5A ; Test if the buffer is empty @@ -328,7 +328,7 @@ XMSAVE = $61 ; Write a file to Minitel XFREE = $62 ; Only in TELEMON 3.x (bank 7 of Orix) -; Next Minitel primitives +; Next Minitel primitives XWCXFI = $63 ; Wait connection XLIGNE = $64 ; XDECON = $65 ; Minitel disconnection @@ -340,7 +340,7 @@ XHRSSE = $8C ; Set hires position cursor XDRAWA = $8D ; Draw a line absolute XDRAWR = $8E ; Draw a line (relative) XCIRCL = $8F ; Draw a circle -XCURSE = $90 ; Plot a pixel +XCURSE = $90 ; Plot a pixel XCURMO = $91 ; Move to x,y pos in Hires XPAPER = $92 XINK = $93 @@ -358,8 +358,8 @@ XPING = $9D ; Send Ping sound to PSG PWD_PTR = $00 ; --------------------------------------------------------------------------- -; -BUFTRV := $100 +; +BUFTRV := $100 ; --------------------------------------------------------------------------- @@ -377,7 +377,7 @@ TIMES := $211 TIMEM := $212 TIMEH := $213 FLGCLK := $214 -FLGCLK_FLAG := $215 +FLGCLK_FLAG := $215 FLGCUR := $216 ; Cursor management flag ; screens position managements @@ -466,7 +466,7 @@ DESALO := $52D FISALO := $52F EXSALO := $531 EXTDEF := $55D ; Default extension. At the start of telemon, it's set to ".COM" -BUFEDT := $590 ; Buffer edition +BUFEDT := $590 ; Buffer edition MAX_BUFEDT_LENGTH=110 @@ -480,7 +480,7 @@ BUFBUF := $c080 ; --------------------------------------------------------------------------- ; Stratsed vectors -; Stratsed is the main OS for Telestrat +; Stratsed is the main OS for Telestrat XMERGE := $FF0E XFST := $FF11 XSPUT := $FF14 @@ -532,7 +532,7 @@ XPMAP := $FFA7 XRWTS := $FFAA ; --------------------------------------------------------------------------- -; MACRO +; MACRO .macro BRK_TELEMON value .byte $00,value diff --git a/asminc/tgi-vectorfont.inc b/asminc/tgi-vectorfont.inc index ffe6ac686..124fe93cc 100644 --- a/asminc/tgi-vectorfont.inc +++ b/asminc/tgi-vectorfont.inc @@ -54,7 +54,7 @@ TGI_VF_CCOUNT = (TGI_VF_LASTCHAR - TGI_VF_FIRSTCHAR + 1) ; Font data loaded directly from file .struct TGI_VECTORFONT TOP .byte ; Height of char - BOTTOM .byte ; Descender + BOTTOM .byte ; Descender HEIGHT .byte ; Maximum char height WIDTHS .byte ::TGI_VF_CCOUNT ; Char widths CHARS .word ::TGI_VF_CCOUNT ; Pointer to character defs diff --git a/asminc/utsname.inc b/asminc/utsname.inc index 2c7052ce1..6d978dd21 100644 --- a/asminc/utsname.inc +++ b/asminc/utsname.inc @@ -33,7 +33,7 @@ -; Struct utsname +; Struct utsname .struct utsname sysname .byte 17 nodename .byte 9 diff --git a/asminc/zeropage.inc b/asminc/zeropage.inc index 1ba035868..6627d86b6 100644 --- a/asminc/zeropage.inc +++ b/asminc/zeropage.inc @@ -12,7 +12,7 @@ .globalzp ptr1, ptr2, ptr3, ptr4 .globalzp tmp1, tmp2, tmp3, tmp4 .globalzp regbank - + ; The size of the register bank regbanksize = 6 From 680f0c17f5175d4b67e276345b9d72b19ada525d Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 17 Apr 2022 16:05:10 +0200 Subject: [PATCH 19/33] remove dangling spaces --- doc/atari5200.sgml | 4 ++-- doc/ca65.sgml | 2 +- doc/da65.sgml | 10 +++++----- doc/geos.sgml | 2 +- doc/intro.sgml | 4 ++-- doc/lynx.sgml | 2 +- doc/sim65.sgml | 2 +- doc/sym1.sgml | 4 ++-- doc/telestrat.sgml | 14 +++++++------- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/doc/atari5200.sgml b/doc/atari5200.sgml index 599ffe3c9..29e6aadb3 100644 --- a/doc/atari5200.sgml +++ b/doc/atari5200.sgml @@ -84,7 +84,7 @@ The names are the usual ones you can find in system reference manuals. Example: tics = OS.rtclok[1] // get ticks ... - + Atari 5200 specific functions

@@ -221,7 +221,7 @@ you cannot use any of the following functions (and a few others): CAR format

-AtariROMMaker ( ) +AtariROMMaker ( ) can be used to create a ,.PDTV

- Enable the 6502DTV instruction set. This is a superset of the 6502 + Enable the 6502DTV instruction set. This is a superset of the 6502 instruction set. See: diff --git a/doc/da65.sgml b/doc/da65.sgml index 1702694a0..bf074a667 100644 --- a/doc/da65.sgml +++ b/doc/da65.sgml @@ -119,9 +119,9 @@ Here is a description of all the command line options: 4510 - 6502x is for the NMOS 6502 with unofficial opcodes. 6502dtv is for the - emulated CPU of the C64DTV device. huc6280 is the CPU of the PC engine. - 4510 is the CPU of the Commodore C65. Support for the 65816 currently + 6502x is for the NMOS 6502 with unofficial opcodes. 6502dtv is for the + emulated CPU of the C64DTV device. huc6280 is the CPU of the PC engine. + 4510 is the CPU of the Commodore C65. Support for the 65816 currently is not available. @@ -253,8 +253,8 @@ for this CPU. Invalid opcodes are translated into , the disassembler may be told to recognize either the 65SC02 or 65C02 CPUs. The latter understands the same opcodes as the former, plus 16 additional bit -manipulation and bit test-and-branch commands. Using 6502x as CPU the illegal -opcodes of 6502 CPU are detected and displayed. 6502dtv setting recognizes the +manipulation and bit test-and-branch commands. Using 6502x as CPU the illegal +opcodes of 6502 CPU are detected and displayed. 6502dtv setting recognizes the emulated CPU instructons of the C64DTV device. diff --git a/doc/geos.sgml b/doc/geos.sgml index c3601e741..8a43d134b 100644 --- a/doc/geos.sgml +++ b/doc/geos.sgml @@ -1332,7 +1332,7 @@ This function returns the GEOS Kernal version combined (by logical OR) with the

This function returns the PAL/NTSC flag combined (by logical OR) with the 40/80 columns flag. This is not the best way to check if the screen has 40 or 80 columns since a PAL/NTSC check is always -performed and it can take as long as a full raster frame. If you just want to know if the +performed and it can take as long as a full raster frame. If you just want to know if the screen has 40 or 80 columns use the expression : Emulates the Commander X16 Single Board Computer, with sound, SD card images, -VGA and NTSC video, and a NES game controller emulation. Includes a monitor. +VGA and NTSC video, and a NES game controller emulation. Includes a monitor. It runs on all SDL2 platforms. Compile the tutorial with @@ -459,7 +459,7 @@ Substitute the name of a Commodore computer for that File>Autostart disk/tape image..., choose your executable, +Choose File>Autostart disk/tape image..., choose your executable, and click #include #include -#include <6502.h> +#include <6502.h> void main(void) { tgi_install(tgi_static_stddrv); diff --git a/doc/sim65.sgml b/doc/sim65.sgml index 075d95849..310de4667 100644 --- a/doc/sim65.sgml +++ b/doc/sim65.sgml @@ -112,7 +112,7 @@ For a C test compiled and linked with @@ -227,10 +227,10 @@ Sedoric, Stratsed will be handled in these 3 primitives (fopen, fread, fclose). conio

-Functions textcolor and bgcolor are available only with Telemon 3.0 (Orix). -Telemon 2.4 primitives can't handle any change of colors in text mode except with XINK or -XPAPER primitives which put on the first and second columns ink and paper attributes. -The only way to change color on the same line for text is to handle it in pure assembly +Functions textcolor and bgcolor are available only with Telemon 3.0 (Orix). +Telemon 2.4 primitives can't handle any change of colors in text mode except with XINK or +XPAPER primitives which put on the first and second columns ink and paper attributes. +The only way to change color on the same line for text is to handle it in pure assembly without systems calls. Other hints

From 3c1641e3e31925f6f686b5f29312d5f12b166a93 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 17 Apr 2022 16:05:19 +0200 Subject: [PATCH 20/33] remove dangling spaces --- include/_antic.h | 2 +- include/_atari5200os.h | 16 ++-- include/_atarios.h | 210 ++++++++++++++++++++--------------------- include/_pokey.h | 4 +- include/accelerator.h | 2 +- include/apple2.h | 4 +- include/dbg.h | 4 +- include/errno.h | 2 +- include/geos/gmemory.h | 2 +- include/stdlib.h | 4 +- include/sys/utsname.h | 2 +- 11 files changed, 126 insertions(+), 126 deletions(-) diff --git a/include/_antic.h b/include/_antic.h index 717f7f820..742237332 100644 --- a/include/_antic.h +++ b/include/_antic.h @@ -137,7 +137,7 @@ struct __antic { ** Called during every vertical blank; see SYSVBV, VVBLKI, CRITIC, and VVBLKD, ** as well as the SETVBV routine. */ -#define NMIEN_VBI 0x40 +#define NMIEN_VBI 0x40 /* [Reset] key pressed */ #define NMIEN_RESET 0x20 diff --git a/include/_atari5200os.h b/include/_atari5200os.h index db0f7f0c9..5bba43016 100644 --- a/include/_atari5200os.h +++ b/include/_atari5200os.h @@ -31,19 +31,19 @@ struct __os { /*Page zero*/ - unsigned char pokmsk; // = $00 System mask for POKEY IRQ enable + unsigned char pokmsk; // = $00 System mask for POKEY IRQ enable unsigned char rtclok[2]; // = $01,$02 Real time clock - unsigned char critic; // = $03 Critical section flag + unsigned char critic; // = $03 Critical section flag unsigned char atract; // = $04 Attract mode counter - + union { struct { unsigned char sdlstl; // = $05 Save display list LO unsigned char sdlsth; // = $06 Save display list HI }; void* sdlst; // = $05,$06 Display list shadow - }; - + }; + unsigned char sdmctl; // = $07 DMACTL shadow unsigned char pcolr0; // = $08 PM color 0 unsigned char pcolr1; // = $09 PM color 1 @@ -55,10 +55,10 @@ struct __os { unsigned char color3; // = $0F PF color 3 unsigned char color4; // = $10 PF color 4 unsigned char _free_1[0xEF]; // = $11-$FF User space - + /*Stack*/ unsigned char stack[0x100]; // = $100-$1FF Stack - + /*Page 2 OS variables*/ void (*vinter)(void); // = $200 Immediate IRQ vector void (*vvblki)(void); // = $202 Immediate VBI vector @@ -74,7 +74,7 @@ struct __os { void (*vtimr1)(void); // = $216 POKEY timer 1 IRQ vector void (*vtimr2)(void); // = $218 POKEY timer 2 IRQ vector void (*vtimr4)(void); // = $21A POKEY timer 4 IRQ vector - + }; #endif diff --git a/include/_atarios.h b/include/_atarios.h index 986092659..ec33b98c9 100644 --- a/include/_atarios.h +++ b/include/_atarios.h @@ -66,7 +66,7 @@ struct __dcb { unsigned char dtimlo; /* device timeout in seconds */ unsigned char dunuse; /* - unused - */ unsigned int dbyt; /* # of bytes to transfer */ - union { + union { struct { unsigned char daux1; /* 1st command auxiliary byte */ unsigned char daux2; /* 2nd command auxiliary byte */ @@ -167,28 +167,28 @@ struct __os { #ifdef OSA unsigned char* linzbs; // = $00/$01 LINBUG RAM (WILL BE REPLACED BY MONITOR RAM) -#else +#else unsigned char linflg; // = $00 LNBUG FLAG (0 = NOT LNBUG) unsigned char ngflag; // = $01 MEMORY STATUS (0 = FAILURE) -#endif +#endif unsigned char* casini; // = $02/$03 CASSETTE INIT LOCATION unsigned char* ramlo; // = $04/$05 RAM POINTER FOR MEMORY TEST - -#ifdef OSA + +#ifdef OSA unsigned char tramsz; // = $06 FLAG FOR LEFT CARTRIDGE unsigned char tstdat; // = $07 FLAG FOR RIGHT CARTRIDGE -#else +#else unsigned char trnsmz; // = $06 TEMPORARY REGISTER FOR RAM SIZE unsigned char tstdat; // = $07 UNUSED (NOT TOUCHED DURING RESET/COLD START) #endif - - // Cleared upon Coldstart only - + + // Cleared upon Coldstart only + unsigned char warmst; // = $08 WARM START FLAG - unsigned char bootq; // = $09 SUCCESSFUL BOOT FLAG + unsigned char bootq; // = $09 SUCCESSFUL BOOT FLAG void (*dosvec)(void); // = $0A/$0B DISK SOFTWARE START VECTOR void (*dosini)(void); // = $0C/$0D DISK SOFTWARE INIT ADDRESS - unsigned char* appmhi; // = $0E/$0F APPLICATIONS MEMORY HI LIMIT + unsigned char* appmhi; // = $0E/$0F APPLICATIONS MEMORY HI LIMIT // Cleared upon Coldstart or Warmstart @@ -199,26 +199,26 @@ struct __os { unsigned char iccomt; // = $17 COMMAND FOR VECTOR unsigned char* dskfms; // = $18/$19 DISK FILE MANAGER POINTER unsigned char* dskutl; // = $1A/$1B DISK UTILITIES POINTER -#ifdef OSA +#ifdef OSA unsigned char ptimot; // = $1C PRINTER TIME OUT REGISTER unsigned char pbpnt; // = $1D PRINT BUFFER POINTER unsigned char pbufsz; // = $1E PRINT BUFFER SIZE unsigned char ptemp; // = $1F TEMPORARY REGISTER -#else +#else unsigned char abufpt[4]; // = $1C-$1F ACMI BUFFER POINTER AREA -#endif +#endif iocb_t ziocb; // = $20-$2F ZERO PAGE I/O CONTROL BLOCK - + unsigned char status; // = $30 INTERNAL STATUS STORAGE unsigned char chksum; // = $31 CHECKSUM (SINGLE BYTE SUM WITH CARRY) unsigned char* bufr; // = $32/$33 POINTER TO DATA BUFFER unsigned char* bfen; // = $34/$35 NEXT BYTE PAST END OF THE DATA BUFFER LO -#ifdef OSA +#ifdef OSA unsigned char cretry; // = $36 NUMBER OF COMMAND FRAME RETRIES unsigned char dretry; // = $37 NUMBER OF DEVICE RETRIES -#else +#else unsigned int ltemp; // = $36/$37 LOADER TEMPORARY -#endif +#endif unsigned char bufrfl; // = $38 DATA BUFFER FULL FLAG unsigned char recvdn; // = $39 RECEIVE DONE FLAG unsigned char xmtdon; // = $3A TRANSMISSION DONE FLAG @@ -227,22 +227,22 @@ struct __os { unsigned char bptr; // = $3D CASSETTE BUFFER POINTER unsigned char ftype; // = $3E CASSETTE IRG TYPE unsigned char feof; // = $3F CASSETTE EOF FLAG (0 // = QUIET) - + unsigned char freq; // = $40 CASSETTE BEEP COUNTER unsigned char soundr; // = $41 NOISY I/0 FLAG. (ZERO IS QUIET) unsigned char critic; // = $42 DEFINES CRITICAL SECTION (CRITICAL IF NON-Z) dos2x_t fmszpg; // = $43-$49 DISK FILE MANAGER SYSTEM ZERO PAGE -#ifdef OSA +#ifdef OSA unsigned char ckey; // = $4A FLAG SET WHEN GAME START PRESSED unsigned char cassbt; // = $4B CASSETTE BOOT FLAG -#else +#else void* zchain; // = $4A/$4B HANDLER LINKAGE CHAIN POINTER -#endif +#endif unsigned char dstat; // = $4C DISPLAY STATUS unsigned char atract; // = $4D ATRACT FLAG unsigned char drkmsk; // = $4E DARK ATRACT MASK unsigned char colrsh; // = $4F ATRACT COLOR SHIFTER (EOR'ED WITH PLAYFIELD - + unsigned char tmpchr; // = $50 TEMPORARY CHARACTER unsigned char hold1; // = $51 TEMPORARY unsigned char lmargn; // = $52 LEFT MARGIN (NORMALLY 2, CC65 C STARTUP CODE SETS IT TO 0) @@ -255,68 +255,68 @@ struct __os { unsigned int oldcol; // = $5B/$5C PRIOR COLUMN unsigned char oldchr; // = $5D DATA UNDER CURSOR unsigned char* oldadr; // = $5E/$5F SAVED CURSOR MEMORY ADDRESS - -#ifdef OSA + +#ifdef OSA unsigned char newrow; // = $60 POINT DRAW GOES TO unsigned int newcol; // = $61/$62 COLUMN DRAW GOES TO -#else +#else unsigned char* fkdef; // = $60/$61 FUNCTION KEY DEFINITION TABLE unsigned char palnts; // = $62 PAL/NTSC INDICATOR (0 // = NTSC) -#endif +#endif unsigned char logcol; // = $63 POINTS AT COLUMN IN LOGICAL LINE unsigned char* adress; // = $64/$65 TEMPORARY ADDRESS - unsigned int mlttmp; // = $66/$67 TEMPORARY / FIRST BYTE IS USED IN OPEN AS TEMP - unsigned int savadr; // = $68/$69 SAVED ADDRESS + unsigned int mlttmp; // = $66/$67 TEMPORARY / FIRST BYTE IS USED IN OPEN AS TEMP + unsigned int savadr; // = $68/$69 SAVED ADDRESS unsigned char ramtop; // = $6A RAM SIZE DEFINED BY POWER ON LOGIC unsigned char bufcnt; // = $6B BUFFER COUNT unsigned char* bufstr; // = $6C/$6D EDITOR GETCH POINTER unsigned char bitmsk; // = $6E BIT MASK unsigned char shfamt; // = $6F SHIFT AMOUNT FOR PIXEL JUSTIFUCATION - + unsigned int rowac; // = $70/$71 DRAW WORKING ROW unsigned int colac; // = $72/$73 DRAW WORKING COLUMN unsigned char* endpt; // = $74/$75 END POINT unsigned char deltar; // = $76 ROW DIFFERENCE unsigned int deltac; // = $77/$78 COLUMN DIFFERENCE -#ifdef OSA - unsigned char rowinc; // = $79 ROWINC +#ifdef OSA + unsigned char rowinc; // = $79 ROWINC unsigned char colinc; // = $7A COLINC -#else +#else unsigned char* keydef; // = $79/$7A 2-BYTE KEY DEFINITION TABLE ADDRESS -#endif +#endif unsigned char swpflg; // = $7B NON-0 1F TXT AND REGULAR RAM IS SWAPPED unsigned char holdch; // = $7C CH IS MOVED HERE IN KGETCH BEFORE CNTL & SH unsigned char insdat; // = $7D 1-BYTE TEMPORARY unsigned int countr; // = $7E/$7F 2-BYTE DRAW ITERATION COUNT - + unsigned char _free_1[0xD4-0x7F-1]; // USER SPACE - + // Floating Point Package Page Zero Address Equates - fpreg_t fpreg[4]; // = $D4-$EB 4 REGSITERS, ACCCESS LIKE "fpreg[FPIDX_R0].fr" - unsigned char frx; // = $EC 1-BYTE TEMPORARY + fpreg_t fpreg[4]; // = $D4-$EB 4 REGSITERS, ACCCESS LIKE "fpreg[FPIDX_R0].fr" + unsigned char frx; // = $EC 1-BYTE TEMPORARY unsigned char eexp; // = $ED VALUE OF EXP -#ifdef OS_REV2 +#ifdef OS_REV2 unsigned char frsign; // = $EE ##REV2## 1-BYTE FLOATING POINT SIGN unsigned char plycnt; // = $EF ##REV2## 1-BYTE POLYNOMIAL DEGREE unsigned char sgnflg; // = $F0 ##REV2## 1-BYTE SIGN FLAG unsigned char xfmflg; // = $F1 ##REV2## 1-BYTE TRANSFORM FLAG -#else +#else unsigned char nsign; // = $EE SIGN OF # unsigned char esign; // = $EF SIGN OF EXPONENT unsigned char fchrflg; // = $F0 1ST CHAR FLAG unsigned char digrt; // = $F1 # OF DIGITS RIGHT OF DECIMAL -#endif +#endif unsigned char cix; // = $F2 CURRENT INPUT INDEX - unsigned char* inbuff; // = $F3/$F4 POINTS TO USER'S LINE INPUT BUFFER + unsigned char* inbuff; // = $F3/$F4 POINTS TO USER'S LINE INPUT BUFFER unsigned int ztemp1; // = $F5/$F6 2-BYTE TEMPORARY unsigned int ztemp4; // = $F7/$F8 2-BYTE TEMPORARY unsigned int ztemp3; // = $F9/$FA 2-BYTE TEMPORARY - - union { + + union { unsigned char degflg; // = $FB ##OLD## SAME AS RADFLG unsigned char radflg; // = $FB ##OLD## 0=RADIANS, 6=DEGREES }; - + fpreg_t* flptr; // = $FC/$FD 2-BYTE FLOATING POINT NUMBER POINTER fpreg_t* fptr2; // = $FE/$FF 2-BYTE FLOATING POINT NUMBER POINTER @@ -356,28 +356,28 @@ struct __os { union { struct { unsigned char sdlstl; // = $0230 SAVE DISPLAY LIST LOW BYTE - unsigned char sdlsth; // = $0231 SAVE DISPLAY LIST HI BYTE + unsigned char sdlsth; // = $0231 SAVE DISPLAY LIST HI BYTE }; void* sdlst; // = $0230/$0231 (same as above as pointer) }; unsigned char sskctl; // = $0232 SKCTL REGISTER RAM -#ifdef OSA +#ifdef OSA unsigned char _spare_1; // = $0233 No OS use. #else unsigned char lcount; // = $0233 ##1200xl## 1-byte relocating loader record -#endif +#endif unsigned char lpenh; // = $0234 LIGHT PEN HORIZONTAL VALUE unsigned char lpenv; // = $0235 LIGHT PEN VERTICAL VALUE void (*brkky)(void); // = $0236/$0237 BREAK KEY VECTOR -#ifdef OSA +#ifdef OSA unsigned char spare2[2]; // = $0238/$0239 No OS use. -#else +#else void (*vpirq)(void); // = $0238/$0239 ##rev2## 2-byte parallel device IRQ vector -#endif +#endif unsigned char cdevic; // = $023A COMMAND FRAME BUFFER - DEVICE unsigned char ccomnd; // = $023B COMMAND union { - struct { + struct { unsigned char caux1; // = $023C COMMAND AUX BYTE 1 unsigned char caux2; // = $023D COMMAND AUX BYTE 2 }; @@ -389,15 +389,15 @@ struct __os { unsigned char dbsect; // = $0241 NUMBER OF DISK BOOT SECTORS unsigned char* bootad; // = $0242/$0243 ADDRESS WHERE DISK BOOT LOADER WILL BE PUT unsigned char coldst; // = $0244 COLDSTART FLAG (1=IN MIDDLE OF COLDSTART> -#ifdef OSA +#ifdef OSA unsigned char spare3; // = $0245 No OS use. -#else +#else unsigned char reclen; // = $0245 ##1200xl## 1-byte relocating loader record length -#endif +#endif unsigned char dsktim; // = $0246 DISK TIME OUT REGISTER -#ifdef OSA +#ifdef OSA unsigned char linbuf[40]; // = $0247-$026E ##old## CHAR LINE BUFFER -#else +#else unsigned char pdvmsk; // = $0247 ##rev2## 1-byte parallel device selection mask unsigned char shpdvs; // = $0248 ##rev2## 1-byte PDVS (parallel device select) unsigned char pdimsk; // = $0249 ##rev2## 1-byte parallel device IRQ selection @@ -409,7 +409,7 @@ struct __os { unsigned char vsflag; // = $026C ##1200xl## 1-byte fine vertical scroll count unsigned char keydis; // = $026D ##1200xl## 1-byte keyboard disable unsigned char fine; // = $026E ##1200xl## 1-byte fine scrolling mode -#endif +#endif unsigned char gprior; // = $026F GLOBAL PRIORITY CELL unsigned char paddl0; // = $0270 1-BYTE POTENTIOMETER 0 unsigned char paddl1; // = $0271 1-BYTE POTENTIOMETER 1 @@ -435,30 +435,30 @@ struct __os { unsigned char strig1; // = $0285 1-BYTE JOYSTICK TRIGGER 1 unsigned char strig2; // = $0286 1-BYTE JOYSTICK TRIGGER 2 unsigned char strig3; // = $0287 1-BYTE JOYSTICK TRIGGER 3 -#ifdef OSA +#ifdef OSA unsigned char cstat; // = $0288 ##old## cassette status register -#else +#else unsigned char hibyte; // = $0288 ##1200xl## 1-byte relocating loader high byte -#endif +#endif unsigned char wmode; // = $0289 1-byte cassette WRITE mode unsigned char blim; // = $028A 1-byte cassette buffer limit #ifdef OSA unsigned char _reserved_2[5]; // = $028B-$028F RESERVED -#else +#else unsigned char imask; // = $028B ##rev2## (not used) void (*jveck)(void); // = $028C/$028D 2-byte jump vector unsigned newadr; // = $028E/028F ##1200xl## 2-byte relocating address -#endif +#endif unsigned char txtrow; // = $0290 TEXT ROWCRS unsigned txtcol; // = $0291/$0292 TEXT COLCRS unsigned char tindex; // = $0293 TEXT INDEX unsigned char* txtmsc; // = $0294/$0295 FOOLS CONVRT INTO NEW MSC unsigned char txtold[6]; // = $0296-$029B OLDROW & OLDCOL FOR TEXT (AND THEN SOME) -#ifdef OSA +#ifdef OSA unsigned char tmpx1; // = $029C ##old## 1--byte temporary register -#else +#else unsigned char cretry; // = $029C ##1200xl## 1-byte number of command frame retries -#endif +#endif unsigned char hold3; // = $029D 1-byte temporary unsigned char subtmp; // = $029E 1-byte temporary unsigned char hold2; // = $029F 1-byte (not used) @@ -473,41 +473,41 @@ struct __os { unsigned tmpcol; // = $02B9/$02BA 2-byte temporary column unsigned char scrflg; // = $02BB SET IF SCROLL OCCURS unsigned char hold4; // = $02BC TEMP CELL USED IN DRAW ONLY -#ifdef OSA +#ifdef OSA unsigned char hold5; // = $02BD ##old## DITTO -#else +#else unsigned char dretry; // = $02BD ##1200xl## 1-byte number of device retries -#endif +#endif unsigned char shflok; // = $02BE 1-byte shift/control lock flags unsigned char botscr; // = $02BF BOTTOM OF SCREEN 24 NORM 4 SPLIT unsigned char pcolr0; // = $02C0 1-byte player-missile 0 color/luminance unsigned char pcolr1; // = $02C1 1-byte player-missile 1 color/luminance unsigned char pcolr2; // = $02C2 1-byte player-missile 2 color/luminance - unsigned char pcolr3; // = $02C3 1-byte player-missile 3 color/luminance + unsigned char pcolr3; // = $02C3 1-byte player-missile 3 color/luminance unsigned char color0; // = $02C4 1-byte playfield 0 color/luminance unsigned char color1; // = $02C5 1-byte playfield 1 color/luminance unsigned char color2; // = $02C6 1-byte playfield 2 color/luminance unsigned char color3; // = $02C7 1-byte playfield 3 color/luminance unsigned char color4; // = $02C8 1-byte background color/luminance -#ifdef OSA +#ifdef OSA unsigned char _spare_2[23]; // = $02C9-$02DF No OS use. #else union { unsigned char parmbl[6]; // = $02C9 ##rev2## 6-byte relocating loader parameter - struct { + struct { void (*runadr)(void); // = $02C9 ##1200xl## 2-byte run address unsigned int hiused; // = $02CB ##1200xl## 2-byte highest non-zero page address unsigned int zhiuse; // = $02CD ##1200xl## 2-byte highest zero page address - }; - }; - union { + }; + }; + union { unsigned char oldpar[6]; // = $02CF ##rev2## 6-byte relocating loader parameter - struct { + struct { void (*gbytea)(void); // = $02CF ##1200xl## 2-byte GET-BYTE routine address unsigned int loadad; // = $02D1 ##1200xl## 2-byte non-zero page load address unsigned int zloada; // = $02D3 ##1200xl## 2-byte zero page load address - }; - }; + }; + }; unsigned int dsctln; // = $02D5 ##1200xl## 2-byte disk sector length unsigned int acmisr; // = $02D7 ##1200xl## 2-byte ACMI interrupt service routine unsigned char krpdel; // = $02D9 ##1200xl## 1-byte auto-repeat delay @@ -517,78 +517,78 @@ struct __os { unsigned char dmasav; // = $02DD ##1200xl## 1-byte SDMCTL save/restore unsigned char pbpnt; // = $02DE ##1200xl## 1-byte printer buffer pointer unsigned char pbufsz; // = $02DF ##1200xl## 1-byte printer buffer size -#endif - union { +#endif + union { unsigned char glbabs[4]; // = $02E0-$02E3 byte global variables for non-DOS users - struct { + struct { void (*runad)(void); // = $02E0 ##map## 2-byte binary file run address void (*initad)(void); // = $02E2 ##map## 2-byte binary file initialization address - }; - }; + }; + }; unsigned char ramsiz; // = $02E4 RAM SIZE (HI BYTE ONLY) void* memtop; // = $02E5 TOP OF AVAILABLE USER MEMORY void* memlo; // = $02E7 BOTTOM OF AVAILABLE USER MEMORY -#ifdef OSA +#ifdef OSA unsigned char _spare_3; // = $02E9 No OS use. -#else +#else unsigned char hndlod; // = $02E9 ##1200xl## 1-byte user load flag -#endif +#endif unsigned char dvstat[4]; // = $02EA-$02ED STATUS BUFFER - union { + union { unsigned int cbaud; // = $02EE/$02EF 2-byte cassette baud rate - struct { + struct { unsigned char cbaudl; // = $02EE 1-byte low cassette baud rate unsigned char cbaudh; // = $02EF 1-byte high cassette baud rate - }; - }; + }; + }; unsigned char crsinh; // = $02F0 CURSOR INHIBIT (00 = CURSOR ON) unsigned char keydel; // = $02F1 KEY DELAY unsigned char ch1; // = $02F2 1-byte prior keyboard character unsigned char chact; // = $02F3 CHACTL REGISTER RAM unsigned char chbas; // = $02F4 CHBAS REGISTER RAM -#ifdef OSA +#ifdef OSA unsigned char _spare_4[5]; // = $02F5-$02F9 No OS use. -#else +#else unsigned char newrow; // = $02F5 ##1200xl## 1-byte draw destination row unsigned int newcol; // = $02F6/$02F7 ##1200xl## 2-byte draw destination column unsigned char rowinc; // = $02F8 ##1200xl## 1-byte draw row increment unsigned char colinc; // = $02F9 ##1200xl## 1-byte draw column increment -#endif +#endif unsigned char char_; // = $02FA 1-byte internal character (naming changed due to do keyword conflict) unsigned char atachr; // = $02FB ATASCII CHARACTER unsigned char ch; // = $02FC GLOBAL VARIABLE FOR KEYBOARD unsigned char fildat; // = $02FD RIGHT FILL DATA unsigned char dspflg; // = $02FE DISPLAY FLAG DISPLAY CNTLS IF NON-ZERO unsigned char ssflag; // = $02FF START/STOP FLAG FOR PAGING (CNTL 1). CLEARE - + // --- Page 3 --- dcb_t dcb; // = $0300-$030B DEVICE CONTROL BLOCK unsigned int timer1; // = $030C/$030D INITIAL TIMER VALUE -#ifdef OSA +#ifdef OSA unsigned char addcor; // = $030E ##old## ADDITION CORRECTION -#else +#else unsigned char jmpers; // = $030E ##1200xl## 1-byte jumper options -#endif +#endif unsigned char casflg; // = $030F CASSETTE MODE WHEN SET unsigned int timer2; // = $0310/$0311 2-byte final baud rate timer value unsigned char temp1; // = $0312 TEMPORARY STORAGE REGISTER -#ifdef OSA +#ifdef OSA unsigned char _spare_5; // = $0313 unused unsigned char temp2; // = $0314 ##old## TEMPORARY STORAGE REGISTER -#else +#else unsigned char temp2; // = $0313 ##1200xl## 1-byte temporary unsigned char ptimot; // = $0314 ##1200xl## 1-byte printer timeout -#endif +#endif unsigned char temp3; // = $0315 TEMPORARY STORAGE REGISTER unsigned char savio; // = $0316 SAVE SERIAL IN DATA PORT unsigned char timflg; // = $0317 TIME OUT FLAG FOR BAUD RATE CORRECTION unsigned char stackp; // = $0318 SIO STACK POINTER SAVE CELL unsigned char tstat; // = $0319 TEMPORARY STATUS HOLDER -#ifdef OSA +#ifdef OSA hatabs_t hatabs[12]; // = $031A-$033D handler address table unsigned int zeropad; // = $033E/$033F zero padding -#else +#else hatabs_t hatabs[11]; // = $031A-$033A handler address table unsigned int zeropad; // = $033B/$033C zero padding unsigned char pupbt1; // = $033D ##1200xl## 1-byte power-up validation byte 1 @@ -598,9 +598,9 @@ struct __os { iocb_t iocb[8]; // = $0340-$03BF 8 I/O Control Blocks unsigned char prnbuf[40]; // = $03C0-$3E7 PRINTER BUFFER -#ifdef OSA +#ifdef OSA unsigned char _spare_6[151]; // = $03E8-$047F unused -#else +#else unsigned char superf; // = $03E8 ##1200xl## 1-byte editor super function flag unsigned char ckey; // = $03E9 ##1200xl## 1-byte cassette boot request flag unsigned char cassbt; // = $03EA ##1200xl## 1-byte cassette boot flag @@ -639,7 +639,7 @@ struct __basic { void* starp; // = $8C/$8D ADDRESS FOR THE STRING AND ARRAY TABLE void* runstk; // = $8E/$8F ADDRESS OF THE RUNTIME STACK void* memtop; // = $90/$91 POINTER TO THE TOP OF BASIC MEMORY - + unsigned char _internal_1[0xBA-0x91-1]; // INTERNAL DATA unsigned int stopln; // = $BA/$BB LINE WHERE A PROGRAM WAS STOPPED diff --git a/include/_pokey.h b/include/_pokey.h index 88d6949aa..15af4919e 100644 --- a/include/_pokey.h +++ b/include/_pokey.h @@ -131,7 +131,7 @@ struct __pokey_write { #define SKCTL_KEYBOARD_SCANNING 0x02 /* Enable keyboard scanning circuit */ /* Fast pot scan -** The pot scan counter completes its sequence in two TV line times instead of +** The pot scan counter completes its sequence in two TV line times instead of ** one frame time (228 scan lines). Not as accurate as the normal pot scan */ #define SKCTL_FAST_POT_SCAN 0x04 @@ -204,7 +204,7 @@ struct __pokey_read { #define SKSTAT_DATA_READ_INGORING_SHIFTREG 0x10 /* Data can be read directly from the serial input port, ignoring the shift register. */ #define SKSTAT_KEYBOARD_OVERRUN 0x20 /* Keyboard over-run; Reset BITs 7, 6 and 5 (latches) to 1, using SKREST */ #define SKSTAT_INPUT_OVERRUN 0x40 /* Serial data input over-run. Reset latches as above. */ -#define SKSTAT_INPUT_FRAMEERROR 0x80 /* Serial data input frame error caused by missing or extra bits. Reset latches as above. */ +#define SKSTAT_INPUT_FRAMEERROR 0x80 /* Serial data input frame error caused by missing or extra bits. Reset latches as above. */ /* KBCODE, internal keyboard codes for Atari 8-bit computers, diff --git a/include/accelerator.h b/include/accelerator.h index fdd2ebaf7..b5d8d0194 100644 --- a/include/accelerator.h +++ b/include/accelerator.h @@ -180,7 +180,7 @@ unsigned char detect_c128 (void); unsigned char __fastcall__ set_chameleon_speed (unsigned char speed); /* Set the speed of the C64 Chameleon cartridge, the following inputs - * are accepted: + * are accepted: * SPEED_SLOW : 1 Mhz mode * SPEED_1X : 1 Mhz mode * SPEED_2X : 2 Mhz mode diff --git a/include/apple2.h b/include/apple2.h index 57d7086ce..015e8f378 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -159,11 +159,11 @@ extern struct { unsigned day :5; unsigned mon :4; unsigned year :7; - } createdate; /* Current date: 0 */ + } createdate; /* Current date: 0 */ struct { unsigned char min; unsigned char hour; - } createtime; /* Current time: 0 */ + } createtime; /* Current time: 0 */ } _datetime; /* The addresses of the static drivers */ diff --git a/include/dbg.h b/include/dbg.h index 7b4f67e31..4cca826ec 100644 --- a/include/dbg.h +++ b/include/dbg.h @@ -39,7 +39,7 @@ ** are declared here. ** ** To use the debugger, just call DbgInit in your application. Once it has -** been called, the debugger will catch any BRK opcode. Use the BREAK macro +** been called, the debugger will catch any BRK opcode. Use the BREAK macro ** defined below to insert breakpoints into your code. ** ** There are currently a lot of things that cannot be debugged, graphical @@ -121,4 +121,4 @@ void __fastcall__ DbgInit (unsigned unused); - + diff --git a/include/errno.h b/include/errno.h index ae76b6c05..92d304938 100644 --- a/include/errno.h +++ b/include/errno.h @@ -84,7 +84,7 @@ extern int _errno; int __fastcall__ _osmaperrno (unsigned char oserror); -/* Map an operating system specific error code (for example from _oserror) +/* Map an operating system specific error code (for example from _oserror) ** into one of the E... codes above. It is user callable. */ diff --git a/include/geos/gmemory.h b/include/geos/gmemory.h index ba8e9f211..1e9ca83b4 100644 --- a/include/geos/gmemory.h +++ b/include/geos/gmemory.h @@ -12,7 +12,7 @@ void __fastcall__ CopyString(char *dest, const char *source); char __fastcall__ CmpString(const char *dest, const char *source); void __fastcall__ CopyFString(char len, char *dest, const char *source); -char __fastcall__ CmpFString(char len, char *dest, const char *source); +char __fastcall__ CmpFString(char len, char *dest, const char *source); unsigned __fastcall__ CRC(const char *buffer, unsigned len); void* __fastcall__ ClearRam(char *dest, unsigned len); diff --git a/include/stdlib.h b/include/stdlib.h index b929e8f02..99151317f 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -52,8 +52,8 @@ typedef unsigned size_t; /* Those non-standard cc65 exit constants definitions are in addition ** to the EXIT_SUCCESS and EXIT_FAILURE constants, which should not be -** redefined -*/ +** redefined +*/ #define EXIT_ASSERT 2 #define EXIT_ABORT 3 diff --git a/include/sys/utsname.h b/include/sys/utsname.h index a601d9eed..fdd87dec3 100644 --- a/include/sys/utsname.h +++ b/include/sys/utsname.h @@ -41,7 +41,7 @@ /*****************************************************************************/ /* Data */ /*****************************************************************************/ - + /* From f8f901b05e0bed721192132d85e50d14d2068adb Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 17 Apr 2022 16:06:22 +0200 Subject: [PATCH 21/33] remove dangling spaces --- libsrc/apple2/exec.s | 2 +- libsrc/apple2/iobuf.s | 2 +- libsrc/apple2/mcbdefault.s | 4 +- libsrc/apple2/mou/a2.stdmou.s | 16 +++--- libsrc/apple2/opendir.c | 2 +- libsrc/apple2/write.s | 2 +- libsrc/atari/break.s | 2 +- libsrc/atari/cclear.s | 2 +- libsrc/atari/ctype.s | 2 +- libsrc/atari/cvline.s | 2 +- libsrc/atari/diopncls.s | 2 +- libsrc/atari/dioqsize.s | 2 +- libsrc/atari/doesclrscr.s | 2 +- libsrc/atari/emd/atr130.s | 50 +++++++++---------- libsrc/atari/mcbtxtchar.s | 2 +- libsrc/atari/randomize.s | 2 +- libsrc/atari/revers.s | 2 +- libsrc/atari/shadow_ram_handlers.s | 6 +-- libsrc/atari/system_check.s | 2 +- libsrc/atari/xlmemchk.inc | 2 +- libsrc/atari5200/conioscreen.s | 2 +- libsrc/atari5200/cvline.s | 2 +- libsrc/atari5200/extra/conioscreen-20x12.s | 2 +- libsrc/atari5200/joy/atr5200std.s | 2 +- libsrc/atari5200/randomize.s | 2 +- libsrc/atari5200/y2k.inc | 14 +++--- libsrc/atari7800/crt0.s | 6 +-- libsrc/atari7800/joy/atari7800-stdjoy.s | 2 +- libsrc/atmos/cclear.s | 4 +- libsrc/atmos/ctype.s | 2 +- libsrc/c128/emd/c128-vdc.s | 18 +++---- libsrc/c64/sysuname.s | 2 +- libsrc/cbm/cbm_save.c | 4 +- libsrc/cbm/ctype.s | 2 +- libsrc/cbm/opendir.c | 2 +- libsrc/cbm610/revers.s | 2 +- libsrc/common/_heap.s | 2 +- libsrc/common/_heapmaxavail.s | 2 +- libsrc/common/_longminstr.c | 4 +- libsrc/common/_seterrno.s | 2 +- libsrc/common/abort.c | 2 +- libsrc/common/ctypemask.s | 2 +- libsrc/common/divt.s | 4 +- libsrc/common/doesclrscr.s | 2 +- libsrc/common/fread.s | 2 +- libsrc/common/free.s | 2 +- libsrc/common/fsetpos.c | 2 +- libsrc/common/fwrite.s | 2 +- libsrc/common/getcwd.s | 2 +- libsrc/common/ltoa.s | 6 +-- libsrc/common/memcpy.s | 2 +- libsrc/common/memset.s | 4 +- libsrc/common/mul20.s | 4 +- libsrc/common/mul40.s | 4 +- libsrc/common/putenv.s | 2 +- libsrc/common/raise.s | 6 +-- libsrc/common/rewind.c | 2 +- libsrc/common/strcspn.s | 2 +- libsrc/common/strncat.s | 6 +-- libsrc/common/strrchr.s | 4 +- libsrc/common/ungetc.s | 2 +- libsrc/common/vsprintf.s | 2 +- libsrc/conio/cputs.s | 2 +- libsrc/conio/scrsize.s | 4 +- libsrc/creativision/_scrsize.s | 6 +-- libsrc/creativision/boxchars.inc | 10 ++-- libsrc/dbg/asmtab.s | 2 +- libsrc/dbg/dbg.c | 6 +-- libsrc/dbg/dbgdasm.s | 2 +- libsrc/em/em_load.s | 2 +- libsrc/gamate/cputc.s | 14 +++--- libsrc/geos-apple/disk/exitturbo.s | 4 +- libsrc/geos-cbm/disk/changediskdevice.s | 2 +- libsrc/geos-cbm/disk/chkdkgeos.s | 2 +- libsrc/geos-cbm/disk/dio_cts.s | 16 +++--- libsrc/geos-cbm/disk/dio_openclose.s | 4 +- libsrc/geos-cbm/disk/dio_stc.s | 48 +++++++++--------- libsrc/geos-cbm/disk/enterturbo.s | 2 +- libsrc/geos-cbm/disk/exitturbo.s | 2 +- libsrc/geos-cbm/disk/findbambit.s | 2 +- libsrc/geos-cbm/disk/newdisk.s | 2 +- libsrc/geos-cbm/disk/purgeturbo.s | 2 +- libsrc/geos-cbm/disk/readblock.s | 2 +- libsrc/geos-cbm/disk/readbuff.s | 2 +- libsrc/geos-cbm/disk/verwriteblock.s | 2 +- libsrc/geos-cbm/disk/writeblock.s | 2 +- libsrc/geos-cbm/disk/writebuff.s | 2 +- libsrc/geos-cbm/emd/geos-vdc.s | 36 ++++++------- libsrc/geos-cbm/file/followchain.s | 2 +- libsrc/geos-cbm/graph/setnewmode.s | 2 +- libsrc/geos-cbm/system/setdevice.s | 2 +- libsrc/geos-cbm/tgi/geos-tgi.s | 6 +-- libsrc/geos-common/common/zerobss.s | 2 +- libsrc/geos-common/conio/_scrsize.s | 4 +- libsrc/geos-common/conio/cputc.s | 2 +- libsrc/geos-common/conio/cvline.s | 2 +- libsrc/geos-common/disk/blkalloc.s | 2 +- libsrc/geos-common/disk/calcblksfree.s | 2 +- libsrc/geos-common/disk/freeblock.s | 2 +- libsrc/geos-common/disk/getblock.s | 2 +- libsrc/geos-common/disk/getptrcurdknm.s | 4 +- libsrc/geos-common/disk/nxtblkalloc.s | 2 +- libsrc/geos-common/disk/opendisk.s | 2 +- libsrc/geos-common/disk/putblock.s | 2 +- libsrc/geos-common/disk/putdirhead.s | 2 +- libsrc/geos-common/disk/setnextfree.s | 2 +- libsrc/geos-common/dlgbox/rstrfrmdialogue.s | 2 +- libsrc/geos-common/drivers/fio_module.s | 8 +-- libsrc/geos-common/drivers/geos-stdmou.s | 2 +- libsrc/geos-common/file/appendrecord.s | 2 +- libsrc/geos-common/file/closerecordfile.s | 2 +- libsrc/geos-common/file/deletefile.s | 2 +- libsrc/geos-common/file/deleterecord.s | 2 +- libsrc/geos-common/file/findfile.s | 2 +- libsrc/geos-common/file/freefile.s | 2 +- libsrc/geos-common/file/getfhdrinfo.s | 2 +- libsrc/geos-common/file/getfile.s | 2 +- libsrc/geos-common/file/openrecordfile.s | 2 +- libsrc/geos-common/file/pointrecord.s | 2 +- libsrc/geos-common/file/readfile.s | 2 +- libsrc/geos-common/file/readrecord.s | 2 +- libsrc/geos-common/file/writerecord.s | 2 +- libsrc/geos-common/geosmac.inc | 4 +- libsrc/geos-common/graph/bitotherclip.s | 2 +- libsrc/geos-common/graph/framerectangle.s | 2 +- libsrc/geos-common/graph/imprintrectangle.s | 4 +- libsrc/geos-common/graph/invertline.s | 2 +- libsrc/geos-common/graph/invertrectangle.s | 2 +- libsrc/geos-common/graph/recoverline.s | 2 +- libsrc/geos-common/graph/recoverrectangle.s | 4 +- libsrc/geos-common/graph/rectangle.s | 2 +- libsrc/geos-common/graph/testpoint.s | 2 +- libsrc/geos-common/graph/verticalline.s | 4 +- .../geos-common/mousesprite/ismseinregion.s | 2 +- libsrc/geos-common/process/processblock.s | 4 +- libsrc/geos-common/process/processfreeze.s | 4 +- .../process/processinitrestartenable.s | 4 +- libsrc/joystick/joy_load.s | 2 +- libsrc/lynx/bllhdr.s | 2 +- libsrc/lynx/bootldr.s | 2 +- libsrc/lynx/cgetc.s | 2 +- libsrc/lynx/eeprom.s | 2 +- libsrc/lynx/eeprom46.s | 2 +- libsrc/lynx/eeprom66.s | 2 +- libsrc/lynx/eeprom86.s | 2 +- libsrc/lynx/exec.s | 2 +- libsrc/lynx/kbhit.s | 2 +- libsrc/lynx/lynx-cart.s | 6 +-- libsrc/mouse/mouse_load.s | 2 +- libsrc/mouse/mouse_move.s | 2 +- libsrc/nes/cclear.s | 2 +- libsrc/nes/chline.s | 2 +- libsrc/nes/gotoy.s | 2 +- libsrc/nes/ppubuf.s | 2 +- libsrc/nes/sysuname.s | 2 +- libsrc/osic1p/cclear.s | 2 +- libsrc/pce/cclear.s | 2 +- libsrc/plus4/randomize.s | 2 +- libsrc/runtime/add.s | 4 +- libsrc/runtime/aslax1.s | 2 +- libsrc/runtime/decsp1.s | 2 +- libsrc/runtime/incsp1.s | 2 +- libsrc/runtime/incsp3.s | 2 +- libsrc/runtime/incsp4.s | 2 +- libsrc/runtime/incsp5.s | 2 +- libsrc/runtime/incsp6.s | 2 +- libsrc/runtime/incsp7.s | 2 +- libsrc/runtime/land.s | 6 +-- libsrc/runtime/ldauisp.s | 2 +- libsrc/runtime/leave.s | 2 +- libsrc/runtime/leq.s | 2 +- libsrc/runtime/lmod.s | 2 +- libsrc/runtime/lmul.s | 6 +-- libsrc/runtime/lor.s | 6 +-- libsrc/runtime/lpop.s | 2 +- libsrc/runtime/lpush.s | 4 +- libsrc/runtime/lrsub.s | 2 +- libsrc/runtime/lsub.s | 2 +- libsrc/runtime/lsubeq.s | 10 ++-- libsrc/runtime/ltest.s | 2 +- libsrc/runtime/ludiv.s | 2 +- libsrc/runtime/lumod.s | 2 +- libsrc/runtime/lxor.s | 2 +- libsrc/runtime/mul.s | 4 +- libsrc/runtime/mulax3.s | 2 +- libsrc/runtime/or.s | 2 +- libsrc/runtime/pushaff.s | 2 +- libsrc/runtime/pushax.s | 2 +- libsrc/runtime/return0.s | 2 +- libsrc/runtime/return1.s | 2 +- libsrc/runtime/swap.s | 6 +-- libsrc/runtime/umod.s | 2 +- libsrc/runtime/umul16x16r32.s | 2 +- libsrc/sym1/read.s | 2 +- libsrc/sym1/write.s | 2 +- libsrc/telestrat/cclear.s | 4 +- libsrc/telestrat/chline.s | 4 +- libsrc/telestrat/clrscr.s | 8 +-- libsrc/telestrat/cputc.s | 12 ++--- libsrc/telestrat/gotoxy.s | 4 +- libsrc/telestrat/joy/telestrat.s | 12 ++--- libsrc/telestrat/orixhdr.s | 2 +- libsrc/telestrat/sound.s | 2 +- libsrc/telestrat/syschdir.s | 6 +-- libsrc/telestrat/sysmkdir.s | 8 +-- libsrc/telestrat/tgi/telestrat-228-200-3.s | 38 +++++++------- libsrc/telestrat/tgi/telestrat-240-200-2.s | 44 ++++++++-------- libsrc/tgi/tgi_gettextheight.s | 2 +- libsrc/tgi/tgi_imulround.s | 4 +- libsrc/tgi/tgi_lineto.s | 2 +- libsrc/tgi/tgi_outtext.s | 2 +- libsrc/tgi/tgidrv_line.inc | 2 +- 212 files changed, 432 insertions(+), 432 deletions(-) diff --git a/libsrc/apple2/exec.s b/libsrc/apple2/exec.s index 9212ecb8a..0ff4bc6f0 100644 --- a/libsrc/apple2/exec.s +++ b/libsrc/apple2/exec.s @@ -18,7 +18,7 @@ typerr: lda #$4A ; "Incompatible file format" ; Cleanup name oserr: jsr popname ; Preserves A - + ; Set __oserror jmp __mappederrno diff --git a/libsrc/apple2/iobuf.s b/libsrc/apple2/iobuf.s index 77433ce61..f5aacb74a 100644 --- a/libsrc/apple2/iobuf.s +++ b/libsrc/apple2/iobuf.s @@ -2,7 +2,7 @@ ; Oliver Schmidt, 10.9.2009 ; ; Default ProDOS 8 I/O buffer management -; +; .export iobuf_alloc, iobuf_free .import _posix_memalign, _free diff --git a/libsrc/apple2/mcbdefault.s b/libsrc/apple2/mcbdefault.s index c24c5df56..556a9d8fb 100644 --- a/libsrc/apple2/mcbdefault.s +++ b/libsrc/apple2/mcbdefault.s @@ -8,13 +8,13 @@ ; .export _mouse_def_callbacks - + .include "apple2.inc" ; ------------------------------------------------------------------------ .bss - + backup: .res 1 visible:.res 1 diff --git a/libsrc/apple2/mou/a2.stdmou.s b/libsrc/apple2/mou/a2.stdmou.s index c3d10f057..dfc69a942 100644 --- a/libsrc/apple2/mou/a2.stdmou.s +++ b/libsrc/apple2/mou/a2.stdmou.s @@ -152,7 +152,7 @@ next: inc ptr1+1 sta xparam+1 sta jump+2 - ; Disable interrupts now because setting the slot number makes + ; Disable interrupts now because setting the slot number makes ; the IRQ handler (maybe called due to some non-mouse IRQ) try ; calling the firmware which isn't correctly set up yet sei @@ -167,7 +167,7 @@ next: inc ptr1+1 asl asl sta yparam+1 - + ; The AppleMouse II Card needs the ROM switched in ; to be able to detect an Apple //e and use RDVBL bit $C082 @@ -175,7 +175,7 @@ next: inc ptr1+1 ; Reset mouse hardware ldx #INITMOUSE jsr firmware - + ; Switch in LC bank 2 for R/O bit $C080 @@ -236,12 +236,12 @@ UNINSTALL: SETBOX: sta ptr1 stx ptr1+1 - + ; Set x clamps ldx #$00 ldy #MOUSE_BOX::MINX jsr :+ - + ; Set y clamps ldx #$01 ldy #MOUSE_BOX::MINY @@ -257,7 +257,7 @@ SETBOX: sta pos1_lo iny lda (ptr1),y - sta box,y + sta box,y sta pos1_hi ; Skip one word @@ -267,11 +267,11 @@ SETBOX: ; Set high clamp iny lda (ptr1),y - sta box,y + sta box,y sta pos2_lo iny lda (ptr1),y - sta box,y + sta box,y sta pos2_hi txa diff --git a/libsrc/apple2/opendir.c b/libsrc/apple2/opendir.c index 040593118..1144d8511 100644 --- a/libsrc/apple2/opendir.c +++ b/libsrc/apple2/opendir.c @@ -57,7 +57,7 @@ extern char _cwd[FILENAME_MAX]; -DIR* __fastcall__ opendir (register const char* name) +DIR* __fastcall__ opendir (register const char* name) { register DIR* dir; diff --git a/libsrc/apple2/write.s b/libsrc/apple2/write.s index 21f4a45a4..d9dd73ca9 100644 --- a/libsrc/apple2/write.s +++ b/libsrc/apple2/write.s @@ -111,4 +111,4 @@ errno: jmp __directerrno ; Set __oserror oserr: jmp __mappederrno - + diff --git a/libsrc/atari/break.s b/libsrc/atari/break.s index 0cfba1c5a..ae4c8e007 100644 --- a/libsrc/atari/break.s +++ b/libsrc/atari/break.s @@ -63,7 +63,7 @@ L1: lda #BANK ; add to BANK address sta STACK+8 ; current page in bank ldx curbank - lda banks,x - sta STACK+2 ; set bank in stack - lda portb_save + lda banks,x + sta STACK+2 ; set bank in stack + lda portb_save sta STACK+10 ; set bank restore in stack sta STACK+18 ; set final restore too @@ -399,7 +399,7 @@ copyfrom_copy: bne @3 inc STACK+16 -@3: jmp copyfrom_copy ; copy another byte +@3: jmp copyfrom_copy ; copy another byte done: rts @@ -418,7 +418,7 @@ COPYTO: ldy #EM_COPY::OFFS lda (ptr3),y - sta STACK+15 ; offset goes into BANK low + sta STACK+15 ; offset goes into BANK low ldy #EM_COPY::PAGE lda (ptr3),y @@ -446,9 +446,9 @@ COPYTO: add #>BANK ; add to BANK address sta STACK+16 ; current page in bank ldx curbank - lda banks,x - sta STACK+10 ; set bank in stack - lda portb_save + lda banks,x + sta STACK+10 ; set bank in stack + lda portb_save sta STACK+2 ; set bank restore in stack sta STACK+18 ; set final restore too @@ -488,5 +488,5 @@ copyto_copy: bne @3 inc STACK+8 -@3: jmp copyto_copy ; copy another byte +@3: jmp copyto_copy ; copy another byte diff --git a/libsrc/atari/mcbtxtchar.s b/libsrc/atari/mcbtxtchar.s index 4ff79c651..95dd1651a 100644 --- a/libsrc/atari/mcbtxtchar.s +++ b/libsrc/atari/mcbtxtchar.s @@ -74,7 +74,7 @@ prep: jsr getcursor ; Get character at cursor position cmp #mouse_txt_char ; "mouse" character bne overwr ; no, probably program has overwritten it - lda backup ; + lda backup ; jmp setcursor ; Draw character overwr: sta backup rts diff --git a/libsrc/atari/randomize.s b/libsrc/atari/randomize.s index ed4400b55..915fee3bd 100644 --- a/libsrc/atari/randomize.s +++ b/libsrc/atari/randomize.s @@ -10,7 +10,7 @@ .include "atari.inc" -__randomize: +__randomize: ldx VCOUNT ; Use vertical line counter as high byte lda RTCLOK+2 ; Use clock as low byte jmp _srand ; Initialize generator diff --git a/libsrc/atari/revers.s b/libsrc/atari/revers.s index 719503940..23126a88f 100644 --- a/libsrc/atari/revers.s +++ b/libsrc/atari/revers.s @@ -4,7 +4,7 @@ ; unsigned char revers (unsigned char onoff); ; .include "atari.inc" - + .export _revers .export _revflag diff --git a/libsrc/atari/shadow_ram_handlers.s b/libsrc/atari/shadow_ram_handlers.s index a8ba611b6..eaea35195 100644 --- a/libsrc/atari/shadow_ram_handlers.s +++ b/libsrc/atari/shadow_ram_handlers.s @@ -737,9 +737,9 @@ fn_cont:jsr get_fn_len lda #0 sta ICBLH,x jsr chk_CIO_buf - pla + pla sta ICBLH,x - pla + pla sta ICBLL,x pla tay @@ -756,7 +756,7 @@ chk_CIO_buf: lda ICBAH,x cmp #$c0 bcc @cont -@ret: +@ret: .ifdef DEBUG jsr CIO_buf_noti .endif diff --git a/libsrc/atari/system_check.s b/libsrc/atari/system_check.s index df7c433a4..762fc954f 100644 --- a/libsrc/atari/system_check.s +++ b/libsrc/atari/system_check.s @@ -93,7 +93,7 @@ sdnobw: lda DOS+1 ; SD version ldy #31 ; offset for OSRMFLG lda (DOSVEC),y ; get OSRMFLG bne sdcrts1 - + sdcrts0:clc rts sdcrts1:sec diff --git a/libsrc/atari/xlmemchk.inc b/libsrc/atari/xlmemchk.inc index f8be1c137..ecb874799 100644 --- a/libsrc/atari/xlmemchk.inc +++ b/libsrc/atari/xlmemchk.inc @@ -7,7 +7,7 @@ ; It calculates the value to put into RAMTOP for a subsequent ; "GRAPHICS 0" call, and the lowest address which will be used ; by the screen memory afterwards. -; +; ; inputs: ; __STARTADDRESS__ - load address of the program ; outputs: diff --git a/libsrc/atari5200/conioscreen.s b/libsrc/atari5200/conioscreen.s index 1311e874c..8c78fd44f 100644 --- a/libsrc/atari5200/conioscreen.s +++ b/libsrc/atari5200/conioscreen.s @@ -74,7 +74,7 @@ conio_color: .res 1 dlist: .repeat 3 .byte DL_BLK8 .endrepeat - + .byte DL_CHR20x8x2 | DL_LMS .word SCREEN_BUF diff --git a/libsrc/atari5200/cvline.s b/libsrc/atari5200/cvline.s index 204d90382..b4b3f1a3e 100644 --- a/libsrc/atari5200/cvline.s +++ b/libsrc/atari5200/cvline.s @@ -5,7 +5,7 @@ ; void cvline (unsigned char length); ; .include "atari5200.inc" - + .export _cvlinexy, _cvline .import gotoxy, putchar .importzp tmp1 diff --git a/libsrc/atari5200/extra/conioscreen-20x12.s b/libsrc/atari5200/extra/conioscreen-20x12.s index e591bf05a..aeb11cb43 100644 --- a/libsrc/atari5200/extra/conioscreen-20x12.s +++ b/libsrc/atari5200/extra/conioscreen-20x12.s @@ -74,7 +74,7 @@ conio_color: .res 1 dlist: .repeat 3 .byte DL_BLK8 .endrepeat - + .byte DL_CHR20x16x2 | DL_LMS .word SCREEN_BUF diff --git a/libsrc/atari5200/joy/atr5200std.s b/libsrc/atari5200/joy/atr5200std.s index 989bc5ee0..fb7946bea 100644 --- a/libsrc/atari5200/joy/atr5200std.s +++ b/libsrc/atari5200/joy/atr5200std.s @@ -44,7 +44,7 @@ ; INSTALL: - lda #$04 ; enable POT input from the joystick ports, see section "GTIA" in + lda #$04 ; enable POT input from the joystick ports, see section "GTIA" in sta CONSOL ; http://www.atarimuseum.com/videogames/consoles/5200/conv_to_5200.html lda #JOY_ERR_OK ldx #0 diff --git a/libsrc/atari5200/randomize.s b/libsrc/atari5200/randomize.s index ef462827e..978ccf3f3 100644 --- a/libsrc/atari5200/randomize.s +++ b/libsrc/atari5200/randomize.s @@ -10,7 +10,7 @@ .include "atari5200.inc" -__randomize: +__randomize: ldx VCOUNT ; Use vertical line counter as high byte lda RTCLOK+1 ; Use clock as low byte jmp _srand ; Initialize generator diff --git a/libsrc/atari5200/y2k.inc b/libsrc/atari5200/y2k.inc index f8531451c..9f7917cd3 100644 --- a/libsrc/atari5200/y2k.inc +++ b/libsrc/atari5200/y2k.inc @@ -9,16 +9,16 @@ Y2K LDY #$00 ; Copy BIOS opening screen to RAM CPX #$E8 ; Is this a 4 port? BNE Y2K0 ; Jump if not LDA #$42 ; Yes, 4 port system -Y2K0 STA TEMPL -Y2K1 LDA (TEMPL),Y +Y2K0 STA TEMPL +Y2K1 LDA (TEMPL),Y STA $0600,Y - INY + INY BNE Y2K1 LDY #$50 INC TEMPH -Y2K2 LDA (TEMPL),Y +Y2K2 LDA (TEMPL),Y STA $0700,Y - DEY + DEY BPL Y2K2 LDA #$D4 ; Point to copyright string STA $0724 @@ -26,8 +26,8 @@ Y2K2 LDA (TEMPL),Y STA $0725 LDX #$0B ; Store NOP's @ end LDA #$EA -Y2K3 STA $0732,X - DEX +Y2K3 STA $0732,X + DEX BPL Y2K3 LDA #$60 ; Store RTS opcode @ end STA $0750 diff --git a/libsrc/atari7800/crt0.s b/libsrc/atari7800/crt0.s index cefe16730..e791179f3 100644 --- a/libsrc/atari7800/crt0.s +++ b/libsrc/atari7800/crt0.s @@ -19,7 +19,7 @@ start: sei ; Initialize 6502 cld lda #$07 ; Lock machine in 7800 mode - sta INPTCTRL + sta INPTCTRL lda #$7f ; DMA off sta CTRL ldx #0 ; OFFSET must always be 0 @@ -28,7 +28,7 @@ start: dex ; Stack pointer = $ff txs - ; Set up parameter stack + ; Set up parameter stack lda #<(__RAM3_START__ + __RAM3_SIZE__) sta sp lda #>(__RAM3_START__ + __RAM3_SIZE__) @@ -48,7 +48,7 @@ _exit: jsr donelib jmp start -NMIHandler: +NMIHandler: inc _zonecounter jmp IRQStub diff --git a/libsrc/atari7800/joy/atari7800-stdjoy.s b/libsrc/atari7800/joy/atari7800-stdjoy.s index cea6625a4..d76e1d105 100644 --- a/libsrc/atari7800/joy/atari7800-stdjoy.s +++ b/libsrc/atari7800/joy/atari7800-stdjoy.s @@ -85,7 +85,7 @@ COUNT: rts ; ------------------------------------------------------------------------ -; READ: Read a particular joystick passed in A for 2 fire buttons. +; READ: Read a particular joystick passed in A for 2 fire buttons. readbuttons: ; Y has joystick of interest 0/1 diff --git a/libsrc/atmos/cclear.s b/libsrc/atmos/cclear.s index 9d356a8ab..f6416363c 100644 --- a/libsrc/atmos/cclear.s +++ b/libsrc/atmos/cclear.s @@ -6,7 +6,7 @@ ; .export _cclearxy, _cclear - .import setscrptr + .import setscrptr .import rvs .import popax .importzp ptr2 @@ -25,7 +25,7 @@ _cclear: tax ; Is the length zero? beq @L9 ; Jump if done jsr setscrptr ; Set ptr2 to screen, won't use X - lda #' ' + lda #' ' ora rvs @L1: sta (ptr2),y ; Write one char iny ; Next char diff --git a/libsrc/atmos/ctype.s b/libsrc/atmos/ctype.s index 90a3baa6e..57ad8c1a3 100644 --- a/libsrc/atmos/ctype.s +++ b/libsrc/atmos/ctype.s @@ -119,7 +119,7 @@ __ctypeidx: ct_mix CT_NONE_IDX, CT_NONE_IDX ; 186/ba ___________, 187/bb ___________ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 188/bc ___________, 189/bd ___________ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 190/be ___________, 191/bf ___________ - + ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 192/c0 ___________, 193/c1 ___________ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 194/c2 ___________, 195/c3 ___________ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 196/c4 ___________, 197/c5 ___________ diff --git a/libsrc/c128/emd/c128-vdc.s b/libsrc/c128/emd/c128-vdc.s index e294ddc18..accb82154 100644 --- a/libsrc/c128/emd/c128-vdc.s +++ b/libsrc/c128/emd/c128-vdc.s @@ -73,7 +73,7 @@ INSTALL: lda #$ff sta curpage sta curpage+1 - + ; do test for VDC presence here??? ldx #VDC_CSET ; determine size of RAM... jsr vdcgetreg @@ -97,29 +97,29 @@ INSTALL: jsr vdcputbyte ; restore original value of test byte ldx #0 ; prepare x with hi of default pagecount - + lda ptr1 ; do bytes match? cmp ptr1+1 bne @have64k lda ptr2 cmp ptr2+1 bne @have64k - + lda #64 ; assumes x = 0, here -> p.c = 64 bne @setpagecnt -@have64k: +@have64k: txa ; assumes x = 0, here inx ; so that a/x becomes 0/1 -> p.c. = 256 -@setpagecnt: +@setpagecnt: sta pagecount stx pagecount+1 txa - bne @keep64kBit - + bne @keep64kBit + ldx #VDC_CSET ; restore 16/64k flag - lda vdc_cset_save - jsr vdcputreg + lda vdc_cset_save + jsr vdcputreg @keep64kBit: lda #EM_ERR_OK diff --git a/libsrc/c64/sysuname.s b/libsrc/c64/sysuname.s index 2d185a1c8..1903986c9 100644 --- a/libsrc/c64/sysuname.s +++ b/libsrc/c64/sysuname.s @@ -12,7 +12,7 @@ ;-------------------------------------------------------------------------- ; Data. We define a fixed utsname struct here and just copy it. - + .rodata utsdata: diff --git a/libsrc/cbm/cbm_save.c b/libsrc/cbm/cbm_save.c index 7f774b1b6..2e22b89fc 100644 --- a/libsrc/cbm/cbm_save.c +++ b/libsrc/cbm/cbm_save.c @@ -12,9 +12,9 @@ /* saves a memory area from start to end-1 to a file. */ -unsigned char __fastcall__ cbm_save (const char* name, +unsigned char __fastcall__ cbm_save (const char* name, unsigned char device, - const void* data, + const void* data, unsigned int size) { cbm_k_setlfs(0, device, 0); diff --git a/libsrc/cbm/ctype.s b/libsrc/cbm/ctype.s index 7388f68b8..a66905fe7 100644 --- a/libsrc/cbm/ctype.s +++ b/libsrc/cbm/ctype.s @@ -13,7 +13,7 @@ .include "ctypetable.inc" .export __ctypeidx - + ; The tables are readonly, put them into the rodata segment .rodata diff --git a/libsrc/cbm/opendir.c b/libsrc/cbm/opendir.c index b39e6b77e..87b9ab73d 100644 --- a/libsrc/cbm/opendir.c +++ b/libsrc/cbm/opendir.c @@ -38,7 +38,7 @@ DIR* __fastcall__ opendir (register const char* name) d.fd = open (d.name, O_RDONLY); if (d.fd >= 0) { - /* Skip the load address */ + /* Skip the load address */ if (_dirread (&d, buf, sizeof (buf))) { /* Allocate memory for the DIR structure returned */ diff --git a/libsrc/cbm610/revers.s b/libsrc/cbm610/revers.s index eb44f0282..78b8a0591 100644 --- a/libsrc/cbm610/revers.s +++ b/libsrc/cbm610/revers.s @@ -9,7 +9,7 @@ .import RVS: zp .include "cbm610.inc" - + .proc _revers diff --git a/libsrc/common/_heap.s b/libsrc/common/_heap.s index e2470577a..4ec8c80cd 100644 --- a/libsrc/common/_heap.s +++ b/libsrc/common/_heap.s @@ -39,4 +39,4 @@ initheap: sta __heapend+1 rts - + diff --git a/libsrc/common/_heapmaxavail.s b/libsrc/common/_heapmaxavail.s index 4d44fadc1..19ae18b8d 100644 --- a/libsrc/common/_heapmaxavail.s +++ b/libsrc/common/_heapmaxavail.s @@ -6,7 +6,7 @@ ; size_t _heapmaxavail (void); ; ; - + .importzp ptr1, ptr2 .export __heapmaxavail diff --git a/libsrc/common/_longminstr.c b/libsrc/common/_longminstr.c index ffc35aa77..28a19f39b 100644 --- a/libsrc/common/_longminstr.c +++ b/libsrc/common/_longminstr.c @@ -1,9 +1,9 @@ /* ** Ullrich von Bassewitz, 2012-11-26 ** -** Minimum value of a long. Is used in ascii conversions, since this value +** Minimum value of a long. Is used in ascii conversions, since this value ** has no positive counterpart than can be represented in 32 bits. In C, -** since the compiler will convert to the correct character set for the +** since the compiler will convert to the correct character set for the ** target platform. */ diff --git a/libsrc/common/_seterrno.s b/libsrc/common/_seterrno.s index e35c0b342..79021143a 100644 --- a/libsrc/common/_seterrno.s +++ b/libsrc/common/_seterrno.s @@ -2,7 +2,7 @@ ; Ullrich von Bassewitz, 2004-05-13 ; ; __seterrno: Will set __errno to the value in A and return zero in A. Other -; registers aren't changed. The function is C callable, but +; registers aren't changed. The function is C callable, but ; currently only called from asm code. ; diff --git a/libsrc/common/abort.c b/libsrc/common/abort.c index 1dda559bb..1100d33a3 100644 --- a/libsrc/common/abort.c +++ b/libsrc/common/abort.c @@ -7,7 +7,7 @@ #include -#include +#include #include diff --git a/libsrc/common/ctypemask.s b/libsrc/common/ctypemask.s index b518a10c0..9238f24e9 100644 --- a/libsrc/common/ctypemask.s +++ b/libsrc/common/ctypemask.s @@ -9,7 +9,7 @@ ; ; ctypemask(int c) ; -; converts a character to test via the is*-functions to the matching ctype-masks +; converts a character to test via the is*-functions to the matching ctype-masks ; If c is out of the 8-bit range, the function returns with carry set and accu cleared. ; Return value is in accu and x has to be always clear when returning ; (makes calling code shorter)! diff --git a/libsrc/common/divt.s b/libsrc/common/divt.s index 914eb569d..7f2b4e1bb 100644 --- a/libsrc/common/divt.s +++ b/libsrc/common/divt.s @@ -18,10 +18,10 @@ .importzp sreg, ptr1, tmp1 _div: jsr tosdivax ; Division-operator does most of the work - + ldy sreg ; low byte remainder from sreg sta sreg ; store low byte quotient to sreg - + lda sreg+1 ; high byte remainder from sreg stx sreg+1 ; store high byte quotient to sreg diff --git a/libsrc/common/doesclrscr.s b/libsrc/common/doesclrscr.s index 49ce2fd12..14d9ab804 100644 --- a/libsrc/common/doesclrscr.s +++ b/libsrc/common/doesclrscr.s @@ -7,6 +7,6 @@ ; .export _doesclrscrafterexit - .import return0 + .import return0 _doesclrscrafterexit = return0 diff --git a/libsrc/common/fread.s b/libsrc/common/fread.s index 91d692985..c0733994e 100644 --- a/libsrc/common/fread.s +++ b/libsrc/common/fread.s @@ -161,7 +161,7 @@ bne @L8 ; Error in read. Set the stream error flag and bail out. errno has already -; been set by read(). On entry to label @L7, X must be zero. +; been set by read(). On entry to label @L7, X must be zero. inx ; X = 0 lda #_FERROR diff --git a/libsrc/common/free.s b/libsrc/common/free.s index 00b5e63f8..53796303c 100644 --- a/libsrc/common/free.s +++ b/libsrc/common/free.s @@ -274,7 +274,7 @@ _free: sta ptr2 ; } ; } ; -; +; ; On entry, ptr2 must contain a pointer to the block, which must be at least ; HEAP_MIN_BLOCKSIZE bytes in size, and ptr1 contains the total size of the ; block. diff --git a/libsrc/common/fsetpos.c b/libsrc/common/fsetpos.c index 14690f520..a0cf8d31f 100644 --- a/libsrc/common/fsetpos.c +++ b/libsrc/common/fsetpos.c @@ -21,4 +21,4 @@ int __fastcall__ fsetpos (FILE* f, const fpos_t *pos) return fseek (f, (fpos_t)*pos, SEEK_SET); } - + diff --git a/libsrc/common/fwrite.s b/libsrc/common/fwrite.s index dc0bad1b6..b0fa7ec42 100644 --- a/libsrc/common/fwrite.s +++ b/libsrc/common/fwrite.s @@ -19,7 +19,7 @@ ; ------------------------------------------------------------------------ ; Code - + .proc _fwrite ; Save file and place it into ptr1 diff --git a/libsrc/common/getcwd.s b/libsrc/common/getcwd.s index 4bfc0a5b6..9b856ea7c 100644 --- a/libsrc/common/getcwd.s +++ b/libsrc/common/getcwd.s @@ -53,7 +53,7 @@ overflow: lda #256 sta pagecount stx pagecount+1 -@endok: +@endok: pla sta $01 plp lda #EM_ERR_OK - rts - -test64k: + rts + +test64k: sta tmp1 sty ptr3 lda #0 @@ -186,14 +186,14 @@ MAP: sta curpage sta ptr1+1 ldy #0 sty ptr1 - + lda #window sta ptr2+1 - + jsr transferin - + lda #window rts @@ -299,7 +299,7 @@ COPYFROM: bne @L1 ; Copy the remainder of the page - + @L2: ldy #EM_COPY::COUNT lda (ptr3),y ; Get bytes in last page beq @L4 @@ -391,9 +391,9 @@ vdcgetreg: @L0: bit VDC_ADDR_REG bpl @L0 lda VDC_DATA_REG - rts + rts -vdcputbyte: +vdcputbyte: ldx #VDC_DATA vdcputreg: stx VDC_ADDR_REG diff --git a/libsrc/geos-cbm/file/followchain.s b/libsrc/geos-cbm/file/followchain.s index df20bcaac..9b882d59a 100644 --- a/libsrc/geos-cbm/file/followchain.s +++ b/libsrc/geos-cbm/file/followchain.s @@ -11,7 +11,7 @@ .include "jumptab.inc" .include "geossym.inc" - + _FollowChain: sta r3L stx r3H diff --git a/libsrc/geos-cbm/graph/setnewmode.s b/libsrc/geos-cbm/graph/setnewmode.s index 1d63cf78e..56fc123f7 100644 --- a/libsrc/geos-cbm/graph/setnewmode.s +++ b/libsrc/geos-cbm/graph/setnewmode.s @@ -9,7 +9,7 @@ .include "jumptab.inc" .include "geossym.inc" - + _SetNewMode: lda graphMode eor #$80 diff --git a/libsrc/geos-cbm/system/setdevice.s b/libsrc/geos-cbm/system/setdevice.s index 37a162303..a67c10228 100644 --- a/libsrc/geos-cbm/system/setdevice.s +++ b/libsrc/geos-cbm/system/setdevice.s @@ -8,5 +8,5 @@ .export _SetDevice .include "jumptab.inc" - + _SetDevice = SetDevice diff --git a/libsrc/geos-cbm/tgi/geos-tgi.s b/libsrc/geos-cbm/tgi/geos-tgi.s index 08927e6c1..c04742fb6 100644 --- a/libsrc/geos-cbm/tgi/geos-tgi.s +++ b/libsrc/geos-cbm/tgi/geos-tgi.s @@ -93,7 +93,7 @@ Y2 = ptr4 SCRBASE: .res 1 ; High byte of screen base (64k VDC only) -ERROR: +ERROR: .res 1 ; Error code PALETTE: .res 2 ; The current palette @@ -199,9 +199,9 @@ INSTALL: @endok: lda #0 sta SCRBASE ; draw page 0 as default - rts + rts -test64k: +test64k: sta tmp1 sty ptr3 lda #0 diff --git a/libsrc/geos-common/common/zerobss.s b/libsrc/geos-common/common/zerobss.s index 48fc5a89a..85d3e03eb 100644 --- a/libsrc/geos-common/common/zerobss.s +++ b/libsrc/geos-common/common/zerobss.s @@ -7,7 +7,7 @@ .export zerobss .import __BSS_RUN__, __BSS_SIZE__ - + .include "jumptab.inc" .include "geossym.inc" diff --git a/libsrc/geos-common/conio/_scrsize.s b/libsrc/geos-common/conio/_scrsize.s index 494182b9d..ffb17dec6 100644 --- a/libsrc/geos-common/conio/_scrsize.s +++ b/libsrc/geos-common/conio/_scrsize.s @@ -11,7 +11,7 @@ .importzp cursor_r, cursor_c .import _cursor .constructor initscrsize - + .include "geossym.inc" .segment "ONCE" @@ -38,7 +38,7 @@ L1: lda #40 ; 40 columns (more or less) .code -screensize: +screensize: ldx xsize ldy ysize rts diff --git a/libsrc/geos-common/conio/cputc.s b/libsrc/geos-common/conio/cputc.s index 014c2ed0b..af4194312 100644 --- a/libsrc/geos-common/conio/cputc.s +++ b/libsrc/geos-common/conio/cputc.s @@ -19,7 +19,7 @@ ; ESC_GRAPHICS, ESC_RULER, GOTOX, GOTOY, GOTOXY, NEWCARDSET, all 1..8 ; ; note that there are conflicts between control characters and keyboard: -; HOME = KEY_ENTER, KEY_HOME = REV_ON, +; HOME = KEY_ENTER, KEY_HOME = REV_ON, ; UPLINE = ?, KEY_UPARROW = GOTOY, ... .export _cputcxy, _cputc diff --git a/libsrc/geos-common/conio/cvline.s b/libsrc/geos-common/conio/cvline.s index c12b8764b..9aa3d3eee 100644 --- a/libsrc/geos-common/conio/cvline.s +++ b/libsrc/geos-common/conio/cvline.s @@ -18,7 +18,7 @@ _cvlinexy: jsr gotoxy ; Call this one, will pop params pla ; Restore the length -_cvline: +_cvline: cmp #0 ; Is the length zero? beq L9 ; Jump if done tax diff --git a/libsrc/geos-common/disk/blkalloc.s b/libsrc/geos-common/disk/blkalloc.s index 6bfcb312c..bace80098 100644 --- a/libsrc/geos-common/disk/blkalloc.s +++ b/libsrc/geos-common/disk/blkalloc.s @@ -11,7 +11,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _BlkAlloc: sta r2L stx r2H diff --git a/libsrc/geos-common/disk/calcblksfree.s b/libsrc/geos-common/disk/calcblksfree.s index 5d7b98aba..7e1bb4f52 100644 --- a/libsrc/geos-common/disk/calcblksfree.s +++ b/libsrc/geos-common/disk/calcblksfree.s @@ -11,7 +11,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _CalcBlksFree: lda #curDirHead diff --git a/libsrc/geos-common/disk/freeblock.s b/libsrc/geos-common/disk/freeblock.s index cd8b08d2f..da9a83f86 100644 --- a/libsrc/geos-common/disk/freeblock.s +++ b/libsrc/geos-common/disk/freeblock.s @@ -11,7 +11,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _FreeBlock: jsr gettrse sta r6L diff --git a/libsrc/geos-common/disk/getblock.s b/libsrc/geos-common/disk/getblock.s index cef7ece6f..bb1690827 100644 --- a/libsrc/geos-common/disk/getblock.s +++ b/libsrc/geos-common/disk/getblock.s @@ -12,7 +12,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _GetBlock: sta r4L stx r4H diff --git a/libsrc/geos-common/disk/getptrcurdknm.s b/libsrc/geos-common/disk/getptrcurdknm.s index 7a99225ef..d92e5d91e 100644 --- a/libsrc/geos-common/disk/getptrcurdknm.s +++ b/libsrc/geos-common/disk/getptrcurdknm.s @@ -12,8 +12,8 @@ .include "jumptab.inc" .include "geossym.inc" - -_GetPtrCurDkNm: + +_GetPtrCurDkNm: sta ptr3 stx ptr3+1 ldx #ptr4 diff --git a/libsrc/geos-common/disk/nxtblkalloc.s b/libsrc/geos-common/disk/nxtblkalloc.s index 7427f3de0..560eb0945 100644 --- a/libsrc/geos-common/disk/nxtblkalloc.s +++ b/libsrc/geos-common/disk/nxtblkalloc.s @@ -13,7 +13,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _NxtBlkAlloc: sta r2L stx r2H diff --git a/libsrc/geos-common/disk/opendisk.s b/libsrc/geos-common/disk/opendisk.s index 66bd24d30..9de5fb1d7 100644 --- a/libsrc/geos-common/disk/opendisk.s +++ b/libsrc/geos-common/disk/opendisk.s @@ -10,7 +10,7 @@ .include "jumptab.inc" .include "diskdrv.inc" - + _OpenDisk: jsr OpenDisk jmp setoserror diff --git a/libsrc/geos-common/disk/putblock.s b/libsrc/geos-common/disk/putblock.s index df1af9f19..4c17274e1 100644 --- a/libsrc/geos-common/disk/putblock.s +++ b/libsrc/geos-common/disk/putblock.s @@ -12,7 +12,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _PutBlock: sta r4L stx r4H diff --git a/libsrc/geos-common/disk/putdirhead.s b/libsrc/geos-common/disk/putdirhead.s index 411b64307..afd7f9b39 100644 --- a/libsrc/geos-common/disk/putdirhead.s +++ b/libsrc/geos-common/disk/putdirhead.s @@ -10,7 +10,7 @@ .include "jumptab.inc" .include "diskdrv.inc" - + _PutDirHead: jsr PutDirHead jmp setoserror diff --git a/libsrc/geos-common/disk/setnextfree.s b/libsrc/geos-common/disk/setnextfree.s index 410532cea..b24f16f6f 100644 --- a/libsrc/geos-common/disk/setnextfree.s +++ b/libsrc/geos-common/disk/setnextfree.s @@ -12,7 +12,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _SetNextFree: jsr gettrse sta r3L diff --git a/libsrc/geos-common/dlgbox/rstrfrmdialogue.s b/libsrc/geos-common/dlgbox/rstrfrmdialogue.s index efee17465..9119770a0 100644 --- a/libsrc/geos-common/dlgbox/rstrfrmdialogue.s +++ b/libsrc/geos-common/dlgbox/rstrfrmdialogue.s @@ -8,5 +8,5 @@ .export _RstrFrmDialogue .include "jumptab.inc" - + _RstrFrmDialogue = RstrFrmDialogue diff --git a/libsrc/geos-common/drivers/fio_module.s b/libsrc/geos-common/drivers/fio_module.s index 937ef292e..1314fc4c5 100644 --- a/libsrc/geos-common/drivers/fio_module.s +++ b/libsrc/geos-common/drivers/fio_module.s @@ -38,21 +38,21 @@ _open: jsr popax ; Get flags sta tmp1 jsr popptr1 ; Get name - + lda filedesc ; is there a file already open? bne @alreadyopen - + lda tmp1 ; check open mode and #(O_RDWR | O_CREAT) cmp #O_RDONLY ; only O_RDONLY is valid bne @badmode - + lda ptr1 ldx ptr1+1 jsr _FindFile ; try to find the file tax bne @oserror - + lda dirEntryBuf + OFF_DE_TR_SC ; tr&se for ReadByte (r1) sta f_track lda dirEntryBuf + OFF_DE_TR_SC + 1 diff --git a/libsrc/geos-common/drivers/geos-stdmou.s b/libsrc/geos-common/drivers/geos-stdmou.s index 7e544ba82..88bbc7df9 100644 --- a/libsrc/geos-common/drivers/geos-stdmou.s +++ b/libsrc/geos-common/drivers/geos-stdmou.s @@ -5,7 +5,7 @@ ; ; Driver for GEOS standard input device interface ; - + .export _mouse_init, _mouse_done .export _mouse_hide, _mouse_show .export _mouse_box diff --git a/libsrc/geos-common/file/appendrecord.s b/libsrc/geos-common/file/appendrecord.s index 2a7864a13..1ec1e8869 100644 --- a/libsrc/geos-common/file/appendrecord.s +++ b/libsrc/geos-common/file/appendrecord.s @@ -10,7 +10,7 @@ .include "jumptab.inc" .include "diskdrv.inc" - + _AppendRecord: jsr AppendRecord diff --git a/libsrc/geos-common/file/closerecordfile.s b/libsrc/geos-common/file/closerecordfile.s index ee0778d7b..1c8b19b01 100644 --- a/libsrc/geos-common/file/closerecordfile.s +++ b/libsrc/geos-common/file/closerecordfile.s @@ -10,7 +10,7 @@ .include "jumptab.inc" .include "diskdrv.inc" - + _CloseRecordFile: jsr CloseRecordFile jmp setoserror diff --git a/libsrc/geos-common/file/deletefile.s b/libsrc/geos-common/file/deletefile.s index 730569e55..b9d994142 100644 --- a/libsrc/geos-common/file/deletefile.s +++ b/libsrc/geos-common/file/deletefile.s @@ -11,7 +11,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _DeleteFile: sta r0L stx r0H diff --git a/libsrc/geos-common/file/deleterecord.s b/libsrc/geos-common/file/deleterecord.s index 7ffe5d739..fac73f665 100644 --- a/libsrc/geos-common/file/deleterecord.s +++ b/libsrc/geos-common/file/deleterecord.s @@ -11,7 +11,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _DeleteRecord: jsr DeleteRecord jmp setoserror diff --git a/libsrc/geos-common/file/findfile.s b/libsrc/geos-common/file/findfile.s index 0f58e99e6..285e8d650 100644 --- a/libsrc/geos-common/file/findfile.s +++ b/libsrc/geos-common/file/findfile.s @@ -11,7 +11,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _FindFile: sta r6L stx r6H diff --git a/libsrc/geos-common/file/freefile.s b/libsrc/geos-common/file/freefile.s index 791f3f31c..03a8b9d88 100644 --- a/libsrc/geos-common/file/freefile.s +++ b/libsrc/geos-common/file/freefile.s @@ -11,7 +11,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _FreeFile: sta r9L stx r9H diff --git a/libsrc/geos-common/file/getfhdrinfo.s b/libsrc/geos-common/file/getfhdrinfo.s index a9a843e74..1503b1cf1 100644 --- a/libsrc/geos-common/file/getfhdrinfo.s +++ b/libsrc/geos-common/file/getfhdrinfo.s @@ -11,7 +11,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _GetFHdrInfo: sta r9L stx r9H diff --git a/libsrc/geos-common/file/getfile.s b/libsrc/geos-common/file/getfile.s index 9c8011542..24f87e859 100644 --- a/libsrc/geos-common/file/getfile.s +++ b/libsrc/geos-common/file/getfile.s @@ -11,7 +11,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _GetFile: sta r3L stx r3H diff --git a/libsrc/geos-common/file/openrecordfile.s b/libsrc/geos-common/file/openrecordfile.s index cdab3dd6c..cba5d7c08 100644 --- a/libsrc/geos-common/file/openrecordfile.s +++ b/libsrc/geos-common/file/openrecordfile.s @@ -11,7 +11,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _OpenRecordFile: sta r0L stx r0H diff --git a/libsrc/geos-common/file/pointrecord.s b/libsrc/geos-common/file/pointrecord.s index 82b88c4c6..29294737d 100644 --- a/libsrc/geos-common/file/pointrecord.s +++ b/libsrc/geos-common/file/pointrecord.s @@ -10,7 +10,7 @@ .include "jumptab.inc" .include "diskdrv.inc" - + _PointRecord: jsr PointRecord jmp setoserror diff --git a/libsrc/geos-common/file/readfile.s b/libsrc/geos-common/file/readfile.s index 3b43cffd4..d8b941cde 100644 --- a/libsrc/geos-common/file/readfile.s +++ b/libsrc/geos-common/file/readfile.s @@ -12,7 +12,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _ReadFile: sta r2L stx r2H diff --git a/libsrc/geos-common/file/readrecord.s b/libsrc/geos-common/file/readrecord.s index dd464e0b1..be155c718 100644 --- a/libsrc/geos-common/file/readrecord.s +++ b/libsrc/geos-common/file/readrecord.s @@ -11,7 +11,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _ReadRecord: sta r2L stx r2H diff --git a/libsrc/geos-common/file/writerecord.s b/libsrc/geos-common/file/writerecord.s index e0d4c86d4..33b5fef31 100644 --- a/libsrc/geos-common/file/writerecord.s +++ b/libsrc/geos-common/file/writerecord.s @@ -11,7 +11,7 @@ .include "jumptab.inc" .include "diskdrv.inc" .include "geossym.inc" - + _WriteRecord: sta r2L stx r2H diff --git a/libsrc/geos-common/geosmac.inc b/libsrc/geos-common/geosmac.inc index 5ce20ff7f..6398b7a0b 100644 --- a/libsrc/geos-common/geosmac.inc +++ b/libsrc/geos-common/geosmac.inc @@ -136,7 +136,7 @@ Skip: ;------------------------------------------------------------------------- .macro CmpW source, dest -.local Skip +.local Skip CmpB source+1, dest+1 bne Skip CmpB source+0, dest+0 @@ -203,7 +203,7 @@ Skip: .macro rmb bitNumber, dest pha - lda #(1 << bitNumber) ^ $ff + lda #(1 << bitNumber) ^ $ff and dest sta dest pla diff --git a/libsrc/geos-common/graph/bitotherclip.s b/libsrc/geos-common/graph/bitotherclip.s index ef849f6d7..020139da8 100644 --- a/libsrc/geos-common/graph/bitotherclip.s +++ b/libsrc/geos-common/graph/bitotherclip.s @@ -3,7 +3,7 @@ ; ; 21.12.99 -; void BitOtherClip (void *proc1, void* proc2, char skipl, char skipr, int skipy, +; void BitOtherClip (void *proc1, void* proc2, char skipl, char skipr, int skipy, ; struct iconpic *myGfx); ; both proc1, proc2 should be: char __fastcall something (void); diff --git a/libsrc/geos-common/graph/framerectangle.s b/libsrc/geos-common/graph/framerectangle.s index c5f9de04c..eb3ea8df6 100644 --- a/libsrc/geos-common/graph/framerectangle.s +++ b/libsrc/geos-common/graph/framerectangle.s @@ -8,5 +8,5 @@ .export _FrameRectangle .include "jumptab.inc" - + _FrameRectangle = FrameRectangle diff --git a/libsrc/geos-common/graph/imprintrectangle.s b/libsrc/geos-common/graph/imprintrectangle.s index fc327e9d3..08b28690d 100644 --- a/libsrc/geos-common/graph/imprintrectangle.s +++ b/libsrc/geos-common/graph/imprintrectangle.s @@ -4,10 +4,10 @@ ; 21.12.99 ; void ImprintRectangle (void); - + .export _ImprintRectangle .include "jumptab.inc" - + _ImprintRectangle = ImprintRectangle diff --git a/libsrc/geos-common/graph/invertline.s b/libsrc/geos-common/graph/invertline.s index baa4a6e5a..72fb87afb 100644 --- a/libsrc/geos-common/graph/invertline.s +++ b/libsrc/geos-common/graph/invertline.s @@ -9,7 +9,7 @@ .export _InvertLine .include "jumptab.inc" - + _InvertLine: jsr HLineRegs jmp InvertLine diff --git a/libsrc/geos-common/graph/invertrectangle.s b/libsrc/geos-common/graph/invertrectangle.s index 084187255..52750a8e9 100644 --- a/libsrc/geos-common/graph/invertrectangle.s +++ b/libsrc/geos-common/graph/invertrectangle.s @@ -6,7 +6,7 @@ ; void InvertRectangle (void); .export _InvertRectangle - + .include "jumptab.inc" _InvertRectangle = InvertRectangle diff --git a/libsrc/geos-common/graph/recoverline.s b/libsrc/geos-common/graph/recoverline.s index edc366114..8214242d3 100644 --- a/libsrc/geos-common/graph/recoverline.s +++ b/libsrc/geos-common/graph/recoverline.s @@ -7,7 +7,7 @@ .import HLineRegs .export _RecoverLine - + .include "jumptab.inc" _RecoverLine: diff --git a/libsrc/geos-common/graph/recoverrectangle.s b/libsrc/geos-common/graph/recoverrectangle.s index 009ca81eb..2e494fcbe 100644 --- a/libsrc/geos-common/graph/recoverrectangle.s +++ b/libsrc/geos-common/graph/recoverrectangle.s @@ -4,10 +4,10 @@ ; 29.10.99 ; void RecoverRectangle (void); - + .export _RecoverRectangle .include "jumptab.inc" - + _RecoverRectangle = RecoverRectangle diff --git a/libsrc/geos-common/graph/rectangle.s b/libsrc/geos-common/graph/rectangle.s index a9351c47e..6dc283024 100644 --- a/libsrc/geos-common/graph/rectangle.s +++ b/libsrc/geos-common/graph/rectangle.s @@ -6,7 +6,7 @@ ; void Rectangle (void); .export _Rectangle - + .include "jumptab.inc" _Rectangle = Rectangle diff --git a/libsrc/geos-common/graph/testpoint.s b/libsrc/geos-common/graph/testpoint.s index f2dfb7b5d..ad1dd3fee 100644 --- a/libsrc/geos-common/graph/testpoint.s +++ b/libsrc/geos-common/graph/testpoint.s @@ -10,7 +10,7 @@ .export _TestPoint .include "jumptab.inc" - + _TestPoint: jsr PointRegs jsr TestPoint diff --git a/libsrc/geos-common/graph/verticalline.s b/libsrc/geos-common/graph/verticalline.s index 01fb0b725..1ec89a9d7 100644 --- a/libsrc/geos-common/graph/verticalline.s +++ b/libsrc/geos-common/graph/verticalline.s @@ -5,12 +5,12 @@ ; void VerticalLine (char pattern, char ystart, char yend, int x); - .import popa + .import popa .export _VerticalLine .include "jumptab.inc" .include "geossym.inc" - + _VerticalLine: stx r4H sta r4L diff --git a/libsrc/geos-common/mousesprite/ismseinregion.s b/libsrc/geos-common/mousesprite/ismseinregion.s index 0617490c5..da14c9fe8 100644 --- a/libsrc/geos-common/mousesprite/ismseinregion.s +++ b/libsrc/geos-common/mousesprite/ismseinregion.s @@ -7,7 +7,7 @@ .import _InitDrawWindow .export _IsMseInRegion - + .include "jumptab.inc" _IsMseInRegion: diff --git a/libsrc/geos-common/process/processblock.s b/libsrc/geos-common/process/processblock.s index 84ead5993..17f07f28c 100644 --- a/libsrc/geos-common/process/processblock.s +++ b/libsrc/geos-common/process/processblock.s @@ -12,11 +12,11 @@ .export _UnblockProcess .include "jumptab.inc" - + _BlockProcess: tax jmp BlockProcess - + _UnblockProcess: tax jmp UnblockProcess diff --git a/libsrc/geos-common/process/processfreeze.s b/libsrc/geos-common/process/processfreeze.s index bda914bdc..e77bec2d7 100644 --- a/libsrc/geos-common/process/processfreeze.s +++ b/libsrc/geos-common/process/processfreeze.s @@ -10,11 +10,11 @@ .export _UnfreezeProcess .include "jumptab.inc" - + _FreezeProcess: tax jmp FreezeProcess - + _UnfreezeProcess: tax jmp UnfreezeProcess diff --git a/libsrc/geos-common/process/processinitrestartenable.s b/libsrc/geos-common/process/processinitrestartenable.s index 800c2dc5f..73f030d56 100644 --- a/libsrc/geos-common/process/processinitrestartenable.s +++ b/libsrc/geos-common/process/processinitrestartenable.s @@ -20,11 +20,11 @@ _InitProcesses: stx r0H jsr popa jmp InitProcesses - + _RestartProcess: tax jmp RestartProcess - + _EnableProcess: tax jmp EnableProcess diff --git a/libsrc/joystick/joy_load.s b/libsrc/joystick/joy_load.s index 7115f5d07..97ba7a0cd 100644 --- a/libsrc/joystick/joy_load.s +++ b/libsrc/joystick/joy_load.s @@ -87,7 +87,7 @@ ctrl: .addr _read ; Check the driver signature, install the driver. c is already on stack and ; will get removed by joy_install(). -; Res = joy_install (ctrl.module); +; Res = joy_install (ctrl.module); lda ctrl + MOD_CTRL::MODULE ldx ctrl + MOD_CTRL::MODULE+1 diff --git a/libsrc/lynx/bllhdr.s b/libsrc/lynx/bllhdr.s index 07ed06ffb..c34d7b53b 100644 --- a/libsrc/lynx/bllhdr.s +++ b/libsrc/lynx/bllhdr.s @@ -6,7 +6,7 @@ .import __BSS_LOAD__ .import __MAIN_START__ .export __BLLHDR__: absolute = 1 - + ; ------------------------------------------------------------------------ ; BLL header (BLL header) diff --git a/libsrc/lynx/bootldr.s b/libsrc/lynx/bootldr.s index c8b4ca402..ddc24faed 100644 --- a/libsrc/lynx/bootldr.s +++ b/libsrc/lynx/bootldr.s @@ -155,7 +155,7 @@ secreadbyte0: bne exit ;********************************** -; Select a block +; Select a block ;********************************** seclynxblock: pha diff --git a/libsrc/lynx/cgetc.s b/libsrc/lynx/cgetc.s index 362371ec3..d940b2b94 100644 --- a/libsrc/lynx/cgetc.s +++ b/libsrc/lynx/cgetc.s @@ -19,7 +19,7 @@ ; and Opt1 + Opt2 pressed '3'. ; So the keyboard returns '1', '2', '3', 'P', 'R', 'F' or '?'. -_cgetc: +_cgetc: jsr _kbhit ; Check for char available beq _cgetc ora KBSTL diff --git a/libsrc/lynx/eeprom.s b/libsrc/lynx/eeprom.s index 978220cfd..fb0247e90 100644 --- a/libsrc/lynx/eeprom.s +++ b/libsrc/lynx/eeprom.s @@ -252,4 +252,4 @@ EEloop4: rts - + diff --git a/libsrc/lynx/eeprom46.s b/libsrc/lynx/eeprom46.s index 55d9037c0..2b2277e45 100644 --- a/libsrc/lynx/eeprom46.s +++ b/libsrc/lynx/eeprom46.s @@ -4,7 +4,7 @@ ; ; created : 11.05.95 ; last modified : -; +; ; 16.02.96 leaner (thanks to Harry) ; 12.03.96 test for busy after write and erase (well, Harry ;)) ) ; 22.08.97 ported to ra65 for use with cc65 diff --git a/libsrc/lynx/eeprom66.s b/libsrc/lynx/eeprom66.s index 680db8166..6511cf8af 100644 --- a/libsrc/lynx/eeprom66.s +++ b/libsrc/lynx/eeprom66.s @@ -4,7 +4,7 @@ ; ; created : 11.05.95 ; last modified : -; +; ; 16.02.96 leaner (thanks to Harry) ; 12.03.96 test for busy after write and erase (well, Harry ;)) ) ; 22.08.97 ported to ra65 for use with cc65 diff --git a/libsrc/lynx/eeprom86.s b/libsrc/lynx/eeprom86.s index f753b73c3..73b342fae 100644 --- a/libsrc/lynx/eeprom86.s +++ b/libsrc/lynx/eeprom86.s @@ -4,7 +4,7 @@ ; ; created : 11.05.95 ; last modified : -; +; ; 16.02.96 leaner (thanks to Harry) ; 12.03.96 test for busy after write and erase (well, Harry ;)) ) ; 22.08.97 ported to ra65 for use with cc65 diff --git a/libsrc/lynx/exec.s b/libsrc/lynx/exec.s index c0a630a72..307475f1d 100644 --- a/libsrc/lynx/exec.s +++ b/libsrc/lynx/exec.s @@ -6,7 +6,7 @@ ; ; lynx_exec is often used in compilation carts when you run small demos ; created with various (non-cc65) compilers. -; +; ; void lynx_exec(int fileno) ; .importzp _FileDestAddr diff --git a/libsrc/lynx/kbhit.s b/libsrc/lynx/kbhit.s index 90d9061cd..d5b3d1cde 100644 --- a/libsrc/lynx/kbhit.s +++ b/libsrc/lynx/kbhit.s @@ -30,7 +30,7 @@ KBNPR: .byte 0 .code _kbhit: lda KBEDG - bne L1 + bne L1 lda $FCB0 ; Read the Opt buttons and #$0c sta KBTMP diff --git a/libsrc/lynx/lynx-cart.s b/libsrc/lynx/lynx-cart.s index 86e907348..94edff677 100644 --- a/libsrc/lynx/lynx-cart.s +++ b/libsrc/lynx/lynx-cart.s @@ -6,7 +6,7 @@ ; ; Ported to cc65 (http://www.cc65.org) by ; Shawn Jefferson, June 2004 -; +; ; This version by Karri Kaksonen, December 2010 ; ; Helper stuff for the cartridge file functions. This version can deal @@ -16,7 +16,7 @@ .include "lynx.inc" .include "extzp.inc" .export lynxskip0, lynxread0 - .export lynxblock + .export lynxblock .import __BLOCKSIZE__ .code @@ -60,7 +60,7 @@ readbyte0: bne exit ;********************************** -; Select a block +; Select a block ;********************************** lynxblock: pha diff --git a/libsrc/mouse/mouse_load.s b/libsrc/mouse/mouse_load.s index 347250843..a3a3f284d 100644 --- a/libsrc/mouse/mouse_load.s +++ b/libsrc/mouse/mouse_load.s @@ -1,4 +1,4 @@ -; +; ; Ullrich von Bassewitz, 2006-06-05 ; ; unsigned char __fastcall__ mouse_load_driver (const struct mouse_callbacks* c, diff --git a/libsrc/mouse/mouse_move.s b/libsrc/mouse/mouse_move.s index b25716b37..4d809109c 100644 --- a/libsrc/mouse/mouse_move.s +++ b/libsrc/mouse/mouse_move.s @@ -10,7 +10,7 @@ ; .import incsp2 - .import ptr1: zp + .import ptr1: zp .include "mouse-kernel.inc" diff --git a/libsrc/nes/cclear.s b/libsrc/nes/cclear.s index 7a2413826..93f5c7c9a 100644 --- a/libsrc/nes/cclear.s +++ b/libsrc/nes/cclear.s @@ -17,7 +17,7 @@ _cclearxy: _cclear: cmp #0 ; Is the length zero? beq L9 ; Jump if done - sta tmp1 + sta tmp1 L1: lda #$20 ; Blank - screen code jsr cputdirect ; Direct output dec tmp1 diff --git a/libsrc/nes/chline.s b/libsrc/nes/chline.s index d68a77df9..fff229575 100644 --- a/libsrc/nes/chline.s +++ b/libsrc/nes/chline.s @@ -10,7 +10,7 @@ .importzp tmp1 .include "nes.inc" - + _chlinexy: pha ; Save the length jsr gotoxy ; Call this one, will pop params diff --git a/libsrc/nes/gotoy.s b/libsrc/nes/gotoy.s index cfd913f2e..a36e77964 100644 --- a/libsrc/nes/gotoy.s +++ b/libsrc/nes/gotoy.s @@ -19,4 +19,4 @@ .endproc - + diff --git a/libsrc/nes/ppubuf.s b/libsrc/nes/ppubuf.s index 3708b93c1..f08fc1a71 100644 --- a/libsrc/nes/ppubuf.s +++ b/libsrc/nes/ppubuf.s @@ -101,7 +101,7 @@ @end: stx ringread sty ringcount - rts + rts .endproc diff --git a/libsrc/nes/sysuname.s b/libsrc/nes/sysuname.s index 2606d1a60..fcab503e1 100644 --- a/libsrc/nes/sysuname.s +++ b/libsrc/nes/sysuname.s @@ -35,5 +35,5 @@ utsdata: ; machine .asciiz "NES" - + diff --git a/libsrc/osic1p/cclear.s b/libsrc/osic1p/cclear.s index f7e9b2984..e399f14a9 100644 --- a/libsrc/osic1p/cclear.s +++ b/libsrc/osic1p/cclear.s @@ -20,7 +20,7 @@ _cclearxy: _cclear: cmp #0 ; Is the length zero? beq L9 ; Jump if done - sta tmp1 + sta tmp1 L1: lda #' ' jsr cputdirect ; Direct output dec tmp1 diff --git a/libsrc/pce/cclear.s b/libsrc/pce/cclear.s index 14b9d0e8b..e6277eed0 100644 --- a/libsrc/pce/cclear.s +++ b/libsrc/pce/cclear.s @@ -17,7 +17,7 @@ _cclearxy: _cclear: cmp #0 ; Is the length zero? beq L9 ; Jump if done - sta tmp1 + sta tmp1 L1: lda #$20 ; Blank - screen code jsr cputdirect ; Direct output dec tmp1 diff --git a/libsrc/plus4/randomize.s b/libsrc/plus4/randomize.s index 2a7f6a44b..796ad118b 100644 --- a/libsrc/plus4/randomize.s +++ b/libsrc/plus4/randomize.s @@ -11,7 +11,7 @@ .include "plus4.inc" -__randomize: +__randomize: ldx TED_VLINELO ; Use TED rasterline as high byte lda TIME+2 ; Use 60HZ clock as low byte jmp _srand ; Initialize generator diff --git a/libsrc/runtime/add.s b/libsrc/runtime/add.s index e644671c0..a4658cc13 100644 --- a/libsrc/runtime/add.s +++ b/libsrc/runtime/add.s @@ -33,13 +33,13 @@ hiadd: txa ; (19) inc sp+1 ; (-1+5) done: tya ; (36) -.else +.else ldy #0 ; (4) adc (sp),y ; (9) lo byte iny ; (11) sta tmp1 ; (14) save it - txa ; (16) + txa ; (16) adc (sp),y ; (21) hi byte tax ; (23) clc ; (25) diff --git a/libsrc/runtime/aslax1.s b/libsrc/runtime/aslax1.s index 14f0be3cc..97ac71c45 100644 --- a/libsrc/runtime/aslax1.s +++ b/libsrc/runtime/aslax1.s @@ -6,7 +6,7 @@ .export aslax1, shlax1 .importzp tmp1 - + aslax1: shlax1: stx tmp1 asl A diff --git a/libsrc/runtime/decsp1.s b/libsrc/runtime/decsp1.s index 5aa7fa204..3c673664a 100644 --- a/libsrc/runtime/decsp1.s +++ b/libsrc/runtime/decsp1.s @@ -20,4 +20,4 @@ - + diff --git a/libsrc/runtime/incsp1.s b/libsrc/runtime/incsp1.s index 43c92dc82..2272e200f 100644 --- a/libsrc/runtime/incsp1.s +++ b/libsrc/runtime/incsp1.s @@ -19,4 +19,4 @@ - + diff --git a/libsrc/runtime/incsp3.s b/libsrc/runtime/incsp3.s index 29067a55e..f54b13920 100644 --- a/libsrc/runtime/incsp3.s +++ b/libsrc/runtime/incsp3.s @@ -17,4 +17,4 @@ - + diff --git a/libsrc/runtime/incsp4.s b/libsrc/runtime/incsp4.s index 51e9229bb..736438fce 100644 --- a/libsrc/runtime/incsp4.s +++ b/libsrc/runtime/incsp4.s @@ -17,4 +17,4 @@ - + diff --git a/libsrc/runtime/incsp5.s b/libsrc/runtime/incsp5.s index 164c62524..55cf780d4 100644 --- a/libsrc/runtime/incsp5.s +++ b/libsrc/runtime/incsp5.s @@ -17,4 +17,4 @@ - + diff --git a/libsrc/runtime/incsp6.s b/libsrc/runtime/incsp6.s index 1a393840e..94c536e7c 100644 --- a/libsrc/runtime/incsp6.s +++ b/libsrc/runtime/incsp6.s @@ -17,4 +17,4 @@ - + diff --git a/libsrc/runtime/incsp7.s b/libsrc/runtime/incsp7.s index 8a5838137..be8784ecb 100644 --- a/libsrc/runtime/incsp7.s +++ b/libsrc/runtime/incsp7.s @@ -17,4 +17,4 @@ - + diff --git a/libsrc/runtime/land.s b/libsrc/runtime/land.s index 6ea4e5bcb..8e21ebb60 100644 --- a/libsrc/runtime/land.s +++ b/libsrc/runtime/land.s @@ -10,7 +10,7 @@ .importzp sp, sreg, tmp1 .macpack cpu - + tosand0ax: .if (.cpu .bitand ::CPU_ISET_65SC02) stz sreg @@ -19,7 +19,7 @@ tosand0ax: ldy #$00 sty sreg sty sreg+1 -.endif +.endif tosandeax: .if (.cpu .bitand ::CPU_ISET_65SC02) @@ -29,7 +29,7 @@ tosandeax: ldy #0 and (sp),y ; byte 0 iny -.endif +.endif sta tmp1 txa and (sp),y ; byte 1 diff --git a/libsrc/runtime/ldauisp.s b/libsrc/runtime/ldauisp.s index 1afcf2487..54f4d1bd1 100644 --- a/libsrc/runtime/ldauisp.s +++ b/libsrc/runtime/ldauisp.s @@ -21,4 +21,4 @@ ldauiysp: lda (ptr1),y rts - + diff --git a/libsrc/runtime/leave.s b/libsrc/runtime/leave.s index 4a9ff7994..95dcdec9d 100644 --- a/libsrc/runtime/leave.s +++ b/libsrc/runtime/leave.s @@ -1,4 +1,4 @@ -; +; ; Ullrich von Bassewitz, 06.08.1998 ; Christian Krueger, 11-Mar-2017, added 65SC02 optimization ; diff --git a/libsrc/runtime/leq.s b/libsrc/runtime/leq.s index 44316aa08..ac9894b53 100644 --- a/libsrc/runtime/leq.s +++ b/libsrc/runtime/leq.s @@ -7,7 +7,7 @@ .export toseqeax .import toslcmp, booleq -toseqeax: +toseqeax: jsr toslcmp ; Set flags jmp booleq ; Convert to boolean diff --git a/libsrc/runtime/lmod.s b/libsrc/runtime/lmod.s index caeb0c4f6..b8e796dea 100644 --- a/libsrc/runtime/lmod.s +++ b/libsrc/runtime/lmod.s @@ -23,7 +23,7 @@ tosmod0ax: sty sreg+1 .endif -tosmodeax: +tosmodeax: jsr poplsargs ; Get arguments from stack, adjust sign jsr udiv32 ; Do the division, remainder is in (ptr2:tmp3:tmp4) diff --git a/libsrc/runtime/lmul.s b/libsrc/runtime/lmul.s index d3c34637c..90d5f1e97 100644 --- a/libsrc/runtime/lmul.s +++ b/libsrc/runtime/lmul.s @@ -17,10 +17,10 @@ tosumul0ax: stz sreg stz sreg+1 .else - ldy #$00 + ldy #$00 sty sreg sty sreg+1 -.endif +.endif tosmuleax: tosumuleax: @@ -29,7 +29,7 @@ mul32: sta ptr1 .if (.cpu .bitand ::CPU_ISET_65SC02) lda (sp) ldy #1 -.else +.else ldy #0 lda (sp),y iny diff --git a/libsrc/runtime/lor.s b/libsrc/runtime/lor.s index 94ab3c890..f2204b981 100644 --- a/libsrc/runtime/lor.s +++ b/libsrc/runtime/lor.s @@ -8,7 +8,7 @@ .export tosor0ax, tosoreax .import addysp1 .importzp sp, sreg, tmp1 - + .macpack cpu tosor0ax: @@ -19,7 +19,7 @@ tosor0ax: ldy #$00 sty sreg sty sreg+1 -.endif +.endif tosoreax: .if (.cpu .bitand ::CPU_ISET_65SC02) @@ -29,7 +29,7 @@ tosoreax: ldy #0 ora (sp),y ; byte 0 iny -.endif +.endif sta tmp1 txa ora (sp),y ; byte 1 diff --git a/libsrc/runtime/lpop.s b/libsrc/runtime/lpop.s index ffff5ffc1..a90ea5fcb 100644 --- a/libsrc/runtime/lpop.s +++ b/libsrc/runtime/lpop.s @@ -22,7 +22,7 @@ popeax: ldy #3 tax .if (.cpu .bitand ::CPU_ISET_65SC02) lda (sp) -.else +.else dey lda (sp),y .endif diff --git a/libsrc/runtime/lpush.s b/libsrc/runtime/lpush.s index 4fed77f05..0bc67b523 100644 --- a/libsrc/runtime/lpush.s +++ b/libsrc/runtime/lpush.s @@ -41,9 +41,9 @@ pusheax: pla .if (.cpu .bitand ::CPU_ISET_65SC02) sta (sp) -.else +.else dey sta (sp),y -.endif +.endif rts diff --git a/libsrc/runtime/lrsub.s b/libsrc/runtime/lrsub.s index 928164f40..5e8d0b543 100644 --- a/libsrc/runtime/lrsub.s +++ b/libsrc/runtime/lrsub.s @@ -29,7 +29,7 @@ tosrsubeax: .if (.cpu .bitand ::CPU_ISET_65SC02) sbc (sp) ldy #1 -.else +.else ldy #0 sbc (sp),y ; byte 0 iny diff --git a/libsrc/runtime/lsub.s b/libsrc/runtime/lsub.s index 6f80491ca..4c50ded14 100644 --- a/libsrc/runtime/lsub.s +++ b/libsrc/runtime/lsub.s @@ -21,7 +21,7 @@ tossub0ax: ldy #$00 sty sreg sty sreg+1 -.endif +.endif tossubeax: sec diff --git a/libsrc/runtime/lsubeq.s b/libsrc/runtime/lsubeq.s index 5e3d25783..b16ab18e1 100644 --- a/libsrc/runtime/lsubeq.s +++ b/libsrc/runtime/lsubeq.s @@ -1,4 +1,4 @@ -; +; ; Ullrich von Bassewitz, 07.04.2000 ; Christian Krueger, 12-Mar-2017, added 65SC02 optimization ; @@ -22,19 +22,19 @@ lsubeqa: stx sreg+1 lsubeq: sty ptr1+1 ; Store high byte of address - + sec eor #$FF .if (.cpu .bitand ::CPU_ISET_65SC02) adc (ptr1) ; Subtract byte 0 sta (ptr1) - ldy #$01 ; Address byte 1 + ldy #$01 ; Address byte 1 .else ldy #$00 ; Address low byte adc (ptr1),y ; Subtract byte 0 sta (ptr1),y - iny ; Address byte 1 - .endif + iny ; Address byte 1 + .endif pha ; Save byte 0 of result for later txa eor #$FF diff --git a/libsrc/runtime/ltest.s b/libsrc/runtime/ltest.s index 6027b8dd4..d0caf2197 100644 --- a/libsrc/runtime/ltest.s +++ b/libsrc/runtime/ltest.s @@ -17,6 +17,6 @@ utsteax: beq L9 tya ldy #1 ; Force NE -L9: rts +L9: rts diff --git a/libsrc/runtime/ludiv.s b/libsrc/runtime/ludiv.s index 8a3126d72..e2e27371e 100644 --- a/libsrc/runtime/ludiv.s +++ b/libsrc/runtime/ludiv.s @@ -21,7 +21,7 @@ tosudiv0ax: sty sreg+1 .endif -tosudiveax: +tosudiveax: jsr getlop ; Get the paramameters jsr udiv32 ; Do the division lda ptr1 ; Result is in ptr1:sreg diff --git a/libsrc/runtime/lumod.s b/libsrc/runtime/lumod.s index 241801a90..09909c0c9 100644 --- a/libsrc/runtime/lumod.s +++ b/libsrc/runtime/lumod.s @@ -11,7 +11,7 @@ .macpack cpu -tosumod0ax: +tosumod0ax: .if (.cpu .bitand ::CPU_ISET_65SC02) stz sreg stz sreg+1 diff --git a/libsrc/runtime/lxor.s b/libsrc/runtime/lxor.s index 4ec9a4129..a92a59959 100644 --- a/libsrc/runtime/lxor.s +++ b/libsrc/runtime/lxor.s @@ -25,7 +25,7 @@ tosxoreax: .if (.cpu .bitand ::CPU_ISET_65SC02) eor (sp) ; byte 0 ldy #1 -.else +.else ldy #0 eor (sp),y ; byte 0 iny diff --git a/libsrc/runtime/mul.s b/libsrc/runtime/mul.s index 087e639fc..68cdea0c6 100644 --- a/libsrc/runtime/mul.s +++ b/libsrc/runtime/mul.s @@ -23,7 +23,7 @@ tosumulax: ; Do ptr4:ptr4+1 * ptr1:ptr1+1 --> AX - tya ; A = 0 + tya ; A = 0 ldy ptr1+1 ; check if lhs is 8 bit only beq @L4 ; -> we can do 8x16 after swap sta tmp1 @@ -36,7 +36,7 @@ tosumulax: clc adc ptr1 tax - lda ptr1+1 ; Hi byte of left op + lda ptr1+1 ; Hi byte of left op adc tmp1 sta tmp1 txa diff --git a/libsrc/runtime/mulax3.s b/libsrc/runtime/mulax3.s index 513ba723e..342379605 100644 --- a/libsrc/runtime/mulax3.s +++ b/libsrc/runtime/mulax3.s @@ -7,7 +7,7 @@ .export mulax3 .importzp ptr1 - + .proc mulax3 sta ptr1 diff --git a/libsrc/runtime/or.s b/libsrc/runtime/or.s index 1c2c4125e..735f30f61 100644 --- a/libsrc/runtime/or.s +++ b/libsrc/runtime/or.s @@ -21,7 +21,7 @@ tosorax: ldy #0 ora (sp),y iny -.endif +.endif sta tmp1 txa ora (sp),y diff --git a/libsrc/runtime/pushaff.s b/libsrc/runtime/pushaff.s index 08d988bb2..ae2142b0e 100644 --- a/libsrc/runtime/pushaff.s +++ b/libsrc/runtime/pushaff.s @@ -17,4 +17,4 @@ .endproc - + diff --git a/libsrc/runtime/pushax.s b/libsrc/runtime/pushax.s index cba313c2f..ac181b994 100644 --- a/libsrc/runtime/pushax.s +++ b/libsrc/runtime/pushax.s @@ -30,6 +30,6 @@ pusha0: ldx #0 pla ; (31) dey ; (33) sta (sp),y ; (38) - rts ; (44) + rts ; (44) .endproc diff --git a/libsrc/runtime/return0.s b/libsrc/runtime/return0.s index c061e013c..331f3334f 100644 --- a/libsrc/runtime/return0.s +++ b/libsrc/runtime/return0.s @@ -17,4 +17,4 @@ - + diff --git a/libsrc/runtime/return1.s b/libsrc/runtime/return1.s index 76153f3e1..e39cdf74e 100644 --- a/libsrc/runtime/return1.s +++ b/libsrc/runtime/return1.s @@ -17,4 +17,4 @@ - + diff --git a/libsrc/runtime/swap.s b/libsrc/runtime/swap.s index d4a74df5f..5358e08d3 100644 --- a/libsrc/runtime/swap.s +++ b/libsrc/runtime/swap.s @@ -23,13 +23,13 @@ swapstk: tay lda ptr4 sta (sp) - tya -.else + tya +.else dey lda (sp),y pha lda ptr4 sta (sp),y pla -.endif +.endif rts ; whew! diff --git a/libsrc/runtime/umod.s b/libsrc/runtime/umod.s index 5788d569e..205df59d7 100644 --- a/libsrc/runtime/umod.s +++ b/libsrc/runtime/umod.s @@ -25,4 +25,4 @@ tosumodax: ldx sreg+1 rts - + diff --git a/libsrc/runtime/umul16x16r32.s b/libsrc/runtime/umul16x16r32.s index cd2dae351..cfcf82d9e 100644 --- a/libsrc/runtime/umul16x16r32.s +++ b/libsrc/runtime/umul16x16r32.s @@ -12,7 +12,7 @@ ;--------------------------------------------------------------------------- ; 16x16 => 32 unsigned multiplication routine. Because the overhead for a -; 16x16 => 16 unsigned multiplication routine is small, we will tag it with +; 16x16 => 16 unsigned multiplication routine is small, we will tag it with ; the matching labels, as well. ; ; routine LHS RHS result result also in diff --git a/libsrc/sym1/read.s b/libsrc/sym1/read.s index c041664da..5f6a71144 100644 --- a/libsrc/sym1/read.s +++ b/libsrc/sym1/read.s @@ -48,6 +48,6 @@ putch: ldy #$00 ; Put char into return buffer done: lda ptr3 ldx ptr3+1 - rts ; Return count + rts ; Return count .endproc diff --git a/libsrc/sym1/write.s b/libsrc/sym1/write.s index dbe738468..008902e58 100644 --- a/libsrc/sym1/write.s +++ b/libsrc/sym1/write.s @@ -13,7 +13,7 @@ .proc _write - sta ptr3 + sta ptr3 stx ptr3+1 ; Count in ptr3 inx stx ptr2+1 ; Increment and store in ptr2 diff --git a/libsrc/telestrat/cclear.s b/libsrc/telestrat/cclear.s index b9fce4708..804381e89 100644 --- a/libsrc/telestrat/cclear.s +++ b/libsrc/telestrat/cclear.s @@ -6,9 +6,9 @@ ; .export _cclearxy, _cclear - .import update_adscr, display_conio + .import update_adscr, display_conio - .importzp tmp1 + .importzp tmp1 .import popax .include "telestrat.inc" diff --git a/libsrc/telestrat/chline.s b/libsrc/telestrat/chline.s index 91f3bdc9f..cd7628eca 100644 --- a/libsrc/telestrat/chline.s +++ b/libsrc/telestrat/chline.s @@ -4,7 +4,7 @@ ; .export _chlinexy, _chline - + .import rvs, display_conio, update_adscr .import popax @@ -22,7 +22,7 @@ _chlinexy: _chline: tax ; Is the length zero? beq @L9 ; Jump if done -@L1: +@L1: lda #'-' ; Horizontal line screen code ora rvs diff --git a/libsrc/telestrat/clrscr.s b/libsrc/telestrat/clrscr.s index c02c26647..749e40b8f 100644 --- a/libsrc/telestrat/clrscr.s +++ b/libsrc/telestrat/clrscr.s @@ -4,7 +4,7 @@ .export _clrscr .import OLD_CHARCOLOR, OLD_BGCOLOR, BGCOLOR, CHARCOLOR - + .include "telestrat.inc" .proc _clrscr @@ -35,13 +35,13 @@ ldx #$00 stx SCRY stx SCRX - + stx OLD_BGCOLOR ; Black stx BGCOLOR - + ldx #$07 ; White stx OLD_CHARCOLOR stx CHARCOLOR - + rts .endproc diff --git a/libsrc/telestrat/cputc.s b/libsrc/telestrat/cputc.s index 16b13f8cd..13714b32d 100644 --- a/libsrc/telestrat/cputc.s +++ b/libsrc/telestrat/cputc.s @@ -6,7 +6,7 @@ .export _cputc, _cputcxy, cputdirect, display_conio .export CHARCOLOR, OLD_CHARCOLOR, BGCOLOR, OLD_BGCOLOR - + .import update_adscr .import popax @@ -19,13 +19,13 @@ _cputcxy: sta SCRY ; Store Y stx SCRX ; Store X jsr update_adscr - pla + pla _cputc: cmp #$0D bne @not_CR ldy #$00 - sty SCRX + sty SCRX rts @not_CR: cmp #$0A @@ -80,10 +80,10 @@ do_not_change_color: sty SCRX inc SCRY - + jmp update_adscr - -@no_inc: + +@no_inc: sty SCRX rts .endproc diff --git a/libsrc/telestrat/gotoxy.s b/libsrc/telestrat/gotoxy.s index 3fbdc25e0..c0907a623 100644 --- a/libsrc/telestrat/gotoxy.s +++ b/libsrc/telestrat/gotoxy.s @@ -19,7 +19,7 @@ gotoxy: jsr popa ; Get Y ; In telemon, there is a position for the prompt, and another for the cursor. sta SCRY - + jsr popa sta SCRX @@ -48,6 +48,6 @@ skip: sta ADSCR dey bne loop -out: +out: rts .endproc diff --git a/libsrc/telestrat/joy/telestrat.s b/libsrc/telestrat/joy/telestrat.s index e4a6d94f2..0f5d28651 100644 --- a/libsrc/telestrat/joy/telestrat.s +++ b/libsrc/telestrat/joy/telestrat.s @@ -52,7 +52,7 @@ INSTALL: lda #%11000000 sta VIA2::DDRB sta VIA2::PRB - ; We could detect joysticks because with previous command bit0,1,2,3,4 should be set to 1 after + ; We could detect joysticks because with previous command bit0,1,2,3,4 should be set to 1 after ; But if some one press fire or press direction, we could reach others values which could break joystick detection. lda #JOY_ERR_OK @@ -83,7 +83,7 @@ COUNT: ; PB7 and PB6 select right or left port ; When PB7 and PB6 are high, it controls two CA3083 (2 NPN transistors array) bases. ; In that case, PB0 to PB4 are set to high (it means no action are pressed) -; When the user press something then bit will be set to 0. +; When the user press something then bit will be set to 0. ; Bit 0 is right ; Bit 1 is left ; Bit 2 is fire @@ -94,18 +94,18 @@ READ: lda VIA2::PRB and #%01111111 - ora #%01000000 + ora #%01000000 sta VIA2::PRB ; then read lda VIA2::PRB eor #%01011111 - + rts -right: +right: lda VIA2::PRB and #%10111111 ora #%10000000 - sta VIA2::PRB + sta VIA2::PRB ; then read lda VIA2::PRB diff --git a/libsrc/telestrat/orixhdr.s b/libsrc/telestrat/orixhdr.s index 58e93efbb..78d6c945a 100644 --- a/libsrc/telestrat/orixhdr.s +++ b/libsrc/telestrat/orixhdr.s @@ -24,7 +24,7 @@ .byte $01 ; Version of the header .byte $00,%00000000 ; 6502 only .byte $00,$00 ; Type of language - .byte $00,$00 ; OS version + .byte $00,$00 ; OS version .byte $00 ; Reserved .byte $00 ; Auto or not diff --git a/libsrc/telestrat/sound.s b/libsrc/telestrat/sound.s index 3718debd4..2a786a452 100644 --- a/libsrc/telestrat/sound.s +++ b/libsrc/telestrat/sound.s @@ -33,7 +33,7 @@ sound_bip_keyboard: rts .endproc -.proc _zap +.proc _zap BRK_TELEMON XZAP rts .endproc diff --git a/libsrc/telestrat/syschdir.s b/libsrc/telestrat/syschdir.s index 09763bdbb..6257880b8 100644 --- a/libsrc/telestrat/syschdir.s +++ b/libsrc/telestrat/syschdir.s @@ -11,7 +11,7 @@ .include "telestrat.inc" .include "zeropage.inc" - + __syschdir: ; Throw away all parameters except the name @@ -24,9 +24,9 @@ __syschdir: stx tmp1 ldy tmp1 - + ; Call telemon primitive - + BRK_TELEMON(XPUTCWD) jmp initcwd ; Update cwd diff --git a/libsrc/telestrat/sysmkdir.s b/libsrc/telestrat/sysmkdir.s index 26d97c4b0..259be8d7c 100644 --- a/libsrc/telestrat/sysmkdir.s +++ b/libsrc/telestrat/sysmkdir.s @@ -9,7 +9,7 @@ .include "telestrat.inc" .include "zeropage.inc" - + __sysmkdir: ; Throw away all parameters except the name @@ -19,11 +19,11 @@ __sysmkdir: ; Get name jsr popax - + ; Call telemon primitive - + BRK_TELEMON(XMKDIR) - + rts diff --git a/libsrc/telestrat/tgi/telestrat-228-200-3.s b/libsrc/telestrat/tgi/telestrat-228-200-3.s index 7eda27bc9..402e04e7e 100644 --- a/libsrc/telestrat/tgi/telestrat-228-200-3.s +++ b/libsrc/telestrat/tgi/telestrat-228-200-3.s @@ -107,7 +107,7 @@ INIT: ; Switch into graphics mode. BRK_TELEMON(XHIRES) - + ; Done, reset the error code. lda #TGI_ERR_OK @@ -255,18 +255,18 @@ GETDEFPALETTE: SETPIXEL: lda #$80 - + SETPIXELSETMODE: sta HRSFB lda X1 sta HRS1 lda Y1 sta HRS2 - - + + BRK_TELEMON(XCURSE) - + rts ; ------------------------------------------------------------------------ @@ -291,7 +291,7 @@ LINE: sta HRS1 lda Y1 sta HRS2 - + lda X2 sta HRS3 lda Y2 @@ -300,14 +300,14 @@ LINE: lda X1+1 sta HRS1+1 - lda Y1+1 + lda Y1+1 sta HRS2+1 lda X2+1 sta HRS3+1 - - lda Y2+1 - sta HRS4+1 + + lda Y2+1 + sta HRS4+1 lda #$FF sta HRSPAT @@ -315,12 +315,12 @@ LINE: BRK_TELEMON(XDRAWA) rts - - + + CIRCLE: ; not done yet rts - + ; ------------------------------------------------------------------------ ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where ; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4, using the current drawing color. @@ -364,11 +364,11 @@ OUTTEXT: ; put hires cursor in X & Y lda #$00 jsr SETPIXELSETMODE - - + + ; count the length of the string ldy #$00 -loop: +loop: lda (ptr3),y beq out iny @@ -376,10 +376,10 @@ loop: out: ; XSCHAR routine from telemon needs to have the length of the string in X register ; copy Y register to X register. It could be optimized in 65C02 with TYX - tya + tya tax - + lda ptr3 ; XSCHAR needs in A and Y the address of the string - ldy ptr3+1 + ldy ptr3+1 BRK_TELEMON(XSCHAR) rts diff --git a/libsrc/telestrat/tgi/telestrat-240-200-2.s b/libsrc/telestrat/tgi/telestrat-240-200-2.s index 7a6bb8a4c..d619fc6f1 100644 --- a/libsrc/telestrat/tgi/telestrat-240-200-2.s +++ b/libsrc/telestrat/tgi/telestrat-240-200-2.s @@ -124,7 +124,7 @@ INIT: ; Switch into graphics mode BRK_TELEMON(XHIRES) - + ; Done, reset the error code lda #TGI_ERR_OK @@ -247,17 +247,17 @@ GETDEFPALETTE: ; SETPIXEL: - lda #$80 ; curset on -SETPIXELSETMODE: + lda #$80 ; curset on +SETPIXELSETMODE: sta HRSFB - + lda X1 sta HRS1 lda Y1 sta HRS2 - - - + + + BRK_TELEMON(XCURSE) rts @@ -289,19 +289,19 @@ LINE: sta HRS3 lda Y2 sta HRS4 - + lda X1+1 sta HRS1+1 - lda Y1+1 + lda Y1+1 sta HRS2+1 lda X2+1 sta HRS3+1 - - lda Y2+1 - sta HRS4+1 + + lda Y2+1 + sta HRS4+1 lda #$FF sta HRSPAT @@ -309,11 +309,11 @@ LINE: BRK_TELEMON(XDRAWA) rts - -CIRCLE: + +CIRCLE: ; not done yet - rts - + rts + ; ------------------------------------------------------------------------ ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where ; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4 using the current drawing color. @@ -357,11 +357,11 @@ OUTTEXT: ; put hires cursor in X & Y lda #$00 jsr SETPIXELSETMODE - - + + ; count the length of the string ldy #$00 -loop: +loop: lda (ptr3),y beq out iny @@ -369,10 +369,10 @@ loop: out: ; XSCHAR routine from telemon needs to have the length of the string in X register ; copy Y register to X register. It could be optimized in 65C02 with TYX - tya + tya tax - + lda ptr3 ; XSCHAR needs in A and Y the address of the string - ldy ptr3+1 + ldy ptr3+1 BRK_TELEMON(XSCHAR) rts diff --git a/libsrc/tgi/tgi_gettextheight.s b/libsrc/tgi/tgi_gettextheight.s index 38df6a69a..bd05386c1 100644 --- a/libsrc/tgi/tgi_gettextheight.s +++ b/libsrc/tgi/tgi_gettextheight.s @@ -15,7 +15,7 @@ ; */ ; -.proc _tgi_gettextheight +.proc _tgi_gettextheight ldy _tgi_font bne @L2 ; Jump if vector font diff --git a/libsrc/tgi/tgi_imulround.s b/libsrc/tgi/tgi_imulround.s index 112f2930f..7b7f25b78 100644 --- a/libsrc/tgi/tgi_imulround.s +++ b/libsrc/tgi/tgi_imulround.s @@ -1,7 +1,7 @@ ; ; Ullrich von Bassewitz, 2009-11-05 ; -; Helper function for graphics functions: Multiply two values, one being +; Helper function for graphics functions: Multiply two values, one being ; an 8.8 fixed point one, and return the rounded and scaled result. ; ; The module has two entry points: One is C callable and expects the @@ -60,4 +60,4 @@ tgi_imulround: tya rts - + diff --git a/libsrc/tgi/tgi_lineto.s b/libsrc/tgi/tgi_lineto.s index abe4b3f96..6934bfe2c 100644 --- a/libsrc/tgi/tgi_lineto.s +++ b/libsrc/tgi/tgi_lineto.s @@ -17,7 +17,7 @@ @L1: lda _tgi_curx,y sta tgi_clip_x1,y dey - bpl @L1 + bpl @L1 pla jsr tgi_linepop ; Pop x2/y2 jmp tgi_clippedline ; Call the line clipper diff --git a/libsrc/tgi/tgi_outtext.s b/libsrc/tgi/tgi_outtext.s index 079cea3af..e0a3c6d25 100644 --- a/libsrc/tgi/tgi_outtext.s +++ b/libsrc/tgi/tgi_outtext.s @@ -125,7 +125,7 @@ VectorFont: jsr MoveCursor ; Move the graphics cursor ; Next char in string - + inc text bne @L1 inc text+1 diff --git a/libsrc/tgi/tgidrv_line.inc b/libsrc/tgi/tgidrv_line.inc index e904b5117..5fd6b229e 100644 --- a/libsrc/tgi/tgidrv_line.inc +++ b/libsrc/tgi/tgidrv_line.inc @@ -269,7 +269,7 @@ abs: ; A/Y := abs (A/Y) cpy #$00 bpl :+ - + ; A/Y := neg (A/Y) neg: clc eor #$FF From 299f967527a2ca9d8aa9bca4d641d41d0c518ef5 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 17 Apr 2022 16:06:45 +0200 Subject: [PATCH 22/33] remove dangling spaces --- samples/geos/dialog.c | 4 ++-- samples/geos/filesel.c | 6 +++--- samples/geos/geosconio.c | 10 +++++----- samples/geos/geosver.c | 2 +- samples/geos/hello1.c | 8 ++++---- samples/geos/hello2.c | 12 ++++++------ samples/geos/overlay-demo.c | 2 +- samples/geos/rmvprot.c | 8 ++++---- samples/sym1/symDisplay.c | 4 ++-- samples/sym1/symExtendedMemory.c | 2 +- samples/sym1/symIO.c | 4 ++-- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/samples/geos/dialog.c b/samples/geos/dialog.c index 27199a493..c3231e855 100644 --- a/samples/geos/dialog.c +++ b/samples/geos/dialog.c @@ -1,4 +1,4 @@ -/* Note: +/* Note: ** This is just a sample piece of code that shows how to use some structs - ** it may not even run. */ @@ -28,5 +28,5 @@ static const dlgBoxStr myDialog = { void main (void) { - DoDlgBox (&myDialog); + DoDlgBox (&myDialog); } diff --git a/samples/geos/filesel.c b/samples/geos/filesel.c index c0a591eb9..fcca258bb 100644 --- a/samples/geos/filesel.c +++ b/samples/geos/filesel.c @@ -1,11 +1,11 @@ /* GEOSLib example - + using DlgBoxFileSelect - + Maciej 'YTM/Elysium' Witkowiak - + 26.12.1999 */ diff --git a/samples/geos/geosconio.c b/samples/geos/geosconio.c index 963fa06a0..55acac38e 100644 --- a/samples/geos/geosconio.c +++ b/samples/geos/geosconio.c @@ -9,16 +9,16 @@ void main(void) char ch; DlgBoxOk("Now the screen will be", "cleared."); - + clrscr(); - + DlgBoxOk("Now a character will be", "written at 20,20"); - + gotoxy(20, 20); cputc('A'); DlgBoxOk("Now a string will be", "written at 0,1"); - + cputsxy(0, 1, CBOLDON "Just" COUTLINEON "a " CITALICON "string." CPLAINTEXT ); DlgBoxOk("Write text and finish it", "with a dot."); @@ -31,7 +31,7 @@ void main(void) cursor(0); DlgBoxOk("Seems that it is all for conio.", "Let's test mouse routines."); - + mouse_init(1); cputsxy(0, 2, CBOLDON "Now you can't see mouse (press any key)" CPLAINTEXT); mouse_hide(); diff --git a/samples/geos/geosver.c b/samples/geos/geosver.c index 3d68798a2..fa8351e0d 100644 --- a/samples/geos/geosver.c +++ b/samples/geos/geosver.c @@ -57,6 +57,6 @@ void main (void) } Sleep(10*50); - + return; } diff --git a/samples/geos/hello1.c b/samples/geos/hello1.c index 8dc13d5b4..bd51dd1b9 100644 --- a/samples/geos/hello1.c +++ b/samples/geos/hello1.c @@ -1,11 +1,11 @@ /* GEOSLib example - + Hello, world example - with DBox - + Maciej 'YTM/Elysium' Witkowiak - + 26.12.1999 */ @@ -18,7 +18,7 @@ void main (void) DlgBoxOk(CBOLDON "Hello, world" CPLAINTEXT, "This is written in C!"); - + // Normal apps exit from main into system's mainloop, and app finish // when user selects it from icons or menu, but here we want to exit // immediately. diff --git a/samples/geos/hello2.c b/samples/geos/hello2.c index 3f148b0b8..ae93fa1a4 100644 --- a/samples/geos/hello2.c +++ b/samples/geos/hello2.c @@ -1,11 +1,11 @@ /* GEOSLib example - + Hello, world example - using graphic functions - + Maciej 'YTM/Alliance' Witkowiak - + 26.12.1999 */ @@ -25,18 +25,18 @@ void main (void) SetPattern(0); InitDrawWindow(&wholeScreen); Rectangle(); - + // Now some texts PutString(COUTLINEON "This is compiled using cc65!" CPLAINTEXT, 20, 10); PutString(CBOLDON "This is bold", 30, 10); PutString(CULINEON "and this is bold and underline!", 40, 10); PutString(CPLAINTEXT "This is plain text", 50, 10); - + // Wait for 5 secs... // Note that this is multitasking sleep, and if there are any icons/menus onscreen, // they would be usable, in this case you have only pointer usable Sleep(5*50); - + // Normal apps exit from main into system's mainloop, and app finish // when user selects it from icons or menu, but here we want to exit // immediately. diff --git a/samples/geos/overlay-demo.c b/samples/geos/overlay-demo.c index a37f6bdcb..73ab0e3c0 100644 --- a/samples/geos/overlay-demo.c +++ b/samples/geos/overlay-demo.c @@ -33,7 +33,7 @@ void foo(void) { /* Functions resident in an overlay can access all program variables and ** constants at any time without any precautions because those are never - ** placed in overlays. The string constant "One" is an example for such + ** placed in overlays. The string constant "One" is an example for such ** a constant resident in the main program. */ show("One"); diff --git a/samples/geos/rmvprot.c b/samples/geos/rmvprot.c index 4f8798f98..152f6cf0f 100644 --- a/samples/geos/rmvprot.c +++ b/samples/geos/rmvprot.c @@ -1,12 +1,12 @@ /* GEOSLib example - + This small application removes GEOS disk write protection tag. e.g. boot disk is always protected after boot-up - + Maciej 'YTM/Elysium' Witkowiak - + 21.03.2000 */ @@ -60,7 +60,7 @@ void main(void) { // Here we clear the screen. Not really needed anyway... GraphicsString(&clearScreen); - + // Get the name of current disk to show it in dialog box GetPtrCurDkNm(diskName); diff --git a/samples/sym1/symDisplay.c b/samples/sym1/symDisplay.c index dce39f6b9..43d18f911 100644 --- a/samples/sym1/symDisplay.c +++ b/samples/sym1/symDisplay.c @@ -14,7 +14,7 @@ int main (void) { int flashes = 255; int displayable = 1; int e = 0; - int r = 0; + int r = 0; int d = 0; int i = 0; int l = 0; @@ -40,7 +40,7 @@ int main (void) { puts ("\n\nHow many times (0 for forever) to repeat?"); c = getchar(); if ( (c >= '0') && (c <= '9') ) {// between 1 and 9 loops allowed - z = 1; // a number was pressed + z = 1; // a number was pressed t = c - '0'; // convert char to int puts ("\n\nLook at the front panel.\n"); } diff --git a/samples/sym1/symExtendedMemory.c b/samples/sym1/symExtendedMemory.c index cc01da353..897276e6f 100644 --- a/samples/sym1/symExtendedMemory.c +++ b/samples/sym1/symExtendedMemory.c @@ -72,7 +72,7 @@ int main (void) { error = 0; } } - segment += 0x1000; // Increment to next segment + segment += 0x1000; // Increment to next segment } segment[0] = 0x00; // Check beginning of top memory segment diff --git a/samples/sym1/symIO.c b/samples/sym1/symIO.c index 50fefc303..bb46dc3df 100644 --- a/samples/sym1/symIO.c +++ b/samples/sym1/symIO.c @@ -52,7 +52,7 @@ int main (void) { ior3b = VIA3.prb; puts ("================== Digital I/O Status =================="); - puts (" Port1A Port1B Port2A Port2B Port3A Port3B" ); + puts (" Port1A Port1B Port2A Port2B Port3A Port3B" ); printf ("DDR %02X %02X %02X %02X %02X %02X\n\r",ddr1a,ddr1b,ddr2a,ddr2b,ddr3a,ddr3b); printf ("IOR %02X %02X %02X %02X %02X %02X\n\r",ior1a,ior1b,ior2a,ior2b,ior3a,ior3b); puts ("========================================================\n"); @@ -75,7 +75,7 @@ int main (void) { cmd[strlen(cmd)-1] = '\0'; if ( strncasecmp(cmd, "quit", 4) == 0 ) { - going = 0; + going = 0; } else if ( strncasecmp(cmd, "help", 4) == 0 ) { instr = 1; From 3c1bb85b8ea7417f31ccd915119a8e71c50f2f3d Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 17 Apr 2022 16:07:09 +0200 Subject: [PATCH 23/33] remove dangling spaces --- src/ar65/del.h | 2 +- src/ca65/anonname.c | 2 +- src/ca65/anonname.h | 2 +- src/ca65/easw16.c | 2 +- src/ca65/easw16.h | 2 +- src/ca65/instr.c | 10 +++++----- src/ca65/instr.h | 2 +- src/ca65/istack.c | 2 +- src/ca65/macro.h | 2 +- src/ca65/options.c | 2 +- src/ca65/span.c | 4 ++-- src/ca65/studyexpr.h | 2 +- src/ca65/symbol.c | 2 +- src/ca65/ulabel.c | 4 ++-- src/cc65/codeent.c | 2 +- src/cc65/datatype.c | 2 +- src/cc65/declare.c | 2 +- src/cc65/expr.c | 2 +- src/cl65/error.c | 2 +- src/cl65/main.c | 4 ++-- src/co65/convert.h | 2 +- src/co65/error.c | 2 +- src/co65/model.c | 2 +- src/common/debugflag.c | 2 +- src/common/debugflag.h | 2 +- src/common/filepos.c | 2 +- src/common/searchpath.c | 4 ++-- src/common/strstack.c | 4 ++-- src/common/strutil.c | 4 ++-- src/common/va_copy.h | 2 +- src/common/xsprintf.c | 2 +- src/common/xsprintf.h | 6 +++--- src/da65/comments.c | 2 +- src/da65/opc6502dtv.h | 2 +- src/da65/opc6502x.h | 2 +- src/da65/opctable.h | 2 +- src/dbginfo/dbginfo.h | 2 +- src/ld65/condes.c | 2 +- src/ld65/fragment.h | 2 +- src/ld65/mapfile.c | 2 +- src/od65/dump.c | 2 +- src/od65/fileio.c | 2 +- src/sim65/6502.c | 8 ++++---- src/sp65/bin.c | 2 +- src/sp65/color.h | 2 +- src/sp65/geosbitmap.h | 6 +++--- src/sp65/koala.c | 2 +- src/sp65/lynxsprite.h | 2 +- src/sp65/vic2sprite.c | 2 +- src/sp65/vic2sprite.h | 2 +- 50 files changed, 67 insertions(+), 67 deletions(-) diff --git a/src/ar65/del.h b/src/ar65/del.h index 6100fe60a..dd45d0ec5 100644 --- a/src/ar65/del.h +++ b/src/ar65/del.h @@ -49,6 +49,6 @@ void DelObjFiles (int argc, char* argv []); -/* End of del.h */ +/* End of del.h */ #endif diff --git a/src/ca65/anonname.c b/src/ca65/anonname.c index 90b73fcab..fca20c8cd 100644 --- a/src/ca65/anonname.c +++ b/src/ca65/anonname.c @@ -72,7 +72,7 @@ StrBuf* AnonName (StrBuf* Buf, const char* Spec) int IsAnonName (const StrBuf* Name) /* Check if the given symbol name is that of an anonymous symbol */ -{ +{ if (SB_GetLen (Name) < sizeof (AnonTag) - 1) { /* Too short */ return 0; diff --git a/src/ca65/anonname.h b/src/ca65/anonname.h index 142cd9f87..7d5671c68 100644 --- a/src/ca65/anonname.h +++ b/src/ca65/anonname.h @@ -58,7 +58,7 @@ StrBuf* AnonName (StrBuf* Buf, const char* Spec); int IsAnonName (const StrBuf* Name); /* Check if the given symbol name is that of an anonymous symbol */ - + /* End of anonname.h */ diff --git a/src/ca65/easw16.c b/src/ca65/easw16.c index 578a25734..081828991 100644 --- a/src/ca65/easw16.c +++ b/src/ca65/easw16.c @@ -147,4 +147,4 @@ void GetSweet16EA (EffAddr* A) } - + diff --git a/src/ca65/easw16.h b/src/ca65/easw16.h index b8b06d466..03a48c437 100644 --- a/src/ca65/easw16.h +++ b/src/ca65/easw16.h @@ -65,4 +65,4 @@ void GetSweet16EA (EffAddr* A); - + diff --git a/src/ca65/instr.c b/src/ca65/instr.c index faeff2026..834edfb5f 100644 --- a/src/ca65/instr.c +++ b/src/ca65/instr.c @@ -303,9 +303,9 @@ static const struct { } }; -/* Instruction table for the 6502 with DTV extra opcodes (DTV) and +/* Instruction table for the 6502 with DTV extra opcodes (DTV) and ** those illegal instructions (X) which are supported by DTV. -** Note: illegals opcodes which contain more subinstructions +** Note: illegals opcodes which contain more subinstructions ** (ASO, DCM, LSE, LXA, SBX and SHS) are not enlisted. */ static const struct { @@ -1207,9 +1207,9 @@ static int EvalEA (const InsDesc* Ins, EffAddr* A) } else { ED.AddrSize = DataAddrSize; /* If the default address size of the data segment is unequal - ** to zero page addressing, but zero page addressing is - ** allowed by the instruction, mark all symbols in the - ** expression tree. This mark will be checked at end of + ** to zero page addressing, but zero page addressing is + ** allowed by the instruction, mark all symbols in the + ** expression tree. This mark will be checked at end of ** assembly, and a warning is issued, if a zero page symbol ** was guessed wrong here. */ diff --git a/src/ca65/instr.h b/src/ca65/instr.h index 0a1a5e13d..fe18d2110 100644 --- a/src/ca65/instr.h +++ b/src/ca65/instr.h @@ -101,7 +101,7 @@ /* Bitmask for all FAR operations */ #define AM65_ALL_FAR (AM65_ABS_LONG | AM65_ABS_LONG_X) - + /* Bitmask for all immediate operations */ #define AM65_ALL_IMM (AM65_IMM_ACCU | AM65_IMM_INDEX | AM65_IMM_IMPLICIT | AM65_IMM_IMPLICIT_WORD) diff --git a/src/ca65/istack.c b/src/ca65/istack.c index 8cda7dd2f..7a95e7e8c 100644 --- a/src/ca65/istack.c +++ b/src/ca65/istack.c @@ -81,7 +81,7 @@ void PushInput (int (*Func) (void*), void* Data, const char* Desc) /* Check for a stack overflow */ if (ICount > ISTACK_MAX) { Fatal ("Maximum input stack nesting exceeded"); - } + } /* Create a new stack element */ E = xmalloc (sizeof (*E)); diff --git a/src/ca65/macro.h b/src/ca65/macro.h index bb7b817a8..7f4335706 100644 --- a/src/ca65/macro.h +++ b/src/ca65/macro.h @@ -62,7 +62,7 @@ struct StrBuf; struct Macro; typedef struct Macro Macro; - + /*****************************************************************************/ /* Code */ diff --git a/src/ca65/options.c b/src/ca65/options.c index c71296a57..84d7148be 100644 --- a/src/ca65/options.c +++ b/src/ca65/options.c @@ -182,4 +182,4 @@ void WriteOptions (void) - + diff --git a/src/ca65/span.c b/src/ca65/span.c index a4faea121..5ab3fc955 100644 --- a/src/ca65/span.c +++ b/src/ca65/span.c @@ -204,7 +204,7 @@ static Span* MergeSpan (Span* S) void SetSpanType (Span* S, const StrBuf* Type) /* Set the generic type of the span to Type */ -{ +{ /* Ignore the call if we won't generate debug infos */ if (DbgSyms) { S->Type = GetStrBufId (Type); @@ -354,7 +354,7 @@ static int CollectSpans (void* Entry, void* Data) return 0; } - + void WriteSpans (void) /* Write all spans to the object file */ diff --git a/src/ca65/studyexpr.h b/src/ca65/studyexpr.h index 389bce5a3..a81f6c9c8 100644 --- a/src/ca65/studyexpr.h +++ b/src/ca65/studyexpr.h @@ -36,7 +36,7 @@ #ifndef STUDYEXPR_H #define STUDYEXPR_H - + /* common */ #include "exprdefs.h" diff --git a/src/ca65/symbol.c b/src/ca65/symbol.c index 3b06fd1a2..f1c259082 100644 --- a/src/ca65/symbol.c +++ b/src/ca65/symbol.c @@ -187,7 +187,7 @@ SymEntry* ParseScopedSymName (SymFindAction Action) ** may not expect NULL to be returned if Action contains SYM_ALLOC_NEW, ** create a new symbol. */ - if (Action & SYM_ALLOC_NEW) { + if (Action & SYM_ALLOC_NEW) { Sym = NewSymEntry (&Ident, SF_NONE); } else { Sym = 0; diff --git a/src/ca65/ulabel.c b/src/ca65/ulabel.c index 9712f4942..1127c3743 100644 --- a/src/ca65/ulabel.c +++ b/src/ca65/ulabel.c @@ -160,7 +160,7 @@ void ULabDef (void) */ ULabel* L = CollAtUnchecked (&ULabList, ULabDefCount); CHECK (L->Val == 0); - L->Val = GenCurrentPC (); + L->Val = GenCurrentPC (); ReleaseFullLineInfo (&L->LineInfos); GetFullLineInfo (&L->LineInfos); } else { @@ -200,7 +200,7 @@ ExprNode* ULabResolve (unsigned Index) void ULabDone (void) -/* Run through all unnamed labels, check for anomalies and errors and do +/* Run through all unnamed labels, check for anomalies and errors and do ** necessary cleanups. */ { diff --git a/src/cc65/codeent.c b/src/cc65/codeent.c index 0a1b917db..62118d80c 100644 --- a/src/cc65/codeent.c +++ b/src/cc65/codeent.c @@ -1781,7 +1781,7 @@ void CE_GenRegInfo (CodeEntry* E, RegContents* InputRegs) if (RegValIsKnown (In->RegX)) { Out->RegX = (In->RegX ^ 0xFF); } - } else if (strncmp (E->Arg, "asrax", 5) == 0 || + } else if (strncmp (E->Arg, "asrax", 5) == 0 || strncmp (E->Arg, "shrax", 5) == 0) { if (RegValIsKnown (In->RegX)) { if (In->RegX == 0x00 || In->RegX == 0xFF) { diff --git a/src/cc65/datatype.c b/src/cc65/datatype.c index e5d3f8d96..cc313bd21 100644 --- a/src/cc65/datatype.c +++ b/src/cc65/datatype.c @@ -1105,7 +1105,7 @@ Type* NewBitFieldType (const Type* T, unsigned BitOffs, unsigned BitWidth) /* The type specifier must be integeral */ CHECK (IsClassInt (T)); - + /* Allocate the new type string */ P = TypeAlloc (3); diff --git a/src/cc65/declare.c b/src/cc65/declare.c index fa4c52818..017a69874 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -2267,7 +2267,7 @@ static void DefineBitFieldData (StructInitData* SI) static void DefineStrData (Literal* Lit, unsigned Count) -{ +{ /* Translate into target charset */ TranslateLiteral (Lit); diff --git a/src/cc65/expr.c b/src/cc65/expr.c index ab48a4554..7343702ea 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -3786,7 +3786,7 @@ static void hieOr (ExprDesc *Expr) /* 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 */ diff --git a/src/cl65/error.c b/src/cl65/error.c index ee2adcfcc..9c234681f 100644 --- a/src/cl65/error.c +++ b/src/cl65/error.c @@ -39,7 +39,7 @@ /* common */ #include "cmdline.h" - + /* cl65 */ #include "global.h" #include "error.h" diff --git a/src/cl65/main.c b/src/cl65/main.c index 023e111e0..e032baee4 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -1503,7 +1503,7 @@ int main (int argc, char* argv []) case 'E': /* Forward -E to compiler */ - CmdAddArg (&CC65, Arg); + CmdAddArg (&CC65, Arg); DisableAssemblingAndLinking (); break; @@ -1513,7 +1513,7 @@ int main (int argc, char* argv []) OptAsmArgs (Arg, GetArg (&I, 3)); } else if (Arg[2] == 'c' && Arg[3] == '\0') { /* -Wc: Pass options to compiler */ - /* Remember -Wc sub arguments in cc65 arg struct */ + /* Remember -Wc sub arguments in cc65 arg struct */ OptCCArgs (Arg, GetArg (&I, 3)); } else if (Arg[2] == 'l' && Arg[3] == '\0') { /* -Wl: Pass options to linker */ diff --git a/src/co65/convert.h b/src/co65/convert.h index 8c7782ff3..5045acedd 100644 --- a/src/co65/convert.h +++ b/src/co65/convert.h @@ -56,7 +56,7 @@ struct O65Data; void Convert (const struct O65Data* D); -/* Convert the o65 file in D */ +/* Convert the o65 file in D */ diff --git a/src/co65/error.c b/src/co65/error.c index 1fa099c94..dc3e4e73b 100644 --- a/src/co65/error.c +++ b/src/co65/error.c @@ -81,7 +81,7 @@ void Error (const char* Format, ...) void Internal (const char* Format, ...) /* Print an internal error message and die */ { - va_list ap; + va_list ap; va_start (ap, Format); fprintf (stderr, "%s: Internal error: ", ProgName); vfprintf (stderr, Format, ap); diff --git a/src/co65/model.c b/src/co65/model.c index bb815cd15..2206993bf 100644 --- a/src/co65/model.c +++ b/src/co65/model.c @@ -53,7 +53,7 @@ O65Model Model = O65_MODEL_NONE; /* Name table */ static const char* const NameTable[O65_MODEL_COUNT] = { - "none", + "none", "os/a65", "lunix", "cc65-module" diff --git a/src/common/debugflag.c b/src/common/debugflag.c index 7d2e80009..0a452ae36 100644 --- a/src/common/debugflag.c +++ b/src/common/debugflag.c @@ -32,7 +32,7 @@ /*****************************************************************************/ - + /* common */ #include "debugflag.h" diff --git a/src/common/debugflag.h b/src/common/debugflag.h index d325a9eb9..39034044e 100644 --- a/src/common/debugflag.h +++ b/src/common/debugflag.h @@ -31,7 +31,7 @@ /* */ /*****************************************************************************/ - + #ifndef DEBUGFLAG_H #define DEBUGFLAG_H diff --git a/src/common/filepos.c b/src/common/filepos.c index 51488ffe5..b2cac79e1 100644 --- a/src/common/filepos.c +++ b/src/common/filepos.c @@ -60,7 +60,7 @@ int CompareFilePos (const FilePos* P1, const FilePos* P2) ** compare rates file index over line over column. */ { - if (P1->Name > P2->Name) { + if (P1->Name > P2->Name) { return 1; } else if (P1->Name < P2->Name) { return -1; diff --git a/src/common/searchpath.c b/src/common/searchpath.c index ca7017e6f..70237a1c9 100644 --- a/src/common/searchpath.c +++ b/src/common/searchpath.c @@ -210,9 +210,9 @@ int PushSearchPath (SearchPaths* P, const char* NewPath) ** that it's not already there. If the path is already at the first position, ** return zero, otherwise return a non zero value. */ -{ +{ /* Generate a clean copy of NewPath */ - char* Path = CleanupPath (NewPath); + char* Path = CleanupPath (NewPath); /* If we have paths, check if Path is already at position zero */ if (CollCount (P) > 0 && strcmp (CollConstAt (P, 0), Path) == 0) { diff --git a/src/common/strstack.c b/src/common/strstack.c index 29dd10426..6b9fb0f8b 100644 --- a/src/common/strstack.c +++ b/src/common/strstack.c @@ -32,12 +32,12 @@ /*****************************************************************************/ - + /* common */ #include "check.h" #include "strstack.h" #include "xmalloc.h" - + /*****************************************************************************/ diff --git a/src/common/strutil.c b/src/common/strutil.c index dabed34cd..60284e860 100644 --- a/src/common/strutil.c +++ b/src/common/strutil.c @@ -66,7 +66,7 @@ char* StrCopy (char* Dest, size_t DestSize, const char* Source) int StrCaseCmp (const char* S1, const char* S2) -/* Compare two strings ignoring case */ +/* Compare two strings ignoring case */ { int Diff; while ((Diff = toupper (*S1) - toupper (*S2)) == 0 && *S1) { @@ -77,4 +77,4 @@ int StrCaseCmp (const char* S1, const char* S2) } - + diff --git a/src/common/va_copy.h b/src/common/va_copy.h index 4aa2428db..413d96bdd 100644 --- a/src/common/va_copy.h +++ b/src/common/va_copy.h @@ -41,7 +41,7 @@ #include - + /* No action if we have a working va_copy */ #if !defined(va_copy) diff --git a/src/common/xsprintf.c b/src/common/xsprintf.c index 5994bb604..a3fbc676b 100644 --- a/src/common/xsprintf.c +++ b/src/common/xsprintf.c @@ -580,7 +580,7 @@ int xvsnprintf (char* Buf, size_t Size, const char* Format, va_list ap) CHECK (S != 0); /* Handle the length by using a precision */ if ((P.Flags & fPrec) != 0) { - /* Precision already specified, use length of string + /* Precision already specified, use length of string ** if less. */ if ((unsigned) P.Prec > SB_GetLen (S)) { diff --git a/src/common/xsprintf.h b/src/common/xsprintf.h index a37b71914..4d32a7410 100644 --- a/src/common/xsprintf.h +++ b/src/common/xsprintf.h @@ -33,9 +33,9 @@ -/* We need a way to output a StrBuf, but on the other side, we don't want to -** switch off gcc's printf format string checking. So we cheat as follows: -** %m (which is a gcc extension and doesn't take an argument) switches %p +/* We need a way to output a StrBuf, but on the other side, we don't want to +** switch off gcc's printf format string checking. So we cheat as follows: +** %m (which is a gcc extension and doesn't take an argument) switches %p ** between outputting a pointer and a string buf. This works just one time, ** so each StrBuf needs in fact a %m%p spec. There's no way to apply a width ** and precision to such a StrBuf, but *not* using %p would bring up a warning diff --git a/src/da65/comments.c b/src/da65/comments.c index cf0b9d4e9..7c671131f 100644 --- a/src/da65/comments.c +++ b/src/da65/comments.c @@ -36,7 +36,7 @@ /* common */ #include "xmalloc.h" -/* da65 */ +/* da65 */ #include "attrtab.h" #include "comments.h" #include "error.h" diff --git a/src/da65/opc6502dtv.h b/src/da65/opc6502dtv.h index e63e4e44c..33b485029 100644 --- a/src/da65/opc6502dtv.h +++ b/src/da65/opc6502dtv.h @@ -58,4 +58,4 @@ extern const OpcDesc OpcTable_6502DTV[256]; - + diff --git a/src/da65/opc6502x.h b/src/da65/opc6502x.h index e086f87ae..23cd9068c 100644 --- a/src/da65/opc6502x.h +++ b/src/da65/opc6502x.h @@ -58,4 +58,4 @@ extern const OpcDesc OpcTable_6502X[256]; - + diff --git a/src/da65/opctable.h b/src/da65/opctable.h index 69a64db9c..7c871f7b0 100644 --- a/src/da65/opctable.h +++ b/src/da65/opctable.h @@ -38,7 +38,7 @@ -/* common */ +/* common */ #include "cpu.h" /* da65 */ diff --git a/src/dbginfo/dbginfo.h b/src/dbginfo/dbginfo.h index 7317e575f..38d891e7c 100644 --- a/src/dbginfo/dbginfo.h +++ b/src/dbginfo/dbginfo.h @@ -135,7 +135,7 @@ struct cc65_csymdata { unsigned char csym_kind; /* Kind of c symbol */ unsigned char csym_sc; /* Storage class of c symbol */ int csym_offs; /* Offset for auto and register */ - unsigned type_id; /* Id of the data type */ + unsigned type_id; /* Id of the data type */ unsigned symbol_id; /* Attached asm symbol if any */ unsigned scope_id; /* Scope of c symbol */ const char* csym_name; /* Name of the symbol */ diff --git a/src/ld65/condes.c b/src/ld65/condes.c index d8c378211..734b64ebd 100644 --- a/src/ld65/condes.c +++ b/src/ld65/condes.c @@ -281,7 +281,7 @@ const ConDesImport* ConDesGetImport (unsigned Type) /* Check the parameters */ PRECONDITION (Type <= CD_TYPE_MAX); - /* Return the import */ + /* Return the import */ Import = &ConDes[Type].Import; return (Import->Name != INVALID_STRING_ID)? Import : 0; } diff --git a/src/ld65/fragment.h b/src/ld65/fragment.h index 7d6dd9201..34eb5b695 100644 --- a/src/ld65/fragment.h +++ b/src/ld65/fragment.h @@ -100,7 +100,7 @@ INLINE const char* GetFragmentSourceName (const Fragment* F) #if defined(HAVE_INLINE) INLINE unsigned GetFragmentSourceLine (const Fragment* F) /* Return the source file line for this fragment */ -{ +{ return GetSourceLineFromList (&F->LineInfos); } #else diff --git a/src/ld65/mapfile.c b/src/ld65/mapfile.c index 7fec986ff..10d65960e 100644 --- a/src/ld65/mapfile.c +++ b/src/ld65/mapfile.c @@ -93,7 +93,7 @@ void CreateMapFile (int ShortMap) ** requested */ if (VerboseMap || S->Size > 0) { - fprintf (F, + fprintf (F, " %-17s Offs=%06lX Size=%06lX " "Align=%05lX Fill=%04lX\n", GetString (S->Seg->Name), S->Offs, S->Size, diff --git a/src/od65/dump.c b/src/od65/dump.c index 2f538fe1d..1a8c4dbb1 100644 --- a/src/od65/dump.c +++ b/src/od65/dump.c @@ -933,7 +933,7 @@ void DumpObjSegSize (FILE* F, unsigned long Offset) unsigned Len = strlen (Name); /* Skip segment flags, read size */ - (void) ReadVar (F); + (void) ReadVar (F); Size = ReadVar (F); /* Skip alignment, type and fragment count */ diff --git a/src/od65/fileio.c b/src/od65/fileio.c index a8d31c730..1689c4734 100644 --- a/src/od65/fileio.c +++ b/src/od65/fileio.c @@ -53,7 +53,7 @@ void FileSetPos (FILE* F, unsigned long Pos) /* Seek to the given absolute position, fail on errors */ -{ +{ if (fseek (F, Pos, SEEK_SET) != 0) { Error ("Cannot seek: %s", strerror (errno)); } diff --git a/src/sim65/6502.c b/src/sim65/6502.c index b3c06293a..6c23b0dfc 100644 --- a/src/sim65/6502.c +++ b/src/sim65/6502.c @@ -1270,8 +1270,8 @@ static void OPC_6502_6C (void) Cycles = 6; Regs.PC = MemReadWord(Lo); } - - ParaVirtHooks (&Regs); + + ParaVirtHooks (&Regs); } @@ -1283,7 +1283,7 @@ static void OPC_65C02_6C (void) Cycles = 5; Regs.PC = MemReadWord (MemReadWord (Regs.PC+1)); - ParaVirtHooks (&Regs); + ParaVirtHooks (&Regs); } @@ -1439,7 +1439,7 @@ static void OPC_65SC02_7C (void) Adr = MemReadWord (PC+1); Regs.PC = MemReadWord(Adr+Regs.XR); - ParaVirtHooks (&Regs); + ParaVirtHooks (&Regs); } diff --git a/src/sp65/bin.c b/src/sp65/bin.c index a3f856340..93e6a456a 100644 --- a/src/sp65/bin.c +++ b/src/sp65/bin.c @@ -53,7 +53,7 @@ -void WriteBinFile (const StrBuf* Data, const Collection* A, +void WriteBinFile (const StrBuf* Data, const Collection* A, const Bitmap* B attribute ((unused))) /* Write the contents of Data to the given file in binary format */ { diff --git a/src/sp65/color.h b/src/sp65/color.h index 31688bff4..6d898ab2e 100644 --- a/src/sp65/color.h +++ b/src/sp65/color.h @@ -60,7 +60,7 @@ struct Color { /*****************************************************************************/ - + #if defined(HAVE_INLINE) INLINE Color RGB (unsigned char R, unsigned char G, unsigned char B) diff --git a/src/sp65/geosbitmap.h b/src/sp65/geosbitmap.h index 759030224..8f9f09a29 100644 --- a/src/sp65/geosbitmap.h +++ b/src/sp65/geosbitmap.h @@ -54,8 +54,8 @@ StrBuf* GenGeosBitmap (const Bitmap* B, const Collection* A); -/* Generate binary output in GEOS compacted bitmap format for the bitmap B. -** The output is stored in a string buffer (which is actually a dynamic char +/* Generate binary output in GEOS compacted bitmap format for the bitmap B. +** The output is stored in a string buffer (which is actually a dynamic char ** array) and returned. */ @@ -67,4 +67,4 @@ StrBuf* GenGeosBitmap (const Bitmap* B, const Collection* A); - + diff --git a/src/sp65/koala.c b/src/sp65/koala.c index e2122c781..688e37f61 100644 --- a/src/sp65/koala.c +++ b/src/sp65/koala.c @@ -94,7 +94,7 @@ StrBuf* GenKoala (const Bitmap* B, const Collection* A attribute ((unused))) /* Add $4400 as load address */ SB_AppendChar (D, 0x00); SB_AppendChar (D, 0x44); - + /* TODO: The actual work ;-) */ (void) Screen; diff --git a/src/sp65/lynxsprite.h b/src/sp65/lynxsprite.h index 4f9a9f07d..fe686ec8e 100644 --- a/src/sp65/lynxsprite.h +++ b/src/sp65/lynxsprite.h @@ -54,7 +54,7 @@ StrBuf* GenLynxSprite (const Bitmap* B, const Collection* A); -/* Generate binary output in packed Lynx sprite format for the bitmap B. The output +/* Generate binary output in packed Lynx sprite format for the bitmap B. The output ** is stored in a string buffer (which is actually a dynamic char array) and ** returned. */ diff --git a/src/sp65/vic2sprite.c b/src/sp65/vic2sprite.c index 94a9ad499..4ea71b562 100644 --- a/src/sp65/vic2sprite.c +++ b/src/sp65/vic2sprite.c @@ -83,7 +83,7 @@ static enum Mode GetMode (const Collection* A) } else { Error ("Invalid value for attribute 'mode'"); } - } + } return smAuto; } diff --git a/src/sp65/vic2sprite.h b/src/sp65/vic2sprite.h index b6c839c7c..ce2f078e4 100644 --- a/src/sp65/vic2sprite.h +++ b/src/sp65/vic2sprite.h @@ -54,7 +54,7 @@ StrBuf* GenVic2Sprite (const Bitmap* B, const Collection* A); -/* Generate binary output in VICII sprite format for the bitmap B. The output +/* Generate binary output in VICII sprite format for the bitmap B. The output ** is stored in a string buffer (which is actually a dynamic char array) and ** returned. */ From 1be54d13bc0602c7bb3a466fa44fb9640cec762e Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 17 Apr 2022 16:07:20 +0200 Subject: [PATCH 24/33] remove dangling spaces --- targettest/cpeek-test.c | 4 ++-- targettest/gamate/audiotest.s | 2 +- targettest/minimal.c | 2 +- targettest/uname-test.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/targettest/cpeek-test.c b/targettest/cpeek-test.c index 1777bce4a..4c1aadcb2 100644 --- a/targettest/cpeek-test.c +++ b/targettest/cpeek-test.c @@ -294,8 +294,8 @@ int main (void) revers(0); cputc('x'); chBack (); c1 = cpeekrevers(); chForth(); revers(1); cputc('X'); chBack (); c2 = cpeekrevers(); chForth(); cputc('\n'); cputc('\r'); - revers(c1); cputc('o'); - revers(c2); cputc('O'); + revers(c1); cputc('o'); + revers(c2); cputc('O'); /* test cpeeks() */ revers(0); diff --git a/targettest/gamate/audiotest.s b/targettest/gamate/audiotest.s index f40199994..4f1496789 100644 --- a/targettest/gamate/audiotest.s +++ b/targettest/gamate/audiotest.s @@ -155,7 +155,7 @@ nocursor: .proc printy ldy #0 -loop1: +loop1: tya pha asl diff --git a/targettest/minimal.c b/targettest/minimal.c index 65ec37a97..f950a5d13 100644 --- a/targettest/minimal.c +++ b/targettest/minimal.c @@ -1,4 +1,4 @@ - + /* this is a minimal / empty c program, any supported target that has some * sort of C support should be able to link this. Failure indicates a problem * with the crt0 or the linker config of the respective target */ diff --git a/targettest/uname-test.c b/targettest/uname-test.c index b0733d0bd..2851da19c 100644 --- a/targettest/uname-test.c +++ b/targettest/uname-test.c @@ -4,7 +4,7 @@ int main (void) -{ +{ /* Get the uname data */ struct utsname buf; if (uname (&buf) != 0) { @@ -12,7 +12,7 @@ int main (void) return EXIT_FAILURE; } - /* Print it */ + /* Print it */ printf ("sysname: \"%s\"\n", buf.sysname); printf ("nodename: \"%s\"\n", buf.nodename); printf ("release: \"%s\"\n", buf.release); From 0129622383d2d8226ad0ad2e25b412f0fc2d7c21 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 17 Apr 2022 16:07:52 +0200 Subject: [PATCH 25/33] remove dangling spaces --- test/err/bug1098.c | 2 +- test/err/bug1098a.c | 2 +- test/err/bug1098b.c | 2 +- test/err/pr1110.c | 4 +- test/misc/bug1265.c | 4 +- test/misc/sitest.c | 10 +- test/ref/array.c | 2 +- test/ref/cc65070303.c | 2 +- test/ref/cc65080227.c | 2 +- test/ref/cc65080328.c | 2 +- test/ref/cc65090111.c | 2 +- test/ref/cc65090124.c | 6 +- test/ref/cc65090726.c | 4 +- test/ref/cc65101209.c | 2 +- test/ref/cf.c | 2 +- test/ref/strptr.c | 18 ++-- test/ref/struct.c | 2 +- test/ref/switch2.c | 6 +- test/ref/yacc.c | 174 +++++++++++++++++----------------- test/ref/yacc2.c | 22 ++--- test/val/bug1075.c | 2 +- test/val/bug1178.c | 4 +- test/val/bug1181.c | 4 +- test/val/bug1438.c | 2 +- test/val/bug1552.c | 2 +- test/val/call1.c | 4 +- test/val/compare10.c | 10 +- test/val/compare5.c | 4 +- test/val/compare6.c | 6 +- test/val/compare7.c | 8 +- test/val/compare8.c | 12 +-- test/val/compare9.c | 10 +- test/val/constexpr.c | 2 +- test/val/cq22.c | 2 +- test/val/cq241.c | 2 +- test/val/cq243.c | 2 +- test/val/cq244.c | 2 +- test/val/cq25.c | 2 +- test/val/cq26.c | 2 +- test/val/cq4.c | 2 +- test/val/cq61.c | 2 +- test/val/cq626.c | 2 +- test/val/cq71.c | 2 +- test/val/cq714.c | 2 +- test/val/cq714b.c | 2 +- test/val/cq715.c | 2 +- test/val/cq72.c | 2 +- test/val/cq7813.c | 2 +- test/val/cq81.c | 2 +- test/val/cq84.c | 2 +- test/val/cq85.c | 2 +- test/val/cq86.c | 2 +- test/val/cq88.c | 2 +- test/val/duffs-device.c | 10 +- test/val/lib_common_ctype.c | 8 +- test/val/lib_common_memmove.c | 4 +- test/val/lib_common_mulxx.c | 2 +- test/val/lib_common_strcat.c | 8 +- test/val/lib_common_strchr.c | 2 +- test/val/lib_common_strcspn.c | 2 +- test/val/lib_common_strncat.c | 8 +- test/val/lib_common_strrchr.c | 2 +- test/val/lib_common_strspn.c | 2 +- test/val/mult1.c | 32 +++---- test/val/or1.c | 22 ++--- test/val/postdec-16-16.c | 26 ++--- test/val/postdec-16-8.c | 26 ++--- test/val/postdec-8-16.c | 26 ++--- test/val/postdec-8-8.c | 26 ++--- test/val/postinc-16-16.c | 26 ++--- test/val/postinc-16-8.c | 26 ++--- test/val/postinc-8-16.c | 26 ++--- test/val/postinc-8-8.c | 26 ++--- test/val/pptest4.c | 2 +- test/val/pptest5.c | 2 +- test/val/pr1423.c | 2 +- test/val/predec-16-16.c | 26 ++--- test/val/predec-16-8.c | 26 ++--- test/val/predec-8-16.c | 26 ++--- test/val/predec-8-8.c | 26 ++--- test/val/preinc-16-16.c | 26 ++--- test/val/preinc-16-8.c | 26 ++--- test/val/preinc-8-16.c | 26 ++--- test/val/preinc-8-8.c | 26 ++--- test/val/static-fwd-decl.c | 2 +- test/val/strnicmp-test.c | 4 +- test/val/switch2.c | 2 +- test/val/time-test.c | 2 +- test/val/xor.c | 4 +- 89 files changed, 459 insertions(+), 459 deletions(-) diff --git a/test/err/bug1098.c b/test/err/bug1098.c index c49296245..eddbce3f1 100644 --- a/test/err/bug1098.c +++ b/test/err/bug1098.c @@ -1,7 +1,7 @@ /* bug #1098 Empty enumerator-list */ -/* The C Standard requires that something exists between the braces for +/* The C Standard requires that something exists between the braces for * enum, struct, and union. */ enum { diff --git a/test/err/bug1098a.c b/test/err/bug1098a.c index 63c1c8da0..aed750267 100644 --- a/test/err/bug1098a.c +++ b/test/err/bug1098a.c @@ -1,7 +1,7 @@ /* bug #1098 Empty enumerator-list */ -/* The C Standard requires that something exists between the braces for +/* The C Standard requires that something exists between the braces for * enum, struct, and union. */ struct { diff --git a/test/err/bug1098b.c b/test/err/bug1098b.c index ebd3e94c8..5f6d8b0f2 100644 --- a/test/err/bug1098b.c +++ b/test/err/bug1098b.c @@ -1,7 +1,7 @@ /* bug #1098 Empty enumerator-list */ -/* The C Standard requires that something exists between the braces for +/* The C Standard requires that something exists between the braces for * enum, struct, and union. */ union { diff --git a/test/err/pr1110.c b/test/err/pr1110.c index 86955c720..671abf9a4 100644 --- a/test/err/pr1110.c +++ b/test/err/pr1110.c @@ -1,5 +1,5 @@ -/* pr #1110 - not only should the current test case for #975 compile and work, +/* pr #1110 - not only should the current test case for #975 compile and work, * but also the code piece below fail to compile and generate errors like commented: */ static const unsigned char array[3]; /* OK */ @@ -7,7 +7,7 @@ static const unsigned char array[] = { 0, 1, 2 }; /* OK - complete definition* static const unsigned char array[3]; /* OK */ static const unsigned char array[]; /* OK */ static const unsigned char array[] = { 1, 2, 3 }; /* Error - redefinition */ -static const unsigned char array[4]; /* Error - conflicting size */ +static const unsigned char array[4]; /* Error - conflicting size */ int main(void) { diff --git a/test/misc/bug1265.c b/test/misc/bug1265.c index 36d1459a7..7c34a25b7 100644 --- a/test/misc/bug1265.c +++ b/test/misc/bug1265.c @@ -17,7 +17,7 @@ int main (void) { x = 1234; n = f1 (x); sprintf (str2, "%p\n", &x); - + if (strcmp(str1, str2)) { puts("not equal"); failures++; @@ -31,7 +31,7 @@ int main (void) { x = 2345; n = f2 (x); sprintf (str2, "%p\n", &x); - + if (strcmp(str1, str2)) { puts("not equal"); failures++; diff --git a/test/misc/sitest.c b/test/misc/sitest.c index 2f1d7df4d..6c8a6f1e2 100644 --- a/test/misc/sitest.c +++ b/test/misc/sitest.c @@ -106,7 +106,7 @@ int main() { int status = 0; /* exit status to be returned */ - + /* features: */ printf("CHAR_BIT=%u\n", (unsigned)CHAR_BIT ); @@ -526,12 +526,12 @@ main() { else /* for trailing semicolon */ #else - + #define SCAN(buf,fs,var,exp) #define PRINT(fs,var,exp) #endif - + #ifdef SCNo32 SCAN(in_dn, SCNo32, int32, 9); @@ -586,7 +586,7 @@ main() { #endif #if 0 - + #ifdef INT16_MAX { INT16_MAX, INT16_MAX, }, { -INT16_MAX, INT16_MAX, }, @@ -830,7 +830,7 @@ main() { } #endif } - + { char *endptr; wchar_t *wendptr; diff --git a/test/ref/array.c b/test/ref/array.c index 96bf22c3a..19265ef90 100644 --- a/test/ref/array.c +++ b/test/ref/array.c @@ -29,7 +29,7 @@ main() { p[j] = x[i][j]; } g(z, y); - + return 0; } diff --git a/test/ref/cc65070303.c b/test/ref/cc65070303.c index 049f14c40..6cf2e9dc7 100644 --- a/test/ref/cc65070303.c +++ b/test/ref/cc65070303.c @@ -27,7 +27,7 @@ int main(int argc, char* argv[]) test.c(20): Error: Incompatible pointer types for   APtr=&(Bs[7].Data[1]); -My experience in C is very limited, but as this works both in MSVC and +My experience in C is very limited, but as this works both in MSVC and the 8 bit Z80 compiler i originally used, i guess its an bug in CC65. As a workaround, an typecast via  APtr=(TypA*)&(Bs[7].Data[1]); diff --git a/test/ref/cc65080227.c b/test/ref/cc65080227.c index b6d068b2a..86d5ee331 100644 --- a/test/ref/cc65080227.c +++ b/test/ref/cc65080227.c @@ -1,5 +1,5 @@ /* - !!DESCRIPTION!! + !!DESCRIPTION!! !!ORIGIN!! testsuite !!LICENCE!! Public Domain !!AUTHOR!! diff --git a/test/ref/cc65080328.c b/test/ref/cc65080328.c index 630638f3d..7e26ea20a 100644 --- a/test/ref/cc65080328.c +++ b/test/ref/cc65080328.c @@ -1,5 +1,5 @@ /* - !!DESCRIPTION!! + !!DESCRIPTION!! !!ORIGIN!! testsuite !!LICENCE!! Public Domain !!AUTHOR!! diff --git a/test/ref/cc65090111.c b/test/ref/cc65090111.c index be889a608..30b2b3cd0 100644 --- a/test/ref/cc65090111.c +++ b/test/ref/cc65090111.c @@ -1,5 +1,5 @@ /* - !!DESCRIPTION!! + !!DESCRIPTION!! !!ORIGIN!! testsuite !!LICENCE!! Public Domain !!AUTHOR!! diff --git a/test/ref/cc65090124.c b/test/ref/cc65090124.c index 3a75b28fa..910dc1195 100644 --- a/test/ref/cc65090124.c +++ b/test/ref/cc65090124.c @@ -1,5 +1,5 @@ /* - !!DESCRIPTION!! + !!DESCRIPTION!! !!ORIGIN!! testsuite !!LICENCE!! Public Domain !!AUTHOR!! @@ -8,7 +8,7 @@ #include /* -there is a bug in the preprocessor (i think) ... the following works +there is a bug in the preprocessor (i think) ... the following works (compiles) correctly: unsigned long fs,fd,a; @@ -32,7 +32,7 @@ int main(void) fs=(func((fd/a),(func(2,0x0082c90f)))); } -i get "Error: ')' expected" on that line. (this is with the snapshot, freshly +i get "Error: ')' expected" on that line. (this is with the snapshot, freshly compiled 5 minutes ago) */ diff --git a/test/ref/cc65090726.c b/test/ref/cc65090726.c index 609594dc4..f22b9c203 100644 --- a/test/ref/cc65090726.c +++ b/test/ref/cc65090726.c @@ -1,5 +1,5 @@ /* - !!DESCRIPTION!! + !!DESCRIPTION!! !!ORIGIN!! testsuite !!LICENCE!! Public Domain !!AUTHOR!! @@ -36,7 +36,7 @@ void Proc1(RecordPtr PtrParIn) Proc3((*(PtrParIn->PtrComp)).PtrComp); Proc3(NextRecord.PtrComp); #endif - + #undef NextRecord } diff --git a/test/ref/cc65101209.c b/test/ref/cc65101209.c index daeab8509..eba209d1d 100644 --- a/test/ref/cc65101209.c +++ b/test/ref/cc65101209.c @@ -34,5 +34,5 @@ So testing with 999 gives: 231 mod 999 is 0 999 mod 999 is 0 -This seems to be systematic. +This seems to be systematic. */ diff --git a/test/ref/cf.c b/test/ref/cf.c index bb0c13e8b..6001009ce 100644 --- a/test/ref/cf.c +++ b/test/ref/cf.c @@ -67,7 +67,7 @@ char *argv[]; } printf("input:\n\n"); - + nc = 0; while ((c = GETCHAR()) != -1) { diff --git a/test/ref/strptr.c b/test/ref/strptr.c index 152c1bb48..d596e19d1 100644 --- a/test/ref/strptr.c +++ b/test/ref/strptr.c @@ -1,5 +1,5 @@ /* - !!DESCRIPTION!! + !!DESCRIPTION!! !!ORIGIN!! testsuite !!LICENCE!! Public Domain !!AUTHOR!! Groepaz/Hitmen @@ -24,7 +24,7 @@ FILE *outfile=NULL; #else #endif - + #include #include #include @@ -65,17 +65,17 @@ static unsigned char ch; /* basic line-link / file-length */ memcpy(buffer,b1,4); - - dir->off=dir->off+4; + + dir->off=dir->off+4; entry.d_reclen=254*(buffer[2]+(buffer[3]<<8)); /* read file entry */ memcpy(buffer,b2,0x10); - - dir->off=dir->off+i; + + dir->off=dir->off+i; printf("Xreaddir: '%s'\n",buffer); - + /* skip until either quote (file) or b (blocks free => end) */ i=0;ii=0; while(i==0){ @@ -113,9 +113,9 @@ int main(void) char mydirname[XNAME_MAX+1]="."; XDIR mydir; struct Xdirent *mydirent; - + printf("start\n"); - + if((mydirent=Xreaddir(&mydir))==NULL) { printf("NULL\n"); diff --git a/test/ref/struct.c b/test/ref/struct.c index 15fae62fc..e5957f265 100644 --- a/test/ref/struct.c +++ b/test/ref/struct.c @@ -246,7 +246,7 @@ rect screen = ); test1(); - + for (i = 0; i < sizeof pts/sizeof pts[0]; i++) { printf("(%d,%d) is ", pts[i].x, (x = makepoint(pts[i].x, pts[i].y)).y); diff --git a/test/ref/switch2.c b/test/ref/switch2.c index 78d383b52..0e52775e4 100644 --- a/test/ref/switch2.c +++ b/test/ref/switch2.c @@ -169,7 +169,7 @@ void testdefault2(unsigned char i) { case 170: break; - + case 18: break; case 19: @@ -215,12 +215,12 @@ int main(void) { testlimits(32767); testlimits(-32768); testlimits(-1); - + testdefault1(1); testdefault1(2); testdefault1(3); testdefault1(4); - + testdefault2(1); testdefault2(2); testdefault2(3); diff --git a/test/ref/yacc.c b/test/ref/yacc.c index 776e4f93d..3831b67fd 100644 --- a/test/ref/yacc.c +++ b/test/ref/yacc.c @@ -70,7 +70,7 @@ int yytchar; #define yyout outfile extern int yylineno; -struct yysvf +struct yysvf { struct yywork *yystoff; struct yysvf *yyother; @@ -150,7 +150,7 @@ yyfussy: } } - + #ifdef YYDEBUG fprintf(yyout,"yylex: return 0\n"); #endif @@ -164,9 +164,9 @@ int yyvstop[] = }; # define YYTYPE char -struct yywork -{ - YYTYPE verify, advance; +struct yywork +{ + YYTYPE verify, advance; } yycrank[] = { {0,0}, {0,0}, {1,3}, {0,0}, @@ -178,12 +178,12 @@ struct yywork {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, - + {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, - + {0,0}, {1,5}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, @@ -193,17 +193,17 @@ struct yywork {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {0,0}, {0,0}, {0,0}, - + {0,0}, {0,0}, {0,0}, {0,0}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, - + {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {0,0}, {0,0}, - + {0,0}, {0,0}, {6,8}, {0,0}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, @@ -240,7 +240,7 @@ struct yywork }; /* -struct yysvf +struct yysvf { struct yywork *yystoff; struct yysvf *yyother; @@ -281,27 +281,27 @@ char yymatch[] = #endif 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , - + 011 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , - + '0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' , '0' ,'0' ,01 ,01 ,01 ,01 ,01 ,01 , - + /* 0x40 (ascii) @A... (petscii) @a... */ 01 ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , - + 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , 'A' ,'A' ,'A' ,01 ,01 ,01 ,01 ,'A' , - + /* 0x60 (ascii) @a... */ 01 ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , - + 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , 'A' ,'A' ,'A' ,01 ,01 ,01 ,01 ,01 , - + #ifdef CHARSETHACK /* 0x80 */ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, @@ -312,10 +312,10 @@ char yymatch[] = /* 0xc0 (petcii) @A... */ 01 ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , - + 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , 'A' ,'A' ,'A' ,01 ,01 ,01 ,01 ,01 , - + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, @@ -354,9 +354,9 @@ yylook() int debug; # endif */ - + char *yylastch; - + /* start off machines */ /* @@ -372,11 +372,11 @@ yylook() # else #define debug 0 #endif - + #ifdef YYDEBUG fprintf(yyout,"yylook()\n"); # endif - + if (!yymorfg) yylastch = yytext; else @@ -388,7 +388,7 @@ yylook() #ifdef YYDEBUG fprintf(yyout,"yylook: yymorfg=%d\n",yymorfg); # endif - + for(;;) { #ifdef YYDEBUG @@ -400,7 +400,7 @@ yylook() if (yyprevious==YYNEWLINE) yystate++; testbreak=0; - + for (;;) { # ifdef LEXDEBUG @@ -412,12 +412,12 @@ yylook() exit(EXIT_FAILURE); } testbreak++; - + yyt = yystate->yystoff; /* fprintf(yyout,"yylook: yyt offs: %02x\n",yyt-yycrank); */ - + if(yyt == yycrank) { /* may not be any transitions */ yyz = yystate->yyother; @@ -430,7 +430,7 @@ yylook() fprintf(yyout,"yylook: input "); printchar("yych",yych); # endif - + tryagain: # ifdef LEXDEBUG @@ -440,7 +440,7 @@ yylook() yyr = yyt; /* fprintf(yyout,"yylook: yyr offs: %02x\n",yyr-yycrank); */ - + if ( yyt > yycrank) { yyt = yyr + yych; @@ -467,7 +467,7 @@ yylook() } # ifdef YYOPTIM else if(yyt < yycrank) /* r < yycrank */ - { + { yyt = yyr = yycrank+(yycrank-yyt); # ifdef LEXDEBUG fprintf(yyout,"yylook: compressed state\n"); @@ -492,7 +492,7 @@ yylook() fprintf(yyout,"yylook: continue (2)\n"); # endif goto contin; - + } # ifdef LEXDEBUG /* @@ -509,12 +509,12 @@ yylook() */ fprintf(yyout,"yylook: try fall back character\n"); # endif - if(yyt <= yytop && yyt->verify+yysvec == yystate) + if(yyt <= yytop && yyt->verify+yysvec == yystate) { # ifdef LEXDEBUG fprintf(yyout,"yylook: (2a)\n"); # endif - + if(yyt->advance+yysvec == YYLERR) /* error transition */ { # ifdef LEXDEBUG @@ -531,7 +531,7 @@ yylook() fprintf(yyout,"yylook: continue (3)\n"); # endif goto contin; - + } # ifdef LEXDEBUG fprintf(yyout,"yylook: (2)\n"); @@ -578,7 +578,7 @@ yylook() { yyolsp = lsp; if(yyextra[*yyfnd]) /* must backup */ - { + { while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate) { lsp--; @@ -630,7 +630,7 @@ yylook() # endif } - + yyback(p, m) int *p; { @@ -648,25 +648,25 @@ yyback(p, m) yyinput() { int out=input(); - + #ifdef YYDEBUG fprintf(yyout,"yylook: input "); printchar("out",out); -#endif +#endif return(out); } yyoutput(c) - int c; + int c; { output(c); } yyunput(c) - int c; + int c; { unput(c); } -main() +main() { printf("main start\n"); infile = fopen("yacc.in","rb"); @@ -681,8 +681,8 @@ main() } /* yyerror - issue error message */ -yyerror(s) -char *s; +yyerror(s) +char *s; { printf("[%s]\n", s); } @@ -722,39 +722,39 @@ short yyact[]= 0, 0, 0, 0, 0, 0, 0, 6, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 4, 6 + 0, 0, 0, 0, 0, 0, 0, 4, 6 }; short yypact[]= { -1000, -9,-1000, 5, -7, -59,-1000,-1000,-1000, -40, -29, -40, -40,-1000,-1000, -40, -40, -40, -40, -38, - -35, -38, -38,-1000,-1000,-1000 + -35, -38, -38,-1000,-1000,-1000 }; short yypgo[]= { - 0, 21, 20, 17, 11 + 0, 21, 20, 17, 11 }; short yyr1[]= { 0, 1, 1, 1, 1, 2, 4, 4, 4, 4, - 4, 4, 4, 4, 3 + 4, 4, 4, 4, 3 }; short yyr2[]= { 0, 0, 2, 3, 3, 3, 3, 3, 3, 3, - 2, 3, 1, 1, 1 + 2, 3, 1, 1, 1 }; short yychk[]= { -1000, -1, 10, -2, 256, -3, 257, 10, 10, 61, -4, 45, 40, -3, 258, 43, 45, 42, 47, -4, - -4, -4, -4, -4, -4, 41 + -4, -4, -4, -4, -4, 41 }; short yydef[]= { 1, -2, 2, 0, 0, 0, 14, 3, 4, 0, 5, 0, 0, 12, 13, 0, 0, 0, 0, 10, - 0, 6, 7, 8, 9, 11 + 0, 6, 7, 8, 9, 11 }; # define YYFLAG -1000 @@ -774,7 +774,7 @@ int yychar = -1; /* current input token number */ int yynerrs = 0; /* number of errors */ short yyerrflag = 0; /* error recovery flag */ -yyparse() +yyparse() { short yys[YYMAXDEPTH]; short yyj, yym; @@ -820,23 +820,23 @@ yyparse() #ifdef YYDEBUG printf("yyparse: yynewstate (1)\n"); #endif - + if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0; #ifdef YYDEBUG - + printf("yyparse: yynewstate yyn=%d ",yyn); printchar("yychar",yychar); #endif - + if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault; #ifdef YYDEBUG printf("yyparse: yynewstate (2)\n"); #endif - + if( yychk[ yyn=yyact[ yyn ] ] == yychar ) /* valid shift */ - { + { yychar = -1; yyval = yylval; yystate = yyn; @@ -872,9 +872,9 @@ yyparse() #ifdef YYDEBUG printf("yyparse: yyn=%d yyerrflag=%d\n",yyn,yyerrflag); #endif - + if( yyn == 0 ) /* error */ - { + { /* error ... attempt to resume parsing */ switch( yyerrflag ){ @@ -942,65 +942,65 @@ yyparse() yyn = yyr1[yyn]; yyj = yypgo[yyn] + *yyps + 1; if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]]; - + switch(yym) { case 4: - { - yyerrok; + { + yyerrok; } break; case 5: - { + { printf("[STORE]\n"); - } + } break; case 6: - { + { printf("[ADD]\n"); - } + } break; case 7: - { + { printf("[NEG]\n[ADD]\n"); - } + } break; case 8: - { + { printf("[MUL]\n"); - } + } break; case 9: - { + { printf("[DIV]\n"); - } + } break; case 10: - { - printf("[NEG]\n"); - } + { + printf("[NEG]\n"); + } break; case 12: - { - printf("[LOAD]\n"); - } + { + printf("[LOAD]\n"); + } break; case 13: - { + { printf("[PUSH %s]\n", yytext); - } + } break; case 14: - { + { printf("[%s]\n", yytext); - } + } break; } - + goto yystack; /* stack new state and value */ } - -int yywrap() -{ - return 1; + +int yywrap() +{ + return 1; } diff --git a/test/ref/yacc2.c b/test/ref/yacc2.c index 3b4819c55..33288b25d 100644 --- a/test/ref/yacc2.c +++ b/test/ref/yacc2.c @@ -8,9 +8,9 @@ #include # define YYTYPE char -struct yywork -{ - YYTYPE verify, advance; +struct yywork +{ + YYTYPE verify, advance; } yycrank[] = { {0,0}, {0,0}, {1,3}, {0,0}, @@ -22,12 +22,12 @@ struct yywork {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, - + {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, - + {0,0}, {1,5}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, @@ -37,17 +37,17 @@ struct yywork {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {0,0}, {0,0}, {0,0}, - + {0,0}, {0,0}, {0,0}, {0,0}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, - + {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {0,0}, {0,0}, - + {0,0}, {0,0}, {6,8}, {0,0}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, @@ -90,7 +90,7 @@ int yyvstop[] = 0,4,0,3,4,0,2,4,0,1,4,0,2,0,1,0,0 }; -struct yysvf +struct yysvf { struct yywork *yystoff; struct yysvf *yyother; @@ -157,7 +157,7 @@ void subtest3(void) yyt=yycrank; yystate=yysvec; - + bogus(); if(yyt <= yytop && yyt->verify+yysvec == yystate) { @@ -173,7 +173,7 @@ void subtest3(void) short yyr2[]= { 0, 0, 2, 3, 3, 3, 3, 3, 3, 3, - 2, 3, 1, 1, 1 + 2, 3, 1, 1, 1 }; // yyps -= yyr2[yyn]; diff --git a/test/val/bug1075.c b/test/val/bug1075.c index 6ff5ec8e7..3e259fd22 100644 --- a/test/val/bug1075.c +++ b/test/val/bug1075.c @@ -8,7 +8,7 @@ long rhs; int test(void) { - /* the whole lhs is errorneously treated as an absolute address (integer + /* the whole lhs is errorneously treated as an absolute address (integer constant) neglecting its dereference */ return *(char *)0xD77C + rhs; } diff --git a/test/val/bug1178.c b/test/val/bug1178.c index 043767e4c..7fb7e7803 100644 --- a/test/val/bug1178.c +++ b/test/val/bug1178.c @@ -41,7 +41,7 @@ void dotest1(void) StructArray1[0] = test1; - printf ("test1: %d, %d, %d, %d, %d\n", + printf ("test1: %d, %d, %d, %d, %d\n", (int)StructArray1[0].a, (int)StructArray1[0].b, (int)StructArray1[0].c, (int)StructArray1[0].d, (int)StructArray1[0].e); if ((StructArray1[0].a != 42) || @@ -62,7 +62,7 @@ void dotest2(void) StructArray2[0] = test2; - printf ("test2: %d, %d, %d, %d, %d\n", + printf ("test2: %d, %d, %d, %d, %d\n", (int)StructArray2[0].a, (int)StructArray2[0].b, (int)StructArray2[0].c, (int)StructArray2[0].d); if ((StructArray2[0].a != 42) || diff --git a/test/val/bug1181.c b/test/val/bug1181.c index 4ea2d54bf..077707d94 100644 --- a/test/val/bug1181.c +++ b/test/val/bug1181.c @@ -1,5 +1,5 @@ -/* bug #1181 - Testing struct member against NULL is broken */ +/* bug #1181 - Testing struct member against NULL is broken */ #include #include @@ -52,7 +52,7 @@ MENUITEM optionsitems_menu[] = { static MENU optionsmenu_menu = { &optionsitems_menu[0], -}; +}; unsigned char __fastcall__ menu_getnumitems(MENU *menu) { diff --git a/test/val/bug1438.c b/test/val/bug1438.c index 3894f87f1..9c8f7a8ce 100644 --- a/test/val/bug1438.c +++ b/test/val/bug1438.c @@ -1,5 +1,5 @@ -/* Issue #1438 fix #1439 - crash in cc65, related to delayed post-counting +/* Issue #1438 fix #1439 - crash in cc65, related to delayed post-counting this is an odd issue, the compile would crash *sometimes*, perhaps in one of ten compilation runs. diff --git a/test/val/bug1552.c b/test/val/bug1552.c index 42f39eec6..92ad902bd 100644 --- a/test/val/bug1552.c +++ b/test/val/bug1552.c @@ -23,7 +23,7 @@ int execute(TREPTR argt, int execflg, int *pf1, int *pf2) { register TREPTR t; int type; - switch (type) + switch (type) { case 6: { diff --git a/test/val/call1.c b/test/val/call1.c index c7ac920b3..d09ae0dec 100644 --- a/test/val/call1.c +++ b/test/val/call1.c @@ -70,7 +70,7 @@ call5 (unsigned int k) return (k); } -unsigned char +unsigned char call6a(unsigned char uc) { if(uc>uchar1) @@ -85,7 +85,7 @@ call6(unsigned char uc) return(call6a(uc)); } -unsigned int +unsigned int call7a(unsigned int ui) { if(ui) diff --git a/test/val/compare10.c b/test/val/compare10.c index 861a02d64..742213851 100644 --- a/test/val/compare10.c +++ b/test/val/compare10.c @@ -59,7 +59,7 @@ void c_char_gte_lit1(unsigned char expected_result) if(char0 >= 0x7e) result |= 0x10; - + if(char0 >= 0x7f) result |= 0x20; @@ -138,10 +138,10 @@ void c_int_gte_lit1(unsigned char expected_result) if(int0 >= 0x0101) result |= 0x10; - + if(int0 >= 0x01ff) result |= 0x20; - + if(int0 >= 0x0200) result |= 0x40; @@ -226,10 +226,10 @@ void c_int_gte_lit2(unsigned char expected_result) if(int0 >= -0x0101) result |= 0x10; - + if(int0 >= -0x0100) result |= 0x20; - + if(int0 >= -0xff) result |= 0x40; diff --git a/test/val/compare5.c b/test/val/compare5.c index f1d94d537..cf51fac89 100644 --- a/test/val/compare5.c +++ b/test/val/compare5.c @@ -284,7 +284,7 @@ void c_ifelse1(void) void c_minus1(void) { printf("long0:%ld long1:%ld\n",long0,long1); - + printf("(long0 != -1)\n"); if(long0 != -1) { @@ -432,7 +432,7 @@ main (void) success = failures; done (); - + printf("failures: %d\n",failures); return failures; diff --git a/test/val/compare6.c b/test/val/compare6.c index 85f16a1c4..bad411c0c 100644 --- a/test/val/compare6.c +++ b/test/val/compare6.c @@ -60,7 +60,7 @@ void c_char(void) if(char1 || !char0) failures++; - if((char0 >5 ) && (char0 < 10)) + if((char0 >5 ) && (char0 < 10)) failures++; char0 +=5; /* char0 = 6 now */ @@ -100,7 +100,7 @@ void c_int(void) if(int1 || !int0) failures++; - if((int0 >5 ) && (int0 < 10)) + if((int0 >5 ) && (int0 < 10)) failures++; int0 +=5; /* int0 = 6 now */ @@ -140,7 +140,7 @@ void c_long(void) if(long1 || !long0) failures++; - if((long0 >5 ) && (long0 < 10)) + if((long0 >5 ) && (long0 < 10)) failures++; long0 +=5; /* long0 = 6 now */ diff --git a/test/val/compare7.c b/test/val/compare7.c index 6c9636dec..d88952f62 100644 --- a/test/val/compare7.c +++ b/test/val/compare7.c @@ -129,10 +129,10 @@ void c_int_lt_lit1(unsigned char expected_result) if(int0 < 0x0101) result |= 0x10; - + if(int0 < 0x01ff) result |= 0x20; - + if(int0 < 0x0200) result |= 0x40; @@ -214,10 +214,10 @@ void c_int_lt_lit2(unsigned char expected_result) if(int0 < -0x0101) result |= 0x10; - + if(int0 < -0x0100) result |= 0x20; - + if(int0 < -0xff) result |= 0x40; diff --git a/test/val/compare8.c b/test/val/compare8.c index 0abff8c69..2621dad1d 100644 --- a/test/val/compare8.c +++ b/test/val/compare8.c @@ -59,10 +59,10 @@ void c_char_gt_lit1(unsigned char expected_result) if(char0 > 0x7e) result |= 0x10; - + if(char0 > 0x7f) result |= 0x20; - + if(result != expected_result) failures++; } @@ -132,10 +132,10 @@ void c_int_gt_lit1(unsigned char expected_result) if(int0 > 0x0101) result |= 0x10; - + if(int0 > 0x01ff) result |= 0x20; - + if(int0 > 0x0200) result |= 0x40; @@ -220,10 +220,10 @@ void c_int_gt_lit2(unsigned char expected_result) if(int0 > -0x0101) result |= 0x10; - + if(int0 > -0x0100) result |= 0x20; - + if(int0 > -0xff) result |= 0x40; diff --git a/test/val/compare9.c b/test/val/compare9.c index 4a3714199..a498c15cb 100644 --- a/test/val/compare9.c +++ b/test/val/compare9.c @@ -54,7 +54,7 @@ void c_char_lte_lit1(unsigned char expected_result) if(char0 <= 0x7f) result |= 0x10; - + if(result != expected_result) failures++; } @@ -124,10 +124,10 @@ void c_int_lte_lit1(unsigned char expected_result) if(int0 <= 0x0101) result |= 0x10; - + if(int0 <= 0x01ff) result |= 0x20; - + if(int0 <= 0x0200) result |= 0x40; @@ -209,10 +209,10 @@ void c_int_lte_lit2(unsigned char expected_result) if(int0 <= -0x0101) result |= 0x10; - + if(int0 <= -0x0100) result |= 0x20; - + if(int0 <= -0xff) result |= 0x40; diff --git a/test/val/constexpr.c b/test/val/constexpr.c index 4338717f4..c66946a19 100644 --- a/test/val/constexpr.c +++ b/test/val/constexpr.c @@ -8,7 +8,7 @@ if they are being compiled/evaluated correctly. related: pr #1424 - More compile-time constant expressions regarding object addresses -issue #1196 - Constant expressions in general +issue #1196 - Constant expressions in general */ diff --git a/test/val/cq22.c b/test/val/cq22.c index 015b7bf77..20048fa2c 100644 --- a/test/val/cq22.c +++ b/test/val/cq22.c @@ -125,7 +125,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq241.c b/test/val/cq241.c index 1f66a378c..611b5a376 100644 --- a/test/val/cq241.c +++ b/test/val/cq241.c @@ -267,7 +267,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq243.c b/test/val/cq243.c index aaec9a8ea..8aba7dfe8 100644 --- a/test/val/cq243.c +++ b/test/val/cq243.c @@ -245,7 +245,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq244.c b/test/val/cq244.c index 9f4704f36..896ddb75b 100644 --- a/test/val/cq244.c +++ b/test/val/cq244.c @@ -140,7 +140,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq25.c b/test/val/cq25.c index bfdade957..7cacebf0a 100644 --- a/test/val/cq25.c +++ b/test/val/cq25.c @@ -152,7 +152,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq26.c b/test/val/cq26.c index 239411f1c..1c88dfed6 100644 --- a/test/val/cq26.c +++ b/test/val/cq26.c @@ -197,7 +197,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq4.c b/test/val/cq4.c index a8b6b1d52..205f62c88 100644 --- a/test/val/cq4.c +++ b/test/val/cq4.c @@ -344,7 +344,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq61.c b/test/val/cq61.c index fc4d1d95f..c16b64066 100644 --- a/test/val/cq61.c +++ b/test/val/cq61.c @@ -167,7 +167,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq626.c b/test/val/cq626.c index a8b05c8f2..b7c592d58 100644 --- a/test/val/cq626.c +++ b/test/val/cq626.c @@ -318,7 +318,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq71.c b/test/val/cq71.c index f7167c728..725a40e88 100644 --- a/test/val/cq71.c +++ b/test/val/cq71.c @@ -221,7 +221,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq714.c b/test/val/cq714.c index d7a878033..c36c992aa 100644 --- a/test/val/cq714.c +++ b/test/val/cq714.c @@ -1776,7 +1776,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq714b.c b/test/val/cq714b.c index 9538281b8..19b58628c 100644 --- a/test/val/cq714b.c +++ b/test/val/cq714b.c @@ -997,7 +997,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq715.c b/test/val/cq715.c index 0fe864159..2e7e22d85 100644 --- a/test/val/cq715.c +++ b/test/val/cq715.c @@ -132,7 +132,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq72.c b/test/val/cq72.c index 421177a0b..6b8026576 100644 --- a/test/val/cq72.c +++ b/test/val/cq72.c @@ -326,7 +326,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq7813.c b/test/val/cq7813.c index 9d4308a3e..d6c9b445f 100644 --- a/test/val/cq7813.c +++ b/test/val/cq7813.c @@ -362,7 +362,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq81.c b/test/val/cq81.c index 85e1ac1d6..1e83a2e04 100644 --- a/test/val/cq81.c +++ b/test/val/cq81.c @@ -708,7 +708,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq84.c b/test/val/cq84.c index 64429e300..c1f62913e 100644 --- a/test/val/cq84.c +++ b/test/val/cq84.c @@ -249,7 +249,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq85.c b/test/val/cq85.c index 49423e7de..81a99c960 100644 --- a/test/val/cq85.c +++ b/test/val/cq85.c @@ -294,7 +294,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq86.c b/test/val/cq86.c index 9c850662a..90cfa0b7c 100644 --- a/test/val/cq86.c +++ b/test/val/cq86.c @@ -209,7 +209,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/cq88.c b/test/val/cq88.c index ef742824e..a9af7bef7 100644 --- a/test/val/cq88.c +++ b/test/val/cq88.c @@ -165,7 +165,7 @@ int main(int n,char **args) { int j; static struct defs d0, *pd0; - + d0.flgs = 1; /* These flags dictate */ d0.flgm = 1; /* the verbosity of */ d0.flgd = 1; /* the program. */ diff --git a/test/val/duffs-device.c b/test/val/duffs-device.c index effb33bb2..eb91e244f 100644 --- a/test/val/duffs-device.c +++ b/test/val/duffs-device.c @@ -1,6 +1,6 @@ /* !!DESCRIPTION!! Implementation of Duff's device (loop unrolling). - !!ORIGIN!! + !!ORIGIN!! !!LICENCE!! GPL, read COPYING.GPL */ @@ -34,7 +34,7 @@ int acmp(char* a, char* b, int count) return 0; } -void duffit (char* to, char* from, int count) +void duffit (char* to, char* from, int count) { int n = (count + 7) / 8; @@ -55,14 +55,14 @@ int main(void) { char a[ASIZE] = {1}; char b[ASIZE] = {2}; - + /* a and b should be different */ if(!acmp(a, b, ASIZE)) { failures++; } - + duffit(a, b, ASIZE); - + /* a and b should be the same */ if(acmp(a, b, ASIZE)) { failures++; diff --git a/test/val/lib_common_ctype.c b/test/val/lib_common_ctype.c index 39c92953b..281ee454e 100644 --- a/test/val/lib_common_ctype.c +++ b/test/val/lib_common_ctype.c @@ -16,7 +16,7 @@ #define NUMTESTS 257 -typedef struct +typedef struct { bool isalnum; bool isalpha; @@ -30,7 +30,7 @@ typedef struct bool isspace; bool isupper; bool isxdigit; - bool isblank; + bool isblank; } CTypeClassifications; @@ -89,7 +89,7 @@ CTypeClassifications testSet[NUMTESTS] = {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 2D {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 2E {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 2F - + {true, false, true, false, true, true, false, true, false, false, false, true, false}, // 30 {true, false, true, false, true, true, false, true, false, false, false, true, false}, // 31 {true, false, true, false, true, true, false, true, false, false, false, true, false}, // 32 @@ -123,7 +123,7 @@ CTypeClassifications testSet[NUMTESTS] = {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 4D {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 4E {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 4F - + {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 50 {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 51 {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 52 diff --git a/test/val/lib_common_memmove.c b/test/val/lib_common_memmove.c index 6b2273e78..cf81bc404 100644 --- a/test/val/lib_common_memmove.c +++ b/test/val/lib_common_memmove.c @@ -10,7 +10,7 @@ TEST { unsigned i, v; char* p; - + for (i=0; i < BufferSize; ++i) Buffer[i+1] = (i%128); @@ -35,7 +35,7 @@ TEST ASSERT_AreEqual(i%128, (unsigned)Buffer[i+2], "%u", "Unexpected value in buffer at position %u!" COMMA i+2); } - v = Buffer[BufferSize+1]; // rember value of first untouched end-byte + v = Buffer[BufferSize+1]; // rember value of first untouched end-byte // copy downwards p = memmove(Buffer+1, Buffer+2, BufferSize); diff --git a/test/val/lib_common_mulxx.c b/test/val/lib_common_mulxx.c index cf5f089e9..e5afb3f0e 100644 --- a/test/val/lib_common_mulxx.c +++ b/test/val/lib_common_mulxx.c @@ -4,7 +4,7 @@ TEST { unsigned i; - + for (i=0; i < 256; ++i) { ASSERT_AreEqual(i*20, mul20(i), "%u", "Invalid 'mul20(%u)' calculation!" COMMA i); diff --git a/test/val/lib_common_strcat.c b/test/val/lib_common_strcat.c index 1872053a4..3947c5130 100644 --- a/test/val/lib_common_strcat.c +++ b/test/val/lib_common_strcat.c @@ -11,7 +11,7 @@ TEST { unsigned i,j; char* p; - + for (i=0; i < SourceStringSize; ++i) SourceString[i] = (i%128)+1; @@ -23,13 +23,13 @@ TEST DestinationString[0] = 0; ASSERT_AreEqual(0, strlen(DestinationString), "%u", "Destination string initialization or 'strlen()' problem!"); - + /* Test concatenation to empty buffer */ strcat(DestinationString, SourceString); - + ASSERT_AreEqual(SourceStringSize, strlen(DestinationString), "%u", "Unexpected string length while string concatenation to empty buffer!"); - + /* Test concatenation to non empty buffer */ p = strcat(DestinationString, SourceString); diff --git a/test/val/lib_common_strchr.c b/test/val/lib_common_strchr.c index a48d287e5..6f2db258a 100644 --- a/test/val/lib_common_strchr.c +++ b/test/val/lib_common_strchr.c @@ -1,7 +1,7 @@ #include #include "unittest.h" - + /* Test string. Must NOT have duplicate characters! */ static char S[] = "Helo wrd!\n"; diff --git a/test/val/lib_common_strcspn.c b/test/val/lib_common_strcspn.c index f289ddb95..1adb19671 100644 --- a/test/val/lib_common_strcspn.c +++ b/test/val/lib_common_strcspn.c @@ -11,7 +11,7 @@ static char* TestChars="1234567890"; // we like to find numbe TEST { unsigned i; - + for (i=0; i < EstimatedStringSize; ++i) EstimatedString[i] = (i%26)+'A'; // put ABCD... into the string to be estimated diff --git a/test/val/lib_common_strncat.c b/test/val/lib_common_strncat.c index a6f92ac05..54cf0e3e5 100644 --- a/test/val/lib_common_strncat.c +++ b/test/val/lib_common_strncat.c @@ -11,7 +11,7 @@ TEST { unsigned i; char* p; - + for (i=0; i < SourceStringSize; ++i) SourceString[i] = (i%128)+1; @@ -23,13 +23,13 @@ TEST DestinationString[0] = 0; ASSERT_AreEqual(0, strlen(DestinationString), "%u", "Destination string initialization or 'strlen()' problem!"); - + /* Test "unlimted" concatenation to empty buffer */ strncat(DestinationString, SourceString, 1024); - + ASSERT_AreEqual(SourceStringSize, strlen(DestinationString), "%u", "Unexpected string length while string concatenation to empty buffer!"); - + /* Test limited concatenation to non empty buffer */ p = strncat(DestinationString, SourceString, 128); diff --git a/test/val/lib_common_strrchr.c b/test/val/lib_common_strrchr.c index a72c44db9..840ec2b7c 100644 --- a/test/val/lib_common_strrchr.c +++ b/test/val/lib_common_strrchr.c @@ -1,6 +1,6 @@ #include #include "unittest.h" - + static char TestString[] = "01234567890123456789"; // two times the same string static char Found[256]; diff --git a/test/val/lib_common_strspn.c b/test/val/lib_common_strspn.c index 96a006469..b7b4c1d85 100644 --- a/test/val/lib_common_strspn.c +++ b/test/val/lib_common_strspn.c @@ -10,7 +10,7 @@ static char* TestChars="1234567890"; // we like to find numbe TEST { unsigned i; - + for (i=0; i < EstimatedStringSize; ++i) EstimatedString[i] = (i%10)+'0'; // put 0123... into the string to be estimated diff --git a/test/val/mult1.c b/test/val/mult1.c index 831bde7ec..6d491a427 100644 --- a/test/val/mult1.c +++ b/test/val/mult1.c @@ -48,23 +48,23 @@ void m2(unsigned char uc) void m3(unsigned char uc) { volatile unsigned char vuc; - + /* uchar = uchar * lit */ /* testing literal multiply with same source and destination */ vuc = uc; - uc2 = 0; - uc1 = vuc; uc1 = uc1*1; if( uc1 != (uc2+=TESTLIT) ) failures++; - uc1 = vuc; uc1 = uc1*2; if( uc1 != (uc2+=TESTLIT) ) failures++; - uc1 = vuc; uc1 = uc1*3; if( uc1 != (uc2+=TESTLIT) ) failures++; - uc1 = vuc; uc1 = uc1*4; if( uc1 != (uc2+=TESTLIT) ) failures++; + uc2 = 0; + uc1 = vuc; uc1 = uc1*1; if( uc1 != (uc2+=TESTLIT) ) failures++; + uc1 = vuc; uc1 = uc1*2; if( uc1 != (uc2+=TESTLIT) ) failures++; + uc1 = vuc; uc1 = uc1*3; if( uc1 != (uc2+=TESTLIT) ) failures++; + uc1 = vuc; uc1 = uc1*4; if( uc1 != (uc2+=TESTLIT) ) failures++; uc1 = vuc; uc1 = uc1*5; if( uc1 != (uc2+=TESTLIT) ) failures++; - uc1 = vuc; uc1 = uc1*6; if( uc1 != (uc2+=TESTLIT) ) failures++; - uc1 = vuc; uc1 = uc1*7; if( uc1 != (uc2+=TESTLIT) ) failures++; - uc1 = vuc; uc1 = uc1*8; if( uc1 != (uc2+=TESTLIT) ) failures++; + uc1 = vuc; uc1 = uc1*6; if( uc1 != (uc2+=TESTLIT) ) failures++; + uc1 = vuc; uc1 = uc1*7; if( uc1 != (uc2+=TESTLIT) ) failures++; + uc1 = vuc; uc1 = uc1*8; if( uc1 != (uc2+=TESTLIT) ) failures++; uc1 = vuc; uc1 = uc1*9; if( uc1 != (uc2+=TESTLIT) ) failures++; - uc1 = vuc; uc1 = uc1*10; if( uc1 != (uc2+=TESTLIT) ) failures++; - uc1 = vuc; uc1 = uc1*11; if( uc1 != (uc2+=TESTLIT) ) failures++; - uc1 = vuc; uc1 = uc1*12; if( uc1 != (uc2+=TESTLIT) ) failures++; + uc1 = vuc; uc1 = uc1*10; if( uc1 != (uc2+=TESTLIT) ) failures++; + uc1 = vuc; uc1 = uc1*11; if( uc1 != (uc2+=TESTLIT) ) failures++; + uc1 = vuc; uc1 = uc1*12; if( uc1 != (uc2+=TESTLIT) ) failures++; uc1 = vuc; uc1 = uc1*13; if( uc1 != (uc2+=TESTLIT) ) failures++; uc1 = vuc; uc1 = uc1*14; if( uc1 != (uc2+=TESTLIT) ) failures++; uc1 = vuc; uc1 = uc1*15; if( uc1 != (uc2+=TESTLIT) ) failures++; @@ -75,17 +75,17 @@ void m3(unsigned char uc) uc1 = vuc; uc1 = uc1*20; if( uc1 != (uc2+=TESTLIT) ) failures++; uc1 = vuc; uc1 = uc1*21; if( uc1 != (uc2+=TESTLIT) ) failures++; uc1 = vuc; uc1 = uc1*22; if( uc1 != (uc2+=TESTLIT) ) failures++; - uc1 = vuc; uc1 = uc1*23; if( uc1 != (uc2+=TESTLIT) ) failures++; + uc1 = vuc; uc1 = uc1*23; if( uc1 != (uc2+=TESTLIT) ) failures++; uc1 = vuc; uc1 = uc1*24; if( uc1 != (uc2+=TESTLIT) ) failures++; - + uc1 = vuc; uc1 = uc1*31; if( uc1 != ((31*TESTLIT) & 0xff) ) failures++; uc1 = vuc; uc1 = uc1*32; if( uc1 != ((32*TESTLIT) & 0xff) ) failures++; uc1 = vuc; uc1 = uc1*64; if( uc1 != ((64*TESTLIT) & 0xff) ) failures++; uc1 = vuc; uc1 = uc1*128;if( uc1 != ((128*TESTLIT)& 0xff) ) failures++; /* testing literal multiply with different source and destination */ - uc1 = vuc*1; if( uc1 != ((1*TESTLIT) & 0xff) ) failures++; - uc1 = vuc*2; if( uc1 != ((2*TESTLIT) & 0xff) ) failures++; + uc1 = vuc*1; if( uc1 != ((1*TESTLIT) & 0xff) ) failures++; + uc1 = vuc*2; if( uc1 != ((2*TESTLIT) & 0xff) ) failures++; uc1 = vuc*4; if( uc1 != ((4*TESTLIT) & 0xff) ) failures++; } diff --git a/test/val/or1.c b/test/val/or1.c index 9e41d7a39..b5f550331 100644 --- a/test/val/or1.c +++ b/test/val/or1.c @@ -57,23 +57,23 @@ void or_lit2uint(void) failures++; uint0 |= 1; - if(uint0 != 1) + if(uint0 != 1) failures++; uint0 |= 2; - if(uint0 != 3) + if(uint0 != 3) failures++; uint0 |= 0x100; - if(uint0 != 0x103) + if(uint0 != 0x103) failures++; uint0 |= 0x102; - if(uint0 != 0x103) + if(uint0 != 0x103) failures++; uint0 |= 0x303; - if(uint0 != 0x303) + if(uint0 != 0x303) failures++; } @@ -83,27 +83,27 @@ void or_lit2ulong(void) failures++; ulong0 |= 1; - if(ulong0 != 1) + if(ulong0 != 1) failures++; ulong0 |= 2; - if(ulong0 != 3) + if(ulong0 != 3) failures++; ulong0 |= 0x100; - if(ulong0 != 0x103) + if(ulong0 != 0x103) failures++; ulong0 |= 0x102; - if(ulong0 != 0x103) + if(ulong0 != 0x103) failures++; ulong0 |= 0x303; - if(ulong0 != 0x303) + if(ulong0 != 0x303) failures++; ulong0 |= 0x80000000; - if(ulong0 != 0x80000303) + if(ulong0 != 0x80000303) failures++; } diff --git a/test/val/postdec-16-16.c b/test/val/postdec-16-16.c index e55b5765f..bb4475959 100644 --- a/test/val/postdec-16-16.c +++ b/test/val/postdec-16-16.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned short u16w = 3; static unsigned short u16r = 5; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0x1, 0xc, 0xd, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0x1, 0xc, 0xd, 0x4, 0x5, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u16w: %d\n\r", u16w); printf("u16r: %d\n\r", u16r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/postdec-16-8.c b/test/val/postdec-16-8.c index 76a64d769..d2a5bab3b 100644 --- a/test/val/postdec-16-8.c +++ b/test/val/postdec-16-8.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned short u16w = 3; static unsigned char u8r = 5; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0x1, 0xc, 0xd, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0x1, 0xc, 0xd, 0x4, 0x5, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u16w: %d\n\r", u16w); printf("u8r: %d\n\r", u8r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/postdec-8-16.c b/test/val/postdec-8-16.c index f7716ae89..7eeda2dcc 100644 --- a/test/val/postdec-8-16.c +++ b/test/val/postdec-8-16.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned char u8w = 3; static unsigned short u16r = 5; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0x1, 0xc, 0xd, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0x1, 0xc, 0xd, 0x4, 0x5, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u8w: %d\n\r", u8w); printf("u16r: %d\n\r", u16r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/postdec-8-8.c b/test/val/postdec-8-8.c index b620c46dc..38470cb14 100644 --- a/test/val/postdec-8-8.c +++ b/test/val/postdec-8-8.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned char u8w = 3; static unsigned char u8r = 5; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0x1, 0xc, 0xd, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0x1, 0xc, 0xd, 0x4, 0x5, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u8w: %d\n\r", u8w); printf("u8r: %d\n\r", u8r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/postinc-16-16.c b/test/val/postinc-16-16.c index 286e0364b..4a122e51f 100644 --- a/test/val/postinc-16-16.c +++ b/test/val/postinc-16-16.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned short u16w = 1; static unsigned short u16r = 3; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u16w: %d\n\r", u16w); printf("u16r: %d\n\r", u16r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/postinc-16-8.c b/test/val/postinc-16-8.c index dd0a03d6c..a604ab34c 100644 --- a/test/val/postinc-16-8.c +++ b/test/val/postinc-16-8.c @@ -1,12 +1,12 @@ #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -26,9 +26,9 @@ static unsigned char mem[0x10]; static unsigned short u16w = 1; static unsigned char u8r = 3; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; static unsigned char i; static unsigned char err = 0; @@ -40,17 +40,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -60,13 +60,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u16w: %d\n\r", u16w); printf("u8r: %d\n\r", u8r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/postinc-8-16.c b/test/val/postinc-8-16.c index 57e934ced..7ac57e9da 100644 --- a/test/val/postinc-8-16.c +++ b/test/val/postinc-8-16.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned char u8w = 1; static unsigned short u16r = 3; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u8w: %d\n\r", u8w); printf("u16r: %d\n\r", u16r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/postinc-8-8.c b/test/val/postinc-8-8.c index b168af8df..97c8aa9f7 100644 --- a/test/val/postinc-8-8.c +++ b/test/val/postinc-8-8.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned char u8w = 1; static unsigned char u8r = 3; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u8w: %d\n\r", u8w); printf("u8r: %d\n\r", u8r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/pptest4.c b/test/val/pptest4.c index 827be7200..6c0891661 100644 --- a/test/val/pptest4.c +++ b/test/val/pptest4.c @@ -2,7 +2,7 @@ /* preprocessor test #4 */ #define t(x,y,z) x ## y ## z -int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), +int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), t(10,,), t(,11,), t(,,12), t(,,) }; int e[] = { 123, 45, 67, 89, 10, 11, 12, }; diff --git a/test/val/pptest5.c b/test/val/pptest5.c index 82f642c8e..0b9db291d 100644 --- a/test/val/pptest5.c +++ b/test/val/pptest5.c @@ -1,7 +1,7 @@ /* preprocessor test #5 */ -#define t(x,y,z) x ## y ## z +#define t(x,y,z) x ## y ## z int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), t(10,,), t(,11,), t(,,12), t(,,) }; diff --git a/test/val/pr1423.c b/test/val/pr1423.c index 3135b64a3..47f0f0610 100644 --- a/test/val/pr1423.c +++ b/test/val/pr1423.c @@ -10,7 +10,7 @@ void test1(void) } fails++; return; -} +} void test2(void) { diff --git a/test/val/predec-16-16.c b/test/val/predec-16-16.c index 7d70b1208..a8c1658e4 100644 --- a/test/val/predec-16-16.c +++ b/test/val/predec-16-16.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned short u16w = 3; static unsigned short u16r = 5; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u16w: %d\n\r", u16w); printf("u16r: %d\n\r", u16r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/predec-16-8.c b/test/val/predec-16-8.c index 69a0a3e28..a0e77da89 100644 --- a/test/val/predec-16-8.c +++ b/test/val/predec-16-8.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned short u16w = 3; static unsigned char u8r = 5; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u16w: %d\n\r", u16w); printf("u8r: %d\n\r", u8r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/predec-8-16.c b/test/val/predec-8-16.c index 750312215..353f819d2 100644 --- a/test/val/predec-8-16.c +++ b/test/val/predec-8-16.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned char u8w = 3; static unsigned short u16r = 5; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u8w: %d\n\r", u8w); printf("u16r: %d\n\r", u16r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/predec-8-8.c b/test/val/predec-8-8.c index d1069b39e..e468c9426 100644 --- a/test/val/predec-8-8.c +++ b/test/val/predec-8-8.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned char u8w = 3; static unsigned char u8r = 5; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0xb, 0xc, 0x3, 0x4, 0x5, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u8w: %d\n\r", u8w); printf("u8r: %d\n\r", u8r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/preinc-16-16.c b/test/val/preinc-16-16.c index d9c6dbf62..b600b6533 100644 --- a/test/val/preinc-16-16.c +++ b/test/val/preinc-16-16.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned short u16w = 3; static unsigned short u16r = 5; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0x1, 0x2, 0x3, 0xe, 0xf, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0x1, 0x2, 0x3, 0xe, 0xf, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u16w: %d\n\r", u16w); printf("u16r: %d\n\r", u16r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/preinc-16-8.c b/test/val/preinc-16-8.c index 97a5dd306..a7bc5d53a 100644 --- a/test/val/preinc-16-8.c +++ b/test/val/preinc-16-8.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned short u16w = 3; static unsigned char u8r = 5; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0x1, 0x2, 0x3, 0xe, 0xf, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0x1, 0x2, 0x3, 0xe, 0xf, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u16w: %d\n\r", u16w); printf("u8r: %d\n\r", u8r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/preinc-8-16.c b/test/val/preinc-8-16.c index 3c3a9b479..2b4104df5 100644 --- a/test/val/preinc-8-16.c +++ b/test/val/preinc-8-16.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned char u8w = 3; static unsigned short u16r = 5; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0x1, 0x2, 0x3, 0xe, 0xf, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0x1, 0x2, 0x3, 0xe, 0xf, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u8w: %d\n\r", u8w); printf("u16r: %d\n\r", u16r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/preinc-8-8.c b/test/val/preinc-8-8.c index a700bfc48..9f6ec35a9 100644 --- a/test/val/preinc-8-8.c +++ b/test/val/preinc-8-8.c @@ -2,12 +2,12 @@ #include #include #include -#ifdef __C64__ +#ifdef __C64__ #include #endif /* apparently we dont trigger the bug when not using absolute addresses? */ -#ifdef __C64__ +#ifdef __C64__ #define TARGETMEM 0x4c8 #define SOURCEMEM 0x702 #elif __SIM6502__ @@ -27,9 +27,9 @@ static unsigned char mem[0x10]; static unsigned char u8w = 3; static unsigned char u8r = 5; -static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; -static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; -static unsigned char expect[8] = { 0x0, 0x1, 0x2, 0x3, 0xe, 0xf, 0x6, 0x7 }; +static unsigned char target[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +static unsigned char source[8] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +static unsigned char expect[8] = { 0x0, 0x1, 0x2, 0x3, 0xe, 0xf, 0x6, 0x7 }; static unsigned char i; static unsigned char err = EXIT_SUCCESS; @@ -41,17 +41,17 @@ void test1(void) void dotest(void) { - + memcpy(TARGETMEM, target, 8); memcpy(SOURCEMEM, source, 8); - + test1(); memcpy(target, TARGETMEM, 8); memcpy(source, SOURCEMEM, 8); -#ifdef __C64__ +#ifdef __C64__ clrscr(); -#endif +#endif printf("source:"); for(i = 0; i < 8; ++i) { printf("%0x ", source[i]); @@ -61,13 +61,13 @@ void dotest(void) printf("%0x ", target[i]); } printf("\n\r"); - + printf("u8w: %d\n\r", u8w); printf("u8r: %d\n\r", u8r); - + } - -int main(void) + +int main(void) { dotest(); dotest(); diff --git a/test/val/static-fwd-decl.c b/test/val/static-fwd-decl.c index 420640d97..a133e930f 100644 --- a/test/val/static-fwd-decl.c +++ b/test/val/static-fwd-decl.c @@ -15,7 +15,7 @@ typedef struct _DIRMENU { const char *name; struct _DIRMENU *dest; -} DIRMENU; +} DIRMENU; static DIRMENU rmenu; diff --git a/test/val/strnicmp-test.c b/test/val/strnicmp-test.c index 6376a39bb..e6e5a3b04 100644 --- a/test/val/strnicmp-test.c +++ b/test/val/strnicmp-test.c @@ -71,9 +71,9 @@ int main(void) ret = do_test("", "", 5); printresult(ret); - + printf("fails: %d\n", fails); - + #if defined(__CC65__) && !defined(__SIM6502__) && !defined(__SIM65C02__) cgetc(); #endif diff --git a/test/val/switch2.c b/test/val/switch2.c index 65c24eeda..eff06ce12 100644 --- a/test/val/switch2.c +++ b/test/val/switch2.c @@ -1,6 +1,6 @@ /* !!DESCRIPTION!! Testing empty bodied switch statements. - !!ORIGIN!! + !!ORIGIN!! !!LICENCE!! GPL, read COPYING.GPL */ diff --git a/test/val/time-test.c b/test/val/time-test.c index 304238fa0..db086410d 100644 --- a/test/val/time-test.c +++ b/test/val/time-test.c @@ -46,7 +46,7 @@ int main (void) sprintf (result, "%08lX - %s\n", t, buf); printf (result); if (strcmp(result, EXPECTSTR) != 0) { fails++; } - + printf("fails: %d\n", fails); return fails; diff --git a/test/val/xor.c b/test/val/xor.c index 2a346023e..98bd5faf1 100644 --- a/test/val/xor.c +++ b/test/val/xor.c @@ -31,12 +31,12 @@ void xor_chars_0_1(void) void xor_if(void) { - if(achar0 ^ achar1) + if(achar0 ^ achar1) failures++; achar0 ^= 0xff; - if( !(achar0 ^ achar1) ) + if( !(achar0 ^ achar1) ) failures++; } From 92e16432f792a5b358df68588980efb5b993fb1b Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 17 Apr 2022 16:08:04 +0200 Subject: [PATCH 26/33] remove dangling spaces --- util/atari/ataricvt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/atari/ataricvt.c b/util/atari/ataricvt.c index 104d4f6de..23ad5a24a 100644 --- a/util/atari/ataricvt.c +++ b/util/atari/ataricvt.c @@ -8,7 +8,7 @@ int main (void) putchar ('\n'); } else if (C == 0x7F) { putchar ('\t'); - } else { + } else { putchar (C); } } From 4e3bba0c3f7f67c1b05a11c4373c8daf61e8c257 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 17 Apr 2022 16:08:21 +0200 Subject: [PATCH 27/33] also check spaces at end of lines --- .github/checks/Makefile | 8 +++----- Contributing.md | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/checks/Makefile b/.github/checks/Makefile index 827606d01..662477790 100644 --- a/.github/checks/Makefile +++ b/.github/checks/Makefile @@ -1,15 +1,13 @@ .PHONY: tabs -check: tabs lastline +check: tabs lastline spaces tabs: tabs.sh @./tabs.sh - + lastline: lastline.sh @./lastline.sh - -# checks that will currently fail (on a lot of files), so they are not included -# in the general "check" action + spaces: spaces.sh @./spaces.sh diff --git a/Contributing.md b/Contributing.md index c8681c7ee..6258ce523 100644 --- a/Contributing.md +++ b/Contributing.md @@ -20,7 +20,7 @@ This is an ongoing controversial topic - everyone knows that. However, the follo * No extra spaces at the end of lines. * All text files must end with new-line characters. Don't leave the last line "dangling". -The (bash) scipts used to check the above rules can be found in ```.github/check``` +The (bash) scipts used to check the above rules can be found in ```.github/check```. You can also run all checks using ```make check```. ### misc From e9fec5e3fe4569b5c018aa6b9aa5d72572e16480 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 17 Apr 2022 17:12:52 +0200 Subject: [PATCH 28/33] define CHECK_PATH rather than leaving it open --- .github/checks/lastline.sh | 2 ++ .github/checks/spaces.sh | 2 ++ .github/checks/tabs.sh | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.github/checks/lastline.sh b/.github/checks/lastline.sh index d455481d1..464f1774a 100755 --- a/.github/checks/lastline.sh +++ b/.github/checks/lastline.sh @@ -1,6 +1,8 @@ #! /bin/bash OLDCWD=`pwd` SCRIPT_PATH=`dirname $0` +CHECK_PATH=. + cd $SCRIPT_PATH/../../ nl=' diff --git a/.github/checks/spaces.sh b/.github/checks/spaces.sh index 309ba9ac1..71bdd877f 100755 --- a/.github/checks/spaces.sh +++ b/.github/checks/spaces.sh @@ -1,6 +1,8 @@ #! /bin/bash OLDCWD=`pwd` SCRIPT_PATH=`dirname $0` +CHECK_PATH=. + cd $SCRIPT_PATH/../../ FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.c -o -name \*.s -o -name \*.h -o -name \*.asm -o -name \*.sgml \) -print | xargs grep -l ' $' | grep -v "libwrk/" | grep -v "testwrk/"` diff --git a/.github/checks/tabs.sh b/.github/checks/tabs.sh index ad10dfe14..db2b61eac 100755 --- a/.github/checks/tabs.sh +++ b/.github/checks/tabs.sh @@ -1,6 +1,8 @@ #! /bin/bash OLDCWD=`pwd` SCRIPT_PATH=`dirname $0` +CHECK_PATH=. + cd $SCRIPT_PATH/../../ FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.c -o -name \*.s -o -name \*.h -o -name \*.asm -o -name \*.sgml \) -print | xargs grep -l $'\t' | grep -v "libwrk/" | grep -v "testwrk/"` From b2319f35787a227af0dda65ffaddf1c6c273102e Mon Sep 17 00:00:00 2001 From: Greg King Date: Sun, 17 Apr 2022 14:45:33 -0400 Subject: [PATCH 29/33] Made all of the Makefile's rules be phony. --- .github/checks/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/checks/Makefile b/.github/checks/Makefile index 662477790..dc42d14ca 100644 --- a/.github/checks/Makefile +++ b/.github/checks/Makefile @@ -1,5 +1,5 @@ -.PHONY: tabs +.PHONY: check tabs lastline spaces check: tabs lastline spaces From 86ca11222a905a122773029da44223bea0171490 Mon Sep 17 00:00:00 2001 From: Greg King Date: Sun, 17 Apr 2022 14:47:19 -0400 Subject: [PATCH 30/33] Fixed and tightenned the find commands' expressions. --- .github/checks/lastline.sh | 2 +- .github/checks/spaces.sh | 2 +- .github/checks/tabs.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/checks/lastline.sh b/.github/checks/lastline.sh index 464f1774a..797b6acfd 100755 --- a/.github/checks/lastline.sh +++ b/.github/checks/lastline.sh @@ -8,7 +8,7 @@ cd $SCRIPT_PATH/../../ nl=' ' nl=$'\n' -FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.c -o -name \*.s -o -name \*.h -o -name \*.asm -o -name \*.sgml \) -print | while read f; do +FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.asm -o -name \*.sgml \) -print | while read f; do t=$(tail -c2 $f; printf x); r1="${nl}$"; [[ ${t%x} =~ $r1 ]] || echo "$f" done` diff --git a/.github/checks/spaces.sh b/.github/checks/spaces.sh index 71bdd877f..02a03ff58 100755 --- a/.github/checks/spaces.sh +++ b/.github/checks/spaces.sh @@ -5,7 +5,7 @@ CHECK_PATH=. cd $SCRIPT_PATH/../../ -FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.c -o -name \*.s -o -name \*.h -o -name \*.asm -o -name \*.sgml \) -print | xargs grep -l ' $' | grep -v "libwrk/" | grep -v "testwrk/"` +FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.asm -o -name \*.sgml \) -print | xargs grep -l ' $' | grep -v "libwrk/" | grep -v "testwrk/"` cd $OLDCWD diff --git a/.github/checks/tabs.sh b/.github/checks/tabs.sh index db2b61eac..3823eb370 100755 --- a/.github/checks/tabs.sh +++ b/.github/checks/tabs.sh @@ -5,7 +5,7 @@ CHECK_PATH=. cd $SCRIPT_PATH/../../ -FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.c -o -name \*.s -o -name \*.h -o -name \*.asm -o -name \*.sgml \) -print | xargs grep -l $'\t' | grep -v "libwrk/" | grep -v "testwrk/"` +FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.asm -o -name \*.sgml \) -print | xargs grep -l $'\t' | grep -v "libwrk/" | grep -v "testwrk/"` cd $OLDCWD From a4e1cf9a0a62bddcc660ae339062e047b8ddf21c Mon Sep 17 00:00:00 2001 From: Greg King Date: Sun, 17 Apr 2022 15:08:42 -0400 Subject: [PATCH 31/33] Moved a constant expression out of a loop. --- .github/checks/lastline.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/checks/lastline.sh b/.github/checks/lastline.sh index 797b6acfd..406814ff4 100755 --- a/.github/checks/lastline.sh +++ b/.github/checks/lastline.sh @@ -8,8 +8,9 @@ cd $SCRIPT_PATH/../../ nl=' ' nl=$'\n' +r1="${nl}$" FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.asm -o -name \*.sgml \) -print | while read f; do - t=$(tail -c2 $f; printf x); r1="${nl}$"; + t=$(tail -c2 $f; printf x) [[ ${t%x} =~ $r1 ]] || echo "$f" done` From 58392982035b609189f93dedc94fe5a759240225 Mon Sep 17 00:00:00 2001 From: Greg King Date: Sun, 17 Apr 2022 16:10:28 -0400 Subject: [PATCH 32/33] Remove work directory paths _before_ checking for style errors. --- .github/checks/spaces.sh | 2 +- .github/checks/tabs.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/checks/spaces.sh b/.github/checks/spaces.sh index 02a03ff58..e133d1e47 100755 --- a/.github/checks/spaces.sh +++ b/.github/checks/spaces.sh @@ -5,7 +5,7 @@ CHECK_PATH=. cd $SCRIPT_PATH/../../ -FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.asm -o -name \*.sgml \) -print | xargs grep -l ' $' | grep -v "libwrk/" | grep -v "testwrk/"` +FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l ' $'` cd $OLDCWD diff --git a/.github/checks/tabs.sh b/.github/checks/tabs.sh index 3823eb370..87350efd9 100755 --- a/.github/checks/tabs.sh +++ b/.github/checks/tabs.sh @@ -5,7 +5,7 @@ CHECK_PATH=. cd $SCRIPT_PATH/../../ -FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.asm -o -name \*.sgml \) -print | xargs grep -l $'\t' | grep -v "libwrk/" | grep -v "testwrk/"` +FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l $'\t'` cd $OLDCWD From 2cdccd5e8a9784ef642014818ae99fa50254e723 Mon Sep 17 00:00:00 2001 From: Greg King Date: Sun, 17 Apr 2022 19:06:35 -0400 Subject: [PATCH 33/33] Oops, forgot to check macros. --- .github/checks/lastline.sh | 2 +- .github/checks/spaces.sh | 2 +- .github/checks/tabs.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/checks/lastline.sh b/.github/checks/lastline.sh index 406814ff4..851a2cfc4 100755 --- a/.github/checks/lastline.sh +++ b/.github/checks/lastline.sh @@ -9,7 +9,7 @@ nl=' ' nl=$'\n' r1="${nl}$" -FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.asm -o -name \*.sgml \) -print | while read f; do +FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | while read f; do t=$(tail -c2 $f; printf x) [[ ${t%x} =~ $r1 ]] || echo "$f" done` diff --git a/.github/checks/spaces.sh b/.github/checks/spaces.sh index e133d1e47..d695beaba 100755 --- a/.github/checks/spaces.sh +++ b/.github/checks/spaces.sh @@ -5,7 +5,7 @@ CHECK_PATH=. cd $SCRIPT_PATH/../../ -FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l ' $'` +FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l ' $'` cd $OLDCWD diff --git a/.github/checks/tabs.sh b/.github/checks/tabs.sh index 87350efd9..16f0280ae 100755 --- a/.github/checks/tabs.sh +++ b/.github/checks/tabs.sh @@ -5,7 +5,7 @@ CHECK_PATH=. cd $SCRIPT_PATH/../../ -FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l $'\t'` +FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l $'\t'` cd $OLDCWD