]> git.sur5r.net Git - cc65/blobdiff - src/cc65/asmcode.c
Move default segment names into segnames.h
[cc65] / src / cc65 / asmcode.c
index dda8ed81b04464c2275b5d9a99b05fa437e884b6..788dd5bece3f9fd0d7c0f339baa6d1d65ab5478a 100644 (file)
@@ -47,7 +47,7 @@
 
 
 /*****************************************************************************/
-/*                                  Code                                    */
+/*                                  Code                                    */
 /*****************************************************************************/
 
 
@@ -55,7 +55,7 @@
 CodeMark GetCodePos (void)
 /* Get a marker pointing to the current output position */
 {
-    return GetCodeEntryCount (CS->Code);
+    return CS_GetEntryCount (CS->Code);
 }
 
 
@@ -63,7 +63,17 @@ CodeMark GetCodePos (void)
 void RemoveCode (CodeMark M)
 /* Remove all code after the given code marker */
 {
-    DelCodeSegAfter (CS->Code, M);
+    CS_DelCodeAfter (CS->Code, M);
+}
+
+
+
+void MoveCode (CodeMark Start, CodeMark End, CodeMark Target)
+/* Move the code between Start (inclusive) and End (exclusive) to
+ * (before) Target.
+ */
+{
+    CS_MoveEntries (CS->Code, Start, End - Start, Target);
 }
 
 
@@ -75,7 +85,7 @@ void WriteOutput (FILE* F)
     SymEntry* Entry;
 
     /* Output the global data segment */
-    CHECK (GetCodeEntryCount (CS->Code) == 0);
+    CHECK (CS_GetEntryCount (CS->Code) == 0);
     OutputSegments (CS, F);
 
     /* Output all global or referenced functions */
@@ -83,14 +93,14 @@ void WriteOutput (FILE* F)
     Entry  = SymTab->SymHead;
     while (Entry) {
                if (IsTypeFunc (Entry->Type)            &&
-           (Entry->Flags & SC_DEF) != 0        &&
-           (Entry->Flags & (SC_REF | SC_EXTERN)) != 0) {
-           /* Function which is defined and referenced or extern */
-           MergeCodeLabels (Entry->V.F.Seg->Code);
-           RunOpt (Entry->V.F.Seg->Code);
-           OutputSegments (Entry->V.F.Seg, F);
-       }
-       Entry = Entry->NextSym;
+                   SymIsDef (Entry)                    &&
+                   (Entry->Flags & (SC_REF | SC_EXTERN)) != 0) {
+                   /* Function which is defined and referenced or extern */
+                   CS_MergeLabels (Entry->V.F.Seg->Code);
+                   RunOpt (Entry->V.F.Seg->Code);
+                   OutputSegments (Entry->V.F.Seg, F);
+               }
+               Entry = Entry->NextSym;
     }
 }