typedef struct FuncInfo FuncInfo;
struct FuncInfo {
const char* Name; /* Function name */
- unsigned char Use; /* Register usage */
- unsigned char Chg; /* Changed/destroyed registers */
+ unsigned short Use; /* Register usage */
+ unsigned short Chg; /* Changed/destroyed registers */
};
static const FuncInfo FuncInfoTable[] = {
{ "incax1", REG_AX, REG_AX },
{ "incax2", REG_AX, REG_AX },
{ "incsp1", REG_NONE, REG_NONE },
- { "incsp2", REG_NONE, REG_Y },
+ { "incsp2", REG_NONE, REG_Y },
{ "incsp3", REG_NONE, REG_Y },
{ "incsp4", REG_NONE, REG_Y },
{ "incsp5", REG_NONE, REG_Y },
{ "incsp6", REG_NONE, REG_Y },
{ "incsp7", REG_NONE, REG_Y },
- { "incsp8", REG_NONE, REG_Y },
+ { "incsp8", REG_NONE, REG_Y },
{ "ldaidx", REG_AXY, REG_AX },
{ "ldauidx", REG_AXY, REG_AX },
{ "ldax0sp", REG_Y, REG_AX },
-void GetFuncInfo (const char* Name, unsigned char* Use, unsigned char* Chg)
+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.
-static unsigned char GetRegInfo1 (CodeSeg* S,
- CodeEntry* E,
- int Index,
- Collection* Visited,
- unsigned char Used,
- unsigned char Unused);
+static unsigned GetRegInfo1 (CodeSeg* S,
+ CodeEntry* E,
+ int Index,
+ Collection* Visited,
+ unsigned Used,
+ unsigned Unused);
/* Recursively called subfunction for GetRegInfo. */
-static unsigned char GetRegInfo2 (CodeSeg* S,
- CodeEntry* E,
- int Index,
- Collection* Visited,
- unsigned char Used,
- unsigned char Unused)
+static unsigned GetRegInfo2 (CodeSeg* S,
+ CodeEntry* E,
+ int Index,
+ Collection* Visited,
+ unsigned Used,
+ unsigned Unused)
/* Recursively called subfunction for GetRegInfo. */
{
/* Follow the instruction flow recording register usage. */
while (1) {
- unsigned char R;
+ unsigned R;
/* Check if we have already visited the current code entry. If so,
* bail out.
if (E->JumpTo) {
/* Recursively determine register usage at the branch target */
- unsigned char U1;
- unsigned char U2;
+ unsigned U1;
+ unsigned U2;
U1 = GetRegInfo1 (S, E->JumpTo->Owner, -1, Visited, Used, Unused);
if (U1 == REG_AXY) {
-static unsigned char GetRegInfo1 (CodeSeg* S,
- CodeEntry* E,
- int Index,
- Collection* Visited,
- unsigned char Used,
- unsigned char Unused)
+static unsigned GetRegInfo1 (CodeSeg* S,
+ CodeEntry* E,
+ int Index,
+ Collection* Visited,
+ unsigned Used,
+ unsigned Unused)
/* Recursively called subfunction for GetRegInfo. */
{
/* Remember the current count of the line collection */
unsigned Count = CollCount (Visited);
/* Call the worker routine */
- unsigned char R = GetRegInfo2 (S, E, Index, Visited, Used, Unused);
+ unsigned R = GetRegInfo2 (S, E, Index, Visited, Used, Unused);
/* Restore the old count, unmarking all new entries */
unsigned NewCount = CollCount (Visited);
-unsigned char GetRegInfo (struct CodeSeg* S, unsigned Index)
+unsigned GetRegInfo (struct CodeSeg* S, unsigned Index)
/* Determine register usage information for the instructions starting at the
* given index.
*/
{
- CodeEntry* E;
- Collection Visited; /* Visited entries */
- unsigned char R;
+ CodeEntry* E;
+ Collection Visited; /* Visited entries */
+ unsigned R;
/* Get the code entry for the given index */
if (Index >= CS_GetEntryCount (S)) {
+
/*****************************************************************************/
-/* Data */
+/* 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_SREG_LO 0x0008U
+#define REG_SREG_HI 0x0010U
+#define REG_TMP1 0x0020U
+#define REG_TMP2 0x0040U
+#define REG_TMP3 0x0080U
+#define REG_PTR1_LO 0x0100U
+#define REG_PTR1_HI 0x0200U
+#define REG_PTR2_LO 0x0400U
+#define REG_PTR2_HI 0x0800U
+#define REG_PTR3_LO 0x1000U
+#define REG_PTR3_HI 0x2000U
+#define REG_PTR4_LO 0x4000U
+#define REG_PTR4_HI 0x8000U
#define REG_AX (REG_A | REG_X)
#define REG_EAX (REG_A | REG_X | REG_SREG_LO | REG_SREG_HI)
#define REG_XY (REG_X | REG_Y)
#define REG_AXY (REG_A | REG_X | REG_Y)
#define REG_SREG (REG_SREG_LO | REG_SREG_HI)
#define REG_PTR1 (REG_PTR1_LO | REG_PTR1_HI)
+#define REG_PTR2 (REG_PTR2_LO | REG_PTR2_HI)
+#define REG_PTR3 (REG_PTR3_LO | REG_PTR3_HI)
+#define REG_PTR4 (REG_PTR4_LO | REG_PTR4_HI)
/*****************************************************************************/
-/* Code */
+/* Code */
/*****************************************************************************/
-void GetFuncInfo (const char* Name, unsigned char* Use, unsigned char* Chg);
+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.
int IsZPName (const char* Name);
/* Return true if the given name is a zero page symbol */
-unsigned char GetRegInfo (struct CodeSeg* S, unsigned Index);
+unsigned GetRegInfo (struct CodeSeg* S, unsigned Index);
/* Determine register usage information for the instructions starting at the
* given index.
*/