Frequently Asked Questions

Why does the .LST file look out of order?

 

The list file is produced to show the assembly code created for the C source code. Each C source line has the corresponding assembly lines under it to show the compiler's work.

 

The following three special cases make the .LST file look strange to the first time viewer. Understanding how the compiler is working in these special cases will make the .LST file appear quite normal and very useful.

 

  1. Stray code near the top of the program is sometimes under what looks like a non-executable source line.

     

    Some of the code generated by the compiler does not correspond to any particular source line. The compiler will put this code either near the top of the program or sometimes under a #USE that caused subroutines to be generated.

     

  2. The addresses are out of order.

     

    The compiler will create the .LST file in the order of the C source code. The linker has re-arranged the code to properly fit the functions into the best code pages and the best half of a code page. The resulting code is not in source order. Whenever the compiler has a discontinuity in the .LST file, it will put a * line in the file. This is most often seen between functions and in places where INLINE functions are called. In the case of a INLINE function, the addresses will continue in order up where the source for the INLINE function is located.

     

  3. The compiler has gone insane and generated the same instruction over and over.

     

    For Example:

     

    ...........A=0; 
    *
    03F: CLRF 15 
    * 
    46: CLRF 15 
    * 
    051: CLRF 15 
    * 
    113: CLRF 15
    

     

    This effect is seen when the function is an INLINE function and is called from more than one place. In the above case, the A=0 line is in a INLINE function called in four places. Each place it is called from gets a new copy of the code. Each instance of the code is shown along with the original source line, and the result may look unusual until the addresses and the * are noticed.


C-Aware IDE Demo
Embedded C Learners Kit
C Workshop Compiler