Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/27/05 06:18
Read: times


 
Msg Score: +1
 +1 Informative
#92419 - Debugging large asm programs
I have very recently been involved in debugging a very large (approx 18000 lines of asm code) assembler program written by another programmer. I happened to think, the techniques I used to nail the problem might be helpful to others lost in their own code.

1) Check all instructions having a MOVX @dptr. See that the dptr is initialized to the correct value.
2) Check all instructions having a MOVC a,@dptr if you use it to branch around in your program
3) Check instructions having MOV @r0 or MOV @r1 to check for stack contamination by R0/R1 not being properly initialized
4) Check all djnz instructions to see that all data memory moves are within expected limits. It is possible to destroy variables / stack by overlooking this.
5) Check for balanced PUSH / POP instructions. Imbalance will lead to stack corruption and resultant failure.
6) Check that RETI has been used to end interrupts. Many a times, it is possible that the interrupt ends with a RET instruction by a human error
7) Check usage of register banks. Have you switched it back to
normal after changing it?
8) Double check storage space allocations in RAM. It may be possible, you are intializing/using more than allocated space.

These were some of the things I did to find the problem in the code which used to reset intermittently anywhere after 15 mins to 48 hours. BTW : the problem was a djnz instruction looping to destroy the stack space.

I just hope this post is helpful. I do not wish to think these are the only ways, but it may be very helpful in such large programs.

Jerson

List of 6 messages in thread
TopicAuthorDate
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      

Back to Subject List