Over the past several months, I have developed several subroutines for such operations as 32-bit by 16-bit division and 17-bit BIN2BCD. Each routine stood alone with its own register labels. For example, the division routine used T0..T3 for the dividend, B0..B3 for the divisor, and R0..R3 for the quotient. Similarly, the BIN2BCD used binU, binH, binL, ones, tens, hund, thou, and tenK. As I integrate those routines into a larger program the number of labels grows. Within each individual subroutine, the label has meaning and improves readability; however, a lot of registers get used that could be reused, but aren't. Most important, Common RAM is quickly exhausted and using General Purpose RAM means more bank shifting.
1) As one option, I could simply use generic labels, such a reg1, reg2, etc. and modify all of the subroutines.
2) As another option, I could keep my descriptive names and re-assign those names to registers in Common RAM (if desirable) using the #define directive.
I understand that reusing registers can be a problem if a register is used in another routine and its value changes as a result of a subroutine.
Assuming I carefully avoid such "re-entry" problems, is there a widely accepted good style for naming such registers?
John
Language= MPASM
Chip= 16F1829
IDE= MPLab 8.92
1) As one option, I could simply use generic labels, such a reg1, reg2, etc. and modify all of the subroutines.
2) As another option, I could keep my descriptive names and re-assign those names to registers in Common RAM (if desirable) using the #define directive.
I understand that reusing registers can be a problem if a register is used in another routine and its value changes as a result of a subroutine.
Assuming I carefully avoid such "re-entry" problems, is there a widely accepted good style for naming such registers?
John
Language= MPASM
Chip= 16F1829
IDE= MPLab 8.92