]> git.sur5r.net Git - cc65/commitdiff
More debugging output
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 4 Jun 2004 14:36:36 +0000 (14:36 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 4 Jun 2004 14:36:36 +0000 (14:36 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3084 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/codeent.c
src/cc65/codeseg.c
src/cc65/codeseg.h

index 3868a353103f7e0b14d80dac9f66ba7441019a1f..a891aeb3d1f863e3f6ede8ff5fd838e42c54f6dd 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2001-2003 Ullrich von Bassewitz                                       */
+/* (C) 2001-2004 Ullrich von Bassewitz                                       */
 /*               Römerstrasse 52                                             */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
@@ -1269,6 +1269,35 @@ static char* RegInfoDesc (unsigned U, char* Buf)
 
 
 
+static char* RegContentDesc (const RegContents* RC, char* Buf)
+/* Return a string containing register contents */
+{
+    char* B = Buf;
+
+    if (RegValIsUnknown (RC->RegA)) {
+        strcpy (B, "A:XX ");
+    } else {
+        sprintf (B, "A:%02X ", RC->RegA);
+    }
+    B += 5;
+    if (RegValIsUnknown (RC->RegX)) {
+        strcpy (B, "X:XX ");
+    } else {
+        sprintf (B, "X:%02X ", RC->RegX);
+    }
+    B += 5;
+    if (RegValIsUnknown (RC->RegY)) {
+        strcpy (B, "Y:XX");
+    } else {
+        sprintf (B, "Y:%02X", RC->RegY);
+    }
+    B += 4;
+
+    return Buf;
+}
+
+
+
 void CE_Output (const CodeEntry* E, FILE* F)
 /* Output the code entry to a file */
 {
@@ -1357,15 +1386,24 @@ void CE_Output (const CodeEntry* E, FILE* F)
        char Use [128];
        char Chg [128];
                fprintf (F,
-                        "%*s; USE: %-12s CHG: %-12s SIZE: %u\n",
+                        "%*s; USE: %-12s CHG: %-12s SIZE: %u",
                         30-Chars, "",
-                RegInfoDesc (E->Use, Use),
-                RegInfoDesc (E->Chg, Chg),
+                RegInfoDesc (E->Use, Use),
+                RegInfoDesc (E->Chg, Chg),
                 E->Size);
-    } else {
-       /* Terminate the line */
-       fprintf (F, "\n");
+
+        if (E->RI) {
+            char RegIn[32];
+            char RegOut[32];
+            fprintf (F,
+                     "    In %s  Out %s",
+                     RegContentDesc (&E->RI->In, RegIn),
+                     RegContentDesc (&E->RI->Out, RegOut));
+        }
     }
+
+    /* Terminate the line */
+    fprintf (F, "\n");
 }
 
 
index 710494cac744533ffcaeb4be76cb58d3161e8e40..8eb594f798903c307c38999accf1d535d39b713f 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2001-2003 Ullrich von Bassewitz                                       */
+/* (C) 2001-2004 Ullrich von Bassewitz                                       */
 /*               Römerstrasse 52                                             */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
@@ -807,7 +807,7 @@ CodeLabel* CS_GenLabel (CodeSeg* S, struct CodeEntry* E)
        /* Attach this label to the code entry */
        CE_AttachLabel (E, L);
 
-    }    
+    }
 
     /* Return the label */
     return L;
@@ -1253,7 +1253,7 @@ void CS_OutputEpilogue (const CodeSeg* S, FILE* F)
 
 
 
-void CS_Output (const CodeSeg* S, FILE* F)
+void CS_Output (CodeSeg* S, FILE* F)
 /* Output the code segment data to a file */
 {
     unsigned I;
@@ -1267,6 +1267,9 @@ void CS_Output (const CodeSeg* S, FILE* F)
        return;
     }
 
+    /* Generate register info */
+    CS_GenRegInfo (S);
+
     /* Output the segment directive */
     fprintf (F, ".segment\t\"%s\"\n\n", S->SegName);
 
@@ -1303,7 +1306,7 @@ void CS_Output (const CodeSeg* S, FILE* F)
            /* Add line debug info */
            if (DebugInfo) {
                fprintf (F, "\t.dbg\tline, \"%s\", %u\n",
-                        GetInputName (LI), GetInputLine (LI));
+                        GetInputName (LI), GetInputLine (LI));
            }
        }
        /* Output the code */
@@ -1314,6 +1317,9 @@ void CS_Output (const CodeSeg* S, FILE* F)
     if (DebugInfo) {
                fputs ("\t.dbg\tline\n", F);
     }
+
+    /* Free register info */
+    CS_FreeRegInfo (S);
 }
 
 
@@ -1463,7 +1469,7 @@ void CS_GenRegInfo (CodeSeg* S)
                        /* A is zero in one execution flow direction */
                        if (BC == BC_EQ) {
                            E->RI->Out2.RegA = 0;
-                       } else {
+                       } else {
                            E->RI->Out.RegA = 0;
                        }
                        break;
@@ -1477,7 +1483,7 @@ void CS_GenRegInfo (CodeSeg* S)
                                E->RI->Out2.RegA = (unsigned char)P->Num;
                            } else {
                                E->RI->Out.RegA = (unsigned char)P->Num;
-                           }
+                           }
                        }
                        break;
 
@@ -1516,7 +1522,7 @@ void CS_GenRegInfo (CodeSeg* S)
                            E->RI->Out2.RegX = 0;
                        } else {
                            E->RI->Out.RegX = 0;
-                       }
+                       }
                        break;
 
                    case OP65_DEY:
index 4a96bb57d4ec7740aff82c5f2ac987d35bbdaa5f..cde8c4ff1c4fc53550dfd003805c7ea94e3e7903 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2001-2003 Ullrich von Bassewitz                                       */
+/* (C) 2001-2004 Ullrich von Bassewitz                                       */
 /*               Römerstrasse 52                                             */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
@@ -275,7 +275,7 @@ void CS_OutputEpilogue (const CodeSeg* S, FILE* F);
  * assembler epilogue into the file. That is: Close the local function scope.
  */
 
-void CS_Output (const CodeSeg* S, FILE* F);
+void CS_Output (CodeSeg* S, FILE* F);
 /* Output the code segment data to a file */
 
 void CS_FreeRegInfo (CodeSeg* S);