]> git.sur5r.net Git - cc65/blobdiff - src/cc65/codeseg.c
Fix missing spaces
[cc65] / src / cc65 / codeseg.c
index c28f32651c9a51aae7cf4f69167a8171920de69b..e2fd84a7c953bc09a5063d9d56581e4df38d3209 100644 (file)
@@ -87,8 +87,8 @@ static void CS_PrintFunctionHeader (const CodeSeg* S)
 
 static void CS_MoveLabelsToEntry (CodeSeg* S, CodeEntry* E)
 /* Move all labels from the label pool to the given entry and remove them
- * from the pool.
- */
+** from the pool.
+*/
 {
     /* Transfer the labels if we have any */
     unsigned I;
@@ -203,8 +203,8 @@ static const char* SkipSpace (const char* S)
 static const char* ReadToken (const char* L, const char* Term,
                               char* Buf, unsigned BufSize)
 /* Read the next token into Buf, return the updated line pointer. The
- * token is terminated by one of the characters given in term.
- */
+** token is terminated by one of the characters given in term.
+*/
 {
     /* Read/copy the token */
     unsigned I = 0;
@@ -214,8 +214,8 @@ static const char* ReadToken (const char* L, const char* Term,
             Buf[I] = *L;
         } else if (I == BufSize-1) {
             /* Cannot store this character, this is an input error (maybe
-             * identifier too long or similar).
-             */
+            ** identifier too long or similar).
+            */
             Error ("ASM code error: syntax error");
         }
         ++I;
@@ -238,11 +238,11 @@ static const char* ReadToken (const char* L, const char* Term,
 
 static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L)
 /* Parse an instruction nnd generate a code entry from it. If the line contains
- * errors, output an error message and return NULL.
- * For simplicity, we don't accept the broad range of input a "real" assembler
- * does. The instruction and the argument are expected to be separated by
- * white space, for example.
- */
+** errors, output an error message and return NULL.
+** For simplicity, we don't accept the broad range of input a "real" assembler
+** does. The instruction and the argument are expected to be separated by
+** white space, for example.
+*/
 {
     char                Mnemo[IDENTSIZE+10];
     const OPCDesc*      OPC;
@@ -265,8 +265,8 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L)
         CS_AddLabel (S, Mnemo);
 
         /* If we have reached end of line, bail out, otherwise a mnemonic
-         * may follow.
-         */
+        ** may follow.
+        */
         if (*L == '\0') {
             return 0;
         }
@@ -317,12 +317,12 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L)
                 /* Expect zp x indirect */
                 L = SkipSpace (L+1);
                 if (toupper (*L) != 'X') {
-                    Error ("ASM code error: `X' expected");
+                    Error ("ASM code error: 'X' expected");
                     return 0;
                 }
                 L = SkipSpace (L+1);
                 if (*L != ')') {
-                    Error ("ASM code error: `)' expected");
+                    Error ("ASM code error: ')' expected");
                     return 0;
                 }
                 L = SkipSpace (L+1);
@@ -337,7 +337,7 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L)
                 if (*L == ',') {
                     L = SkipSpace (L+1);
                     if (toupper (*L) != 'Y') {
-                        Error ("ASM code error: `Y' expected");
+                        Error ("ASM code error: 'Y' expected");
                         return 0;
                     }
                     L = SkipSpace (L+1);
@@ -378,7 +378,7 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L)
                     /* Check for subroutine call to local label */
                     if ((OPC->Info & OF_CALL) && IsLocalLabelName (Arg)) {
                         Error ("ASM code error: "
-                               "Cannot use local label `%s' in subroutine call",
+                               "Cannot use local label '%s' in subroutine call",
                                Arg);
                     }
                     AM = AM65_ABS;
@@ -415,10 +415,10 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L)
     }
 
     /* If the instruction is a branch, check for the label and generate it
-     * if it does not exist. This may lead to unused labels (if the label
-     * is actually an external one) which are removed by the CS_MergeLabels
-     * function later.
-     */
+    ** if it does not exist. This may lead to unused labels (if the label
+    ** is actually an external one) which are removed by the CS_MergeLabels
+    ** function later.
+    */
     Label = 0;
     if (AM == AM65_BRA) {
 
@@ -426,16 +426,18 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L)
         unsigned Hash = HashStr (Arg) % CS_LABEL_HASH_SIZE;
         Label = CS_FindLabel (S, Arg, Hash);
 
