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:
245 000004 00 0F 78 mov w0,[w14]
Note:- Line numbers may be repeated.
- Addresses are relative to sections in this module and are not absolute.
- 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 XC-DSC ASSEMBLY Listing: example.1.1.s page 1
Sample dsPIC Assembler Source Code
For illustration only.
1
2 .title " Sample dsPIC Assembler Source Code"
3 .sbttl " For illustration only."
4
5 ; dsPIC registers
6 .equ CORCONL, CORCON
7 .equ PSV,2
8
9 .section .const,psv
10 hello:
11 0000 48 65 6C 6C .ascii "Hello world!\n\0"
11 6F 20 77 6F
11 72 6C 64 21
11 0A 00
12
13 .text
14 .global __reset
15 __reset:
16 ; set PSVPAG to page that contains "hello"
17 000000 00 00 20 mov #psvpage(hello), w0
18 000002 00 00 88 mov w0, PSVPAG
19
20 ; enable Program Space Visibility
21 000004 00 40 A8 bset.b CORCONL,#PSV
22
23 ; make a pointer to "hello"
24 000006 00 00 20 mov #psvoffset(hello), w0
25
26 .end
MPLAB XC-DSC ASSEMBLY Listing: example.1.1.s page 2
Sample dsPIC Assembler Source Code
For illustration only.
DEFINED SYMBOLS
*ABS*:0000000000000011 __TARGET_DIVIDE_CYCLES
*ABS*:0000000000000001 __C30ELF
example.1.1.s:7 *ABS*:0000000000000002 PSV
example.1.1.s:10 .const:0000000000000000 hello
example.1.1.s:15 .text:0000000000000000 __reset
UNDEFINED SYMBOLS
CORCON
PSVPAG
EQUATE SYMBOLS
__TARGET_DIVIDE_CYCLES = 0x11
__C30ELF = 0x1
CORCONL = CORCON
PSV = 0x2