]> git.sur5r.net Git - cc65/blobdiff - src/ca65/segment.h
More lineinfo usage.
[cc65] / src / ca65 / segment.h
index 85f50308b054c50880a158e3eb6a05bc8fff908c..e1e9027831d1cf6b81d0ac18b25ca3fb817a008f 100644 (file)
@@ -6,8 +6,8 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2003 Ullrich von Bassewitz                                       */
-/*               Römerstrasse 52                                             */
+/* (C) 1998-2007 Ullrich von Bassewitz                                       */
+/*               Roemerstrasse 52                                            */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
 /*                                                                           */
@@ -63,13 +63,13 @@ struct Segment {
     unsigned long   FragCount;          /* Number of fragments */
     unsigned        Num;                       /* Segment number */
     unsigned        Align;                     /* Segment alignment */
-    unsigned long   PC;
+    int             RelocMode;          /* Relocatable mode if OrgPerSeg */
+    unsigned long   PC;                 /* PC if in relocatable mode */
+    unsigned long   AbsPC;              /* PC if in local absolute mode */
+                                        /* (OrgPerSeg is true) */
     SegDef*         Def;                /* Segment definition (name and type) */
 };
 
-/* Are we in absolute mode or in relocatable mode? */
-extern int RelocMode;
-
 /* Definitions for predefined segments */
 extern SegDef NullSegDef;
 extern SegDef ZeropageSegDef;
@@ -78,6 +78,9 @@ extern SegDef BssSegDef;
 extern SegDef RODataSegDef;
 extern SegDef CodeSegDef;
 
+/* List of all segments */
+extern Segment* SegmentList;
+
 /* Currently active segment */
 extern Segment* ActiveSeg;
 
@@ -116,7 +119,7 @@ INLINE unsigned GetCurrentSegNum (void)
 #endif
 
 #if defined(HAVE_INLINE)
-INLINE unsigned GetCurrentSegAddrSize (void)
+INLINE unsigned char GetCurrentSegAddrSize (void)
 /* Get the address size of the current segment */
 {
     return ActiveSeg->Def->AddrSize;
@@ -131,14 +134,24 @@ void SegAlign (unsigned Power, int Val);
  * given value.
  */
 
-unsigned GetSegAddrSize (unsigned SegNum);
+unsigned char GetSegAddrSize (unsigned SegNum);
 /* Return the address size of the segment with the given number */
 
 unsigned long GetPC (void);
 /* Get the program counter of the current segment */
 
-void SetAbsPC (unsigned long AbsPC);
-/* Set the program counter in absolute mode */
+int GetRelocMode (void);
+/* Return true if we're currently in relocatable mode */
+
+void EnterAbsoluteMode (unsigned long AbsPC);
+/* Enter absolute (non relocatable mode). Depending on the OrgPerSeg flag,
+ * this will either switch the mode globally or for the current segment.
+ */
+
+void EnterRelocMode (void);
+/* Enter relocatable mode. Depending on the OrgPerSeg flag, this will either
+ * switch the mode globally or for the current segment.
+ */
 
 void SegCheck (void);
 /* Check the segments for range and other errors */
@@ -146,6 +159,9 @@ void SegCheck (void);
 void SegDump (void);
 /* Dump the contents of all segments */
 
+void InitSegments (void);
+/* Initialize segments */
+
 void WriteSegments (void);
 /* Write the segment data to the object file */