??? 04/27/05 08:03 Read: times |
#92425 - Pointers Responding to: ???'s previous message |
All these issues are killers in code of any size. Un-initialised pointers (dptr, r0/1) or if they get corrupted are a common problem in any language (that allows pointers!). Unbalanced push/pop is a classic problem. Register banks is a particular trap for 8051 - I normally only use the alternate register banks for specific parts of the code - like interrupts. In the mainline code I avoid using register banks for passing variables etc due to having to keep track of what register bank is selected. One trick passed onto me by a PIC programmer (PICs have many ram banks and code banks) is to have the code/reg/ram bank used as part of the subroutine name thus making it easy to identify what bank is in use or is used. Large code requires more care in writing in that common techniques are used to pass variables. Most of my code is written in 'C' so I follow the compilers rules of register usage and parameter passing for my assembler. Sometimes these methods can be less efficient but I prefer code that works and maybe slow rather than code that crashes quickly! Again, too many people concern themselves with local efficiency rather than global efficiency with the code. Saving microseconds on a routine that gets called once per second probably isn't going to help the operation of the code overall. Obviously there maybe critical sections that need every microsecond shaved - but these are normally a small part of the code overall. |
Topic | Author | Date |
Debugging large asm programs | 01/01/70 00:00 | |
and | 01/01/70 00:00 | |
Using a simulator | 01/01/70 00:00 | |
types of errors | 01/01/70 00:00 | |
Pointers | 01/01/70 00:00 | |
actualy![]() | 01/01/70 00:00 |