]> git.sur5r.net Git - cc65/blobdiff - src/cc65/codeinfo.h
Fixed a bug
[cc65] / src / cc65 / codeinfo.h
index d9a2506a6d8ba0bc054ff5482435dc77f36209f0..55a2e9c18da1cb6675846a626ee887cff49b89b7 100644 (file)
 
 
 /*****************************************************************************/
-/*                                  Data                                    */
+/*                                Forwards                                  */
+/*****************************************************************************/
+
+
+
+struct CodeSeg;
+
+
+
+/*****************************************************************************/
+/*                                  Data                                    */
 /*****************************************************************************/
 
 
 
 /* Defines for registers. */
-#define REG_NONE       0x00U
-#define REG_A          0x01U
-#define REG_X          0x02U
-#define REG_Y          0x04U
-#define REG_SREG_LO    0x08U
-#define REG_SREG_HI    0x10U
-#define REG_TMP1       0x20U
-#define REG_PTR1_LO    0x40U
-#define REG_PTR1_HI    0x80U
+#define REG_NONE               0x0000U
+#define REG_A                  0x0001U
+#define REG_X                  0x0002U
+#define REG_Y                  0x0004U
+#define REG_TMP1               0x0008U
+#define REG_PTR1_LO            0x0010U
+#define REG_PTR1_HI            0x0020U
+#define REG_PTR2_LO     0x0040U
+#define REG_PTR2_HI     0x0080U
+#define REG_SREG_LO            0x0100U
+#define REG_SREG_HI     0x0200U
+#define REG_SAVE_LO     0x0400U
+#define REG_SAVE_HI     0x0800U
+#define REG_SP_LO       0x1000U
+#define REG_SP_HI       0x2000U
+
+
+/* Combined register defines */
+#define REG_PTR1        (REG_PTR1_LO | REG_PTR1_HI)
+#define REG_PTR2        (REG_PTR2_LO | REG_PTR2_HI)
+#define REG_SREG        (REG_SREG_LO | REG_SREG_HI)
+#define REG_SAVE        (REG_SAVE_LO | REG_SAVE_HI)
+#define REG_SP          (REG_SP_LO | REG_SP_HI)
 #define        REG_AX          (REG_A | REG_X)
+#define REG_AY          (REG_A | REG_Y)
 #define REG_XY         (REG_X | REG_Y)
-#define REG_AXY                (REG_A | REG_X | REG_Y)
+#define REG_AXY                (REG_AX | REG_Y)
+#define REG_EAX         (REG_AX | REG_SREG)
+#define REG_EAXY        (REG_EAX | REG_Y)
+#define REG_ZP          0xFFF8U
+#define REG_ALL         0xFFFFU
+
+
+
+/* Zero page register info */
+typedef struct ZPInfo ZPInfo;
+struct ZPInfo {
+    unsigned char  Len;                /* Length of the following string */
+    char           Name[11];    /* Name of zero page symbol */
+    unsigned short ByteUse;     /* Register info for this symbol */
+    unsigned short WordUse;     /* Register info for 16 bit access */
+};
 
 
 
 /*****************************************************************************/
-/*                                          Code                                    */
+/*                                          Code                                    */
 /*****************************************************************************/
 
 
 
-void GetFuncInfo (const char* Name, unsigned char* Use, unsigned char* Chg);
-/* For the given function, lookup register information and combine it with
- * the information already in place. If the function is unknown, assume it
- * will use all registers and load all registers.
+void GetFuncInfo (const char* Name, unsigned short* Use, unsigned short* Chg);
+/* For the given function, lookup register information and store it into
+ * the given variables. If the function is unknown, assume it will use and
+ * load all registers.
+ */
+
+const ZPInfo* GetZPInfo (const char* Name);
+/* If the given name is a zero page symbol, return a pointer to the info
+ * struct for this symbol, otherwise return NULL.
+ */
+
+unsigned GetRegInfo (struct CodeSeg* S, unsigned Index, unsigned Wanted);
+/* Determine register usage information for the instructions starting at the
+ * given index.
  */
 
+int RegAUsed (struct CodeSeg* S, unsigned Index);
+/* Check if the value in A is used. */
+
+int RegXUsed (struct CodeSeg* S, unsigned Index);
+/* Check if the value in X is used. */
+
+int RegYUsed (struct CodeSeg* S, unsigned Index);
+/* Check if the value in Y is used. */
+
+int RegAXUsed (struct CodeSeg* S, unsigned Index);
+/* Check if the value in A or(!) the value in X are used. */
+
 
 
 /* End of codeinfo.h */