-        /* If we don't have the label, it's a forward ref - create it */
-        if (Label == 0) {
+        /* If we don't have the label, it's a forward ref - create it unless
+        ** it's an external function.
+        */
+        if (Label == 0 && (OPC->OPC != OP65_JMP || IsLocalLabelName (Arg)) ) {
             /* Generate a new label */
             Label = CS_NewCodeLabel (S, Arg, Hash);
         }
     }
 
     /* We do now have the addressing mode in AM. Allocate a new CodeEntry
-     * structure and initialize it.
-     */
+    ** structure and initialize it.
+    */
     E = NewCodeEntry (OPC->OPC, AM, Arg, Label, LI);
 
     /* Return the new code entry */
@@ -469,8 +471,8 @@ CodeSeg* NewCodeSeg (const char* SegName, SymEntry* Func)
     }
 
     /* If we have a function given, get the return type of the function.
-     * Assume ANY return type besides void will use the A and X registers.
-     */
+    ** Assume ANY return type besides void will use the A and X registers.
+    */
     if (S->Func && !IsTypeVoid ((RetType = GetFuncReturn (Func->Type)))) {
         if (SizeOf (RetType) == SizeOf (type_long)) {
             S->ExitRegs = REG_EAX;
@@ -532,7 +534,7 @@ void CS_AddVLine (CodeSeg* S, LineInfo* LI, const char* Format, va_list ap)
         case '.':
             /* Control instruction */
             ReadToken (L, " \t", Token, sizeof (Token));
-            Error ("ASM code error: Pseudo instruction `%s' not supported", Token);
+            Error ("ASM code error: Pseudo instruction '%s' not supported", Token);
             break;
 
         default:
@@ -564,8 +566,8 @@ void CS_AddLine (CodeSeg* S, LineInfo* LI, const char* Format, ...)
 
 void CS_InsertEntry (CodeSeg* S, struct CodeEntry* E, unsigned Index)
 /* Insert the code entry at the index given. Following code entries will be
- * moved to slots with higher indices.
- */
+** moved to slots with higher indices.
+*/
 {
     /* Insert the entry into the collection */
     CollInsert (&S->Entries, E, Index);
@@ -575,27 +577,27 @@ void CS_InsertEntry (CodeSeg* S, struct CodeEntry* E, unsigned Index)
 
 void CS_DelEntry (CodeSeg* S, unsigned Index)
 /* Delete an entry from the code segment. This includes moving any associated
- * labels, removing references to labels and even removing the referenced labels
- * if the reference count drops to zero.
- * Note: Labels are moved forward if possible, that is, they are moved to the
- * next insn (not the preceeding one).
- */
+** labels, removing references to labels and even removing the referenced labels
+** if the reference count drops to zero.
+** Note: Labels are moved forward if possible, that is, they are moved to the
+** next insn (not the preceeding one).
+*/
 {
     /* Get the code entry for the given index */
     CodeEntry* E = CS_GetEntry (S, Index);
 
     /* If the entry has a labels, we have to move this label to the next insn.
-     * If there is no next insn, move the label into the code segement label
-     * pool. The operation is further complicated by the fact that the next
-     * insn may already have a label. In that case change all reference to
-     * this label and delete the label instead of moving it.
-     */
+    ** If there is no next insn, move the label into the code segement label
+    ** pool. The operation is further complicated by the fact that the next
+    ** insn may already have a label. In that case change all reference to
+    ** this label and delete the label instead of moving it.
+    */
     unsigned Count = CE_GetLabelCount (E);
     if (Count > 0) {
 
         /* The instruction has labels attached. Check if there is a next
-         * instruction.
-         */
+        ** instruction.
+        */
         if (Index == CS_GetEntryCount (S)-1) {
 
             /* No next instruction, move to the codeseg label pool */
@@ -613,8 +615,8 @@ void CS_DelEntry (CodeSeg* S, unsigned Index)
     }
 
     /* If this insn references a label, remove the reference. And, if the
-     * the reference count for this label drops to zero, remove this label.
-     */
+    ** the reference count for this label drops to zero, remove this label.
+    */
     if (E->JumpTo) {
         /* Remove the reference */
         CS_RemoveLabelRef (S, E);
@@ -631,12 +633,12 @@ void CS_DelEntry (CodeSeg* S, unsigned Index)
 
 void CS_DelEntries (CodeSeg* S, unsigned Start, unsigned Count)
 /* Delete a range of code entries. This includes removing references to labels,
- * labels attached to the entries and so on.
- */
+** labels attached to the entries and so on.
+*/
 {
     /* Start deleting the entries from the rear, because this involves less
-     * memory moving.
-     */
+    ** memory moving.
+    */
     while (Count--) {
         CS_DelEntry (S, Start + Count);
     }
@@ -646,14 +648,14 @@ void CS_DelEntries (CodeSeg* S, unsigned Start, unsigned Count)
 
 void CS_MoveEntries (CodeSeg* S, unsigned Start, unsigned Count, unsigned NewPos)
 /* Move a range of entries from one position to another. Start is the index
- * of the first entry to move, Count is the number of entries and NewPos is
- * the index of the target entry. The entry with the index Start will later
- * have the index NewPos. All entries with indices NewPos and above are
- * moved to higher indices. If the code block is moved to the end of the
- * current code, and if pending labels exist, these labels will get attached
- * to the first instruction of the moved block (the first one after the
- * current code end)
- */
+** of the first entry to move, Count is the number of entries and NewPos is
+** the index of the target entry. The entry with the index Start will later
+** have the index NewPos. All entries with indices NewPos and above are
+** moved to higher indices. If the code block is moved to the end of the
+** current code, and if pending labels exist, these labels will get attached
+** to the first instruction of the moved block (the first one after the
+** current code end)
+*/
 {
     /* Transparently handle an empty range */
     if (Count == 0) {
@@ -661,8 +663,8 @@ void CS_MoveEntries (CodeSeg* S, unsigned Start, unsigned Count, unsigned NewPos
     }
 
     /* If NewPos is at the end of the code segment, move any labels from the
-     * label pool to the first instruction of the moved range.
-     */
+    ** label pool to the first instruction of the moved range.
+    */
     if (NewPos == CS_GetEntryCount (S)) {
         CS_MoveLabelsToEntry (S, CS_GetEntry (S, Start));
     }
@@ -675,8 +677,8 @@ void CS_MoveEntries (CodeSeg* S, unsigned Start, unsigned Count, unsigned NewPos
 
 struct CodeEntry* CS_GetPrevEntry (CodeSeg* S, unsigned Index)
 /* Get the code entry preceeding the one with the index Index. If there is no
- * preceeding code entry, return NULL.
- */
+** preceeding code entry, return NULL.
+*/
 {
     if (Index == 0) {
         /* This is the first entry */
@@ -691,8 +693,8 @@ struct CodeEntry* CS_GetPrevEntry (CodeSeg* S, unsigned Index)
 
 struct CodeEntry* CS_GetNextEntry (CodeSeg* S, unsigned Index)
 /* Get the code entry following the one with the index Index. If there is no
- * following code entry, return NULL.
- */
+** following code entry, return NULL.
+*/
 {
     if (Index >= CollCount (&S->Entries)-1) {
         /* This is the last entry */
@@ -708,8 +710,8 @@ struct CodeEntry* CS_GetNextEntry (CodeSeg* S, unsigned Index)
 int CS_GetEntries (CodeSeg* S, struct CodeEntry** List,
                    unsigned Start, unsigned Count)
 /* Get Count code entries into List starting at index start. Return true if
- * we got the lines, return false if not enough lines were available.
- */
+** we got the lines, return false if not enough lines were available.
+*/
 {
     /* Check if enough entries are available */
     if (Start + Count > CollCount (&S->Entries)) {
@@ -739,9 +741,9 @@ unsigned CS_GetEntryIndex (CodeSeg* S, struct CodeEntry* E)
 
 int CS_RangeHasLabel (CodeSeg* S, unsigned Start, unsigned Count)
 /* Return true if any of the code entries in the given range has a label
- * attached. If the code segment does not span the given range, check the
- * possible span instead.
- */
+** attached. If the code segment does not span the given range, check the
+** possible span instead.
+*/
 {
     unsigned EntryCount = CS_GetEntryCount(S);
 
@@ -752,8 +754,8 @@ int CS_RangeHasLabel (CodeSeg* S, unsigned Start, unsigned Count)
     }
 
     /* Check each entry. Since we have validated the index above, we may
-     * use the unchecked access function in the loop which is faster.
-     */
+    ** use the unchecked access function in the loop which is faster.
+    */
     while (Count--) {
         const CodeEntry* E = CollAtUnchecked (&S->Entries, Start++);
         if (CE_HasLabel (E)) {
@@ -780,7 +782,7 @@ CodeLabel* CS_AddLabel (CodeSeg* S, const char* Name)
     if (L) {
         /* We found it - be sure it does not already have an owner */
         if (L->Owner) {
-            Error ("ASM label `%s' is already defined", Name);
+            Error ("ASM label '%s' is already defined", Name);
             return L;
         }
     } else {
@@ -790,7 +792,7 @@ CodeLabel* CS_AddLabel (CodeSeg* S, const char* Name)
 
     /* Safety. This call is quite costly, but safety is better */
     if (CollIndex (&S->Labels, L) >= 0) {
-        Error ("ASM label `%s' is already defined", Name);
+        Error ("ASM label '%s' is already defined", Name);
         return L;
     }
 
@@ -805,8 +807,8 @@ CodeLabel* CS_AddLabel (CodeSeg* S, const char* Name)
 
 CodeLabel* CS_GenLabel (CodeSeg* S, struct CodeEntry* E)
 /* If the code entry E does already have a label, return it. Otherwise
- * create a new label, attach it to E and return it.
- */
+** create a new label, attach it to E and return it.
+*/
 {
     CodeLabel* L;
 
@@ -856,10 +858,10 @@ void CS_DelLabel (CodeSeg* S, CodeLabel* L)
     CollDeleteAll (&L->JumpFrom);
 
     /* Remove the reference to the owning instruction if it has one. The
-     * function may be called for a label without an owner when deleting
-     * unfinished parts of the code. This is unfortunate since it allows
-     * errors to slip through.
-     */
+    ** function may be called for a label without an owner when deleting
+    ** unfinished parts of the code. This is unfortunate since it allows
+    ** errors to slip through.
+    */
     if (L->Owner) {
         CollDeleteItem (&L->Owner->Labels, L);
     }
@@ -872,16 +874,16 @@ void CS_DelLabel (CodeSeg* S, CodeLabel* L)
 
 void CS_MergeLabels (CodeSeg* S)
 /* Merge code labels. That means: For each instruction, remove all labels but
- * one and adjust references accordingly.
- */
+** one and adjust references accordingly.
+*/
 {
     unsigned I;
     unsigned J;
 
     /* First, remove all labels from the label symbol table that don't have an
-     * owner (this means that they are actually external labels but we didn't
-     * know that previously since they may have also been forward references).
-     */
+    ** owner (this means that they are actually external labels but we didn't
+    ** know that previously since they may have also been forward references).
+    */
     for (I = 0; I < CS_LABEL_HASH_SIZE; ++I) {
 
         /* Get the first label in this hash chain */
@@ -898,15 +900,15 @@ void CS_MergeLabels (CodeSeg* S)
                     /* Get the entry referencing this label */
                     CodeEntry* E = CL_GetRef (X, J);
                     /* And remove the reference. Do NOT call CE_ClearJumpTo
-                     * here, because this will also clear the label name,
-                     * which is not what we want.
-                     */
+                    ** here, because this will also clear the label name,
+                    ** which is not what we want.
+                    */
                     E->JumpTo = 0;
                 }
 
                 /* Print some debugging output */
                 if (Debug) {
-                    printf ("Removing unused global label `%s'", X->Name);
+                    printf ("Removing unused global label '%s'", X->Name);
                 }
 
                 /* And free the label */
@@ -937,10 +939,10 @@ void CS_MergeLabels (CodeSeg* S)
         RefLab = CE_GetLabel (E, 0);
 
         /* Walk through the remaining labels and change references to these
-         * labels to a reference to the one and only label. Delete the labels
-         * that are no longer used. To increase performance, walk backwards
-         * through the list.
-         */
+        ** labels to a reference to the one and only label. Delete the labels
+        ** that are no longer used. To increase performance, walk backwards
+        ** through the list.
+        */
         for (J = LabelCount-1; J >= 1; --J) {
 
             /* Get the next label */
@@ -954,9 +956,9 @@ void CS_MergeLabels (CodeSeg* S)
         }
 
         /* The reference label is the only remaining label. Check if there
-         * are any references to this label, and delete it if this is not
-         * the case.
-         */
+        ** are any references to this label, and delete it if this is not
+        ** the case.
+        */
         if (CollCount (&RefLab->JumpFrom) == 0) {
             /* Delete the label */
             CS_DelLabel (S, RefLab);
@@ -968,10 +970,10 @@ void CS_MergeLabels (CodeSeg* S)
 
 void CS_MoveLabels (CodeSeg* S, struct CodeEntry* Old, struct CodeEntry* New)
 /* Move all labels from Old to New. The routine will move the labels itself
- * if New does not have any labels, and move references if there is at least
- * a label for new. If references are moved, the old label is deleted
- * afterwards.
- */
+** if New does not have any labels, and move references if there is at least
+** a label for new. If references are moved, the old label is deleted
+** afterwards.
+*/
 {
     /* Get the number of labels to move */
     unsigned OldLabelCount = CE_GetLabelCount (Old);
@@ -1011,10 +1013,10 @@ void CS_MoveLabels (CodeSeg* S, struct CodeEntry* Old, struct CodeEntry* New)
 
 void CS_RemoveLabelRef (CodeSeg* S, struct CodeEntry* E)
 /* Remove the reference between E and the label it jumps to. The reference
- * will be removed on both sides and E->JumpTo will be 0 after that. If
- * the reference was the only one for the label, the label will get
- * deleted.
- */
+** will be removed on both sides and E->JumpTo will be 0 after that. If
+** the reference was the only one for the label, the label will get
+** deleted.
+*/
 {
     /* Get a pointer to the label and make sure it exists */
     CodeLabel* L = E->JumpTo;
@@ -1036,9 +1038,9 @@ void CS_RemoveLabelRef (CodeSeg* S, struct CodeEntry* E)
 
 void CS_MoveLabelRef (CodeSeg* S, struct CodeEntry* E, CodeLabel* L)
 /* Change the reference of E to L instead of the current one. If this
- * was the only reference to the old label, the old label will get
- * deleted.
- */
+** was the only reference to the old label, the old label will get
+** deleted.
+*/
 {
     /* Get the old label */
     CodeLabel* OldLabel = E->JumpTo;
@@ -1057,10 +1059,10 @@ void CS_MoveLabelRef (CodeSeg* S, struct CodeEntry* E, CodeLabel* L)
 
 void CS_DelCodeRange (CodeSeg* S, unsigned First, unsigned Last)
 /* Delete all entries between first and last, both inclusive. The function
- * can only handle basic blocks (First is the only entry, Last the only exit)
- * and no open labels. It will call FAIL if any of these preconditions are
- * violated.
- */
+** can only handle basic blocks (First is the only entry, Last the only exit)
+** and no open labels. It will call FAIL if any of these preconditions are
+** violated.
+*/
 {
     unsigned   I;
     CodeEntry* FirstEntry;
@@ -1069,17 +1071,17 @@ void CS_DelCodeRange (CodeSeg* S, unsigned First, unsigned Last)
     CHECK (First <= Last && Last < CS_GetEntryCount (S));
 
     /* If Last is actually the last insn, call CS_DelCodeAfter instead, which
-     * is more flexible in this case.
-     */
+    ** is more flexible in this case.
+    */
     if (Last == CS_GetEntryCount (S) - 1) {
         CS_DelCodeAfter (S, First);
         return;
     }
 
     /* Get the first entry and check if it has any labels. If it has, move
-     * them to the insn following Last. If Last is the last insn of the code
-     * segment, make them ownerless and move them to the label pool.
-     */
+    ** them to the insn following Last. If Last is the last insn of the code
+    ** segment, make them ownerless and move them to the label pool.
+    */
     FirstEntry = CS_GetEntry (S, First);
     if (CE_HasLabel (FirstEntry)) {
         /* Get the entry following last */
@@ -1094,8 +1096,8 @@ void CS_DelCodeRange (CodeSeg* S, unsigned First, unsigned Last)
     }
 
     /* First pass: Delete all references to labels. If the reference count
-     * for a label drops to zero, delete it.
-     */
+    ** for a label drops to zero, delete it.
+    */
     for (I = Last; I >= First; --I) {
 
         /* Get the next entry */
@@ -1114,9 +1116,9 @@ void CS_DelCodeRange (CodeSeg* S, unsigned First, unsigned Last)
     }
 
     /* Second pass: Delete the instructions. If a label attached to an
-     * instruction still has references, it must be references from outside
-     * the deleted area, which is an error.
-     */
+    ** instruction still has references, it must be references from outside
+    ** the deleted area, which is an error.
+    */
     for (I = Last; I >= First; --I) {
 
         /* Get the next entry */
@@ -1142,8 +1144,8 @@ void CS_DelCodeAfter (CodeSeg* S, unsigned Last)
     unsigned Count = CS_GetEntryCount (S);
 
     /* First pass: Delete all references to labels. If the reference count
-     * for a label drops to zero, delete it.
-     */
+    ** for a label drops to zero, delete it.
+    */
     unsigned C = Count;
     while (Last < C--) {
 
@@ -1153,8 +1155,8 @@ void CS_DelCodeAfter (CodeSeg* S, unsigned Last)
         /* Check if this entry has a label reference */
         if (E->JumpTo) {
             /* If the label is a label in the label pool and this is the last
-             * reference to the label, remove the label from the pool.
-             */
+            ** reference to the label, remove the label from the pool.
+            */
             CodeLabel* L = E->JumpTo;
             int Index = CollIndex (&S->Labels, L);
             if (Index >= 0 && CollCount (&L->JumpFrom) == 1) {
@@ -1169,10 +1171,10 @@ void CS_DelCodeAfter (CodeSeg* S, unsigned Last)
     }
 
     /* Second pass: Delete the instructions. If a label attached to an
-     * instruction still has references, it must be references from outside
-     * the deleted area. Don't delete the label in this case, just make it
-     * ownerless and move it to the label pool.
-     */
+    ** instruction still has references, it must be references from outside
+    ** the deleted area. Don't delete the label in this case, just make it
+    ** ownerless and move it to the label pool.
+    */
     C = Count;
     while (Last < C--) {
 
@@ -1207,10 +1209,10 @@ void CS_ResetMarks (CodeSeg* S, unsigned First, unsigned Last)
 
 int CS_IsBasicBlock (CodeSeg* S, unsigned First, unsigned Last)
 /* Check if the given code segment range is a basic block. That is, check if
- * First is the only entrance and Last is the only exit. This means that no
- * jump/branch inside the block may jump to an insn below First or after(!)
- * Last, and that no insn may jump into this block from the outside.
- */
+** First is the only entrance and Last is the only exit. This means that no
+** jump/branch inside the block may jump to an insn below First or after(!)
+** Last, and that no insn may jump into this block from the outside.
+*/
 {
     unsigned I;
 
@@ -1221,8 +1223,8 @@ int CS_IsBasicBlock (CodeSeg* S, unsigned First, unsigned Last)
     CS_ResetMarks (S, First, Last);
 
     /* Second pass: Walk over the range checking all labels. Note: There may be
-     * label on the first insn which is ok.
-     */
+    ** label on the first insn which is ok.
+    */
     I = First + 1;
     while (I <= Last) {
 
@@ -1230,8 +1232,8 @@ int CS_IsBasicBlock (CodeSeg* S, unsigned First, unsigned Last)
         CodeEntry* E = CS_GetEntry (S, I);
 
         /* Check if this entry has one or more labels, if so, check which
-         * entries jump to this label.
-         */
+        ** entries jump to this label.
+        */
         unsigned LabelCount = CE_GetLabelCount (E);
         unsigned LabelIndex;
         for (LabelIndex = 0; LabelIndex < LabelCount; ++LabelIndex) {
@@ -1240,8 +1242,8 @@ int CS_IsBasicBlock (CodeSeg* S, unsigned First, unsigned Last)
             CodeLabel* L = CE_GetLabel (E, LabelIndex);
 
             /* Walk over all entries that jump to this label. Check for each
-             * of the entries if it is out of the range.
-             */
+            ** of the entries if it is out of the range.
+            */
             unsigned RefCount = CL_GetRefCount (L);
             unsigned RefIndex;
             for (RefIndex = 0; RefIndex < RefCount; ++RefIndex) {
@@ -1250,10 +1252,10 @@ int CS_IsBasicBlock (CodeSeg* S, unsigned First, unsigned Last)
                 CodeEntry* Ref = CL_GetRef (L, RefIndex);
 
                 /* Walk over out complete range and check if we find the
-                 * refering entry. This is cheaper than using CS_GetEntryIndex,
-                 * because CS_GetEntryIndex will search the complete code
-                 * segment and not just our range.
-                 */
+                ** refering entry. This is cheaper than using CS_GetEntryIndex,
+                ** because CS_GetEntryIndex will search the complete code
+                ** segment and not just our range.
+                */
                 unsigned J;
                 for (J = First; J <= Last; ++J) {
                     if (Ref == CS_GetEntry (S, J)) {
@@ -1262,17 +1264,17 @@ int CS_IsBasicBlock (CodeSeg* S, unsigned First, unsigned Last)
                 }
                 if (J > Last) {
                     /* We did not find the entry. This means that the jump to
-                     * out code segment entry E came from outside the range,
-                     * which in turn means that the given range is not a basic
-                     * block.
-                     */
+                    ** out code segment entry E came from outside the range,
+                    ** which in turn means that the given range is not a basic
+                    ** block.
+                    */
                     CS_ResetMarks (S, First, Last);
                     return 0;
                 }
 
                 /* If we come here, we found the entry. Mark it, so we know
-                 * that the branch to the label is in range.
-                 */
+                ** that the branch to the label is in range.
+                */
                 CE_SetMark (Ref);
             }
         }
@@ -1282,9 +1284,9 @@ int CS_IsBasicBlock (CodeSeg* S, unsigned First, unsigned Last)
     }
 
     /* Third pass: Walk again over the range and check all branches. If we
-     * find a branch that is not marked, its target is not inside the range
-     * (since we checked all the labels in the range before).
-     */
+    ** find a branch that is not marked, its target is not inside the range
+    ** (since we checked all the labels in the range before).
+    */
     I = First;
     while (I <= Last) {
 
@@ -1295,8 +1297,8 @@ int CS_IsBasicBlock (CodeSeg* S, unsigned First, unsigned Last)
         if (E->Info & (OF_UBRA | OF_CBRA)) {
             if (!CE_HasMark (E)) {
                 /* No mark means not a basic block. Before bailing out, be sure
-                 * to remove the marks from the remaining entries.
-                 */
+                ** to remove the marks from the remaining entries.
+                */
                 CS_ResetMarks (S, I+1, Last);
                 return 0;
             }
@@ -1317,18 +1319,18 @@ int CS_IsBasicBlock (CodeSeg* S, unsigned First, unsigned Last)
 
 void CS_OutputPrologue (const CodeSeg* S)
 /* If the given code segment is a code segment for a function, output the
- * assembler prologue into the file. That is: Output a comment header, switch
- * to the correct segment and enter the local function scope. If the code
- * segment is global, do nothing.
- */
+** assembler prologue into the file. That is: Output a comment header, switch
+** to the correct segment and enter the local function scope. If the code
+** segment is global, do nothing.
+*/
 {
     /* Get the function associated with the code segment */
     SymEntry* Func = S->Func;
 
     /* If the code segment is associated with a function, print a function
-     * header and enter a local scope. Be sure to switch to the correct
-     * segment before outputing the function label.
-     */
+    ** header and enter a local scope. Be sure to switch to the correct
+    ** segment before outputing the function label.
+    */
     if (Func) {
         /* Get the function descriptor */
         CS_PrintFunctionHeader (S);
@@ -1347,8 +1349,8 @@ void CS_OutputPrologue (const CodeSeg* S)
 
 void CS_OutputEpilogue (const CodeSeg* S)
 /* If the given code segment is a code segment for a function, output the
- * assembler epilogue into the file. That is: Close the local function scope.
- */
+** assembler epilogue into the file. That is: Close the local function scope.
+*/
 {
     if (S->Func) {
         WriteOutput ("\n.endproc\n\n");
@@ -1383,16 +1385,16 @@ void CS_Output (CodeSeg* S)
         /* Get the next entry */
         const CodeEntry* E = CollConstAt (&S->Entries, I);
         /* Check if the line info has changed. If so, output the source line
-         * if the option is enabled and output debug line info if the debug
-         * option is enabled.
-         */
+        ** if the option is enabled and output debug line info if the debug
+        ** option is enabled.
+        */
         if (E->LI != LI) {
             /* Line info has changed, remember the new line info */
             LI = E->LI;
 
             /* Add the source line as a comment. Beware: When line continuation
-             * was used, the line may contain newlines.
-             */
+            ** was used, the line may contain newlines.
+            */
             if (AddSource) {
                 const char* L = LI->Line;
                 WriteOutput (";\n; ");
@@ -1466,8 +1468,8 @@ void CS_GenRegInfo (CodeSeg* S)
         CurrentRegs = &Regs;
 
         /* Walk over all insns and note just the changes from one insn to the
-         * next one.
-         */
+        ** next one.
+        */
         WasJump = 0;
         for (I = 0; I < CS_GetEntryCount (S); ++I) {
 
@@ -1481,13 +1483,13 @@ void CS_GenRegInfo (CodeSeg* S)
             if (LabelCount > 0) {
 
                 /* Loop over all entry points that jump here. If these entry
-                 * points already have register info, check if all values are
-                 * known and identical. If all values are identical, and the
-                 * preceeding instruction was not an unconditional branch, check
-                 * if the register value on exit of the preceeding instruction
-                 * is also identical. If all these values are identical, the
-                 * value of a register is known, otherwise it is unknown.
-                 */
+                ** points already have register info, check if all values are
+                ** known and identical. If all values are identical, and the
+                ** preceeding instruction was not an unconditional branch, check
+                ** if the register value on exit of the preceeding instruction
+                ** is also identical. If all these values are identical, the
+                ** value of a register is known, otherwise it is unknown.
+                */
                 CodeLabel* Label = CE_GetLabel (E, 0);
                 unsigned Entry;
                 if (WasJump) {
@@ -1509,11 +1511,11 @@ void CS_GenRegInfo (CodeSeg* S)
                     CodeEntry* J = CL_GetRef (Label, Entry);
                     if (J->RI == 0) {
                         /* No register info for this entry. This means that the
-                         * instruction that jumps here is at higher addresses and
-                         * the jump is a backward jump. We need a second run to
-                         * get the register info right in this case. Until then,
-                         * assume unknown register contents.
-                         */
+                        ** instruction that jumps here is at higher addresses and
+                        ** the jump is a backward jump. We need a second run to
+                        ** get the register info right in this case. Until then,
+                        ** assume unknown register contents.
+                        */
                         Done = 0;
                         RC_Invalidate (&Regs);
                         break;
@@ -1554,9 +1556,9 @@ void CS_GenRegInfo (CodeSeg* S)
             CurrentRegs = &E->RI->Out;
 
             /* If this insn is a branch on zero flag, we may have more info on
-             * register contents for one of both flow directions, but only if
-             * there is a previous instruction.
-             */
+            ** register contents for one of both flow directions, but only if
+            ** there is a previous instruction.
+            */
             if ((E->Info & OF_ZBRA) != 0 && (P = CS_GetPrevEntry (S, I)) != 0) {
 
                 /* Get the branch condition */
@@ -1584,8 +1586,8 @@ void CS_GenRegInfo (CodeSeg* S)
 
                     case OP65_CMP:
                         /* If this is an immidiate compare, the A register has
-                         * the value of the compare later.
-                         */
+                        ** the value of the compare later.
+                        */
                         if (CE_IsConstImm (P)) {
                             if (BC == BC_EQ) {
                                 E->RI->Out2.RegA = (unsigned char)P->Num;
@@ -1597,8 +1599,8 @@ void CS_GenRegInfo (CodeSeg* S)
 
                     case OP65_CPX:
                         /* If this is an immidiate compare, the X register has
-                         * the value of the compare later.
-                         */
+                        ** the value of the compare later.
+                        */
                         if (CE_IsConstImm (P)) {
                             if (BC == BC_EQ) {
                                 E->RI->Out2.RegX = (unsigned char)P->Num;
@@ -1610,8 +1612,8 @@ void CS_GenRegInfo (CodeSeg* S)
 
                     case OP65_CPY:
                         /* If this is an immidiate compare, the Y register has
-                         * the value of the compare later.
-                         */
+                        ** the value of the compare later.
+                        */
                         if (CE_IsConstImm (P)) {
                             if (BC == BC_EQ) {
                                 E->RI->Out2.RegY = (unsigned char)P->Num;
@@ -1648,9 +1650,9 @@ void CS_GenRegInfo (CodeSeg* S)
                     case OP65_TAX:
                     case OP65_TXA:
                         /* If the branch is a beq, both A and X are zero at the
-                         * branch target, otherwise they are zero at the next
-                         * insn.
-                         */
+                        ** branch target, otherwise they are zero at the next
+                        ** insn.
+                        */
                         if (BC == BC_EQ) {
                             E->RI->Out2.RegA = E->RI->Out2.RegX = 0;
                         } else {
@@ -1661,9 +1663,9 @@ void CS_GenRegInfo (CodeSeg* S)
                     case OP65_TAY:
                     case OP65_TYA:
                         /* If the branch is a beq, both A and Y are zero at the
-                         * branch target, otherwise they are zero at the next
-                         * insn.
-                         */
+                        ** branch target, otherwise they are zero at the next
+                        ** insn.
+                        */
                         if (BC == BC_EQ) {
                             E->RI->Out2.RegA = E->RI->Out2.RegY = 0;
                         } else {
@@ -1680,6 +1682,3 @@ void CS_GenRegInfo (CodeSeg* S)
     } while (!Done);
 
 }
-
-
-