6.2 Contents

The listing files produced by the assembler are composed of the several elements. The example below shows a sample listing file.

The example listing file contains these elements:

  • Header – contains the name of the assembler, the name of the file being assembled, and a page number. This is not shown if the -an option is specified.
  • Title Line – contains the title specified by the .title directive. This is not shown if the -an option is specified.
  • Subtitle – contains the subtitle specified by the .sbttl directive. This is not shown if the -an option is specified.
  • High-level source if the -ah option is given to the assembler. The format for high-level source is:

    <line #>:<filename> **** <source>

    For example:

    1:hello.c **** #include <stdio.h>

  • Assembler source if the -al option is given to the assembler. The format for assembler source is:

    <line #> <addr> <encoded bytes> <source>

    For example:

    13 000004 02 00 00 D4 rcall _puts

    Note:
    1. Line numbers may be repeated.
    2. Addresses are relative to sections in this module and are not absolute.
    3. Instructions are encoded in “little endian” order.
  • Symbol table if the -as option is given to the assembler. Both, a list of defined and undefined symbols will be given. The defined symbols will have the format:
    DEFINED SYMBOLS
    <filename>:<line #> <section>:<addr> <symbol>

    For example:

    DEFINED SYMBOLS
    foo.s:229 .text:00000000 _main

    The undefined symbols will have the format:

    UNDEFINED SYMBOLS
    <symbol>

    For example:

    UNDEFINED SYMBOLS
    printf

Sample Assembler Listing File

MPLAB XC32 ASSEMBLY Listing:  example.1.1.s 			page 1
 Sample PIC32A Assembler Source Code
 For illustration only.
   1                 	  .title " Sample PIC32A Assembler Source Code"
   2                 	  .sbttl " For illustration only."
   3                 	  
   4                 	  .section .const,code
   5                 	hello:
   6 000000  48 65 6C 6C      .ascii "Hello, World!\n"
   6         6F 2C 20 57 
   6         6F 72 6C 64 
   6         21 0A 
   7 00000e  00 00            
   8                 	  .text
   9                 	  .global __reset
  10                 	__reset:
  11 000000  03 00 00 80      mov.l #hello,w0
  12 000004  02 00 00 D4      rcall _puts
  13 000008  01 72            return
  14                 	  
  15 00000a  00 00            .end

MPLAB XC32 ASSEMBLY Listing:  example.1.1.s 			page 2
 Sample PIC32A Assembler Source Code
 For illustration only.
DEFINED SYMBOLS
                            *ABS*:0000000000000001 __32AK1216GC41064
                            *ABS*:0000000000000001 __PIC32A
                            *ABS*:0000000000000001 __HAS_DSP
                            *ABS*:0000000000000001 __HAS_DMAV2
                            *ABS*:0000000000000005 __TARGET_DIVIDE_CYCLES16
                            *ABS*:0000000000000009 __TARGET_DIVIDE_CYCLES32
                            *ABS*:0000000000000001 __HAS_AA
                            *ABS*:0000000000000001 __HAS_ISA32
                            *ABS*:0000000000000001 __C30ELF
       example.1.1.s:5      .const:0000000000000000 hello
       example.1.1.s:10     .text:0000000000000000 __reset

UNDEFINED SYMBOLS
_puts