- /* calculate the label distance : the jump for reladdr can be
- +/- 127 bytes, here I am assuming that an average 8051
- instruction is 2 bytes long, so if the label is more than
- 63 intructions away, the label is considered out of range
- for a relative jump. we could get more precise this will
- suffice for now since it catches > 90% cases */
- dist = (pcDistance (currPl, lbl, TRUE) +
- pcDistance (currPl, lbl, FALSE));
-
-/* changed to 127, now that pcDistance return actual number of bytes */
- if (!dist || dist > 127)
- return FALSE;
+ /* if the previous two instructions are "ljmp"s then don't
+ do it since it can be part of a jump table */
+ if (currPl->prev && currPl->prev->prev &&
+ strstr (currPl->prev->line, "ljmp") &&
+ strstr (currPl->prev->prev->line, "ljmp"))
+ return FALSE;
+
+ /* calculate the label distance : the jump for reladdr can be
+ +/- 127 bytes, here I am assuming that an average 8051
+ instruction is 2 bytes long, so if the label is more than
+ 63 intructions away, the label is considered out of range
+ for a relative jump. we could get more precise this will
+ suffice for now since it catches > 90% cases */
+ dist = (pcDistance (currPl, lbl, TRUE) +
+ pcDistance (currPl, lbl, FALSE));
+
+ /* changed to 127, now that pcDistance return actual number of bytes */
+ if (!dist || dist > 127)
+ return FALSE;
+
+ lbl = getPatternVar (vars, &cmdLine);
+ }
+ while (lbl);