Microchip Technology SW006021-1N User Manual
Macro Assembler
2012 Microchip Technology Inc.
DS52053B-page 269
6.6
ASSEMBLY LIST FILES
The assembler will produce an assembly list file if instructed. The xc8 driver option
--ASMLIST
--ASMLIST
is typically used to request generation of such a file, see
The assembly list file shows the assembly output produced by the compiler for both C
and assembly source code. If the assembler optimizers are enabled, the assembly
output may be different to assembly source code and so is still useful for assembly
programming.
and assembly source code. If the assembler optimizers are enabled, the assembly
output may be different to assembly source code and so is still useful for assembly
programming.
The list file is in a human readable form and cannot take any further part in the compi-
lation sequence. It differs from an assembly output file in that it contains address and
op-code data. In addition, the assembler optimizer simplifies some expressions and
removes some assembler directives from the listing file for clarity, although these direc-
tives are included in the true assembly output files. If you are using the assembly list
file to look at the code produced by the compiler, you may wish to turn off the assembler
optimizer so that all the compiler-generated directives are shown in this file. Re-enable
the optimizer when continuing development. Section 4.8.42 “--OPT: Invoke Compiler
Optimizations” gives more information on controlling the optimizers.
lation sequence. It differs from an assembly output file in that it contains address and
op-code data. In addition, the assembler optimizer simplifies some expressions and
removes some assembler directives from the listing file for clarity, although these direc-
tives are included in the true assembly output files. If you are using the assembly list
file to look at the code produced by the compiler, you may wish to turn off the assembler
optimizer so that all the compiler-generated directives are shown in this file. Re-enable
the optimizer when continuing development. Section 4.8.42 “--OPT: Invoke Compiler
Optimizations” gives more information on controlling the optimizers.
Provided the link stage has successfully concluded, the listing file will be updated by
the linker so that it contains absolute addresses and symbol values. Thus you may use
the assembler list file to determine the position of, and exact op codes of, instructions.
the linker so that it contains absolute addresses and symbol values. Thus you may use
the assembler list file to determine the position of, and exact op codes of, instructions.
There is one assembly list file produce by the assembler for each assembly file passed
to it, and so there will be one file produced for all the C source code in a project, includ-
ing p-code based library code. This file will also contains some of the C initialization that
forms part of the runtime startup code. There will also be one file produced for each
assembly source file. There is typically at least one assembly file in each project, that
containing some of the runtime startup file, typically called startup.as.
to it, and so there will be one file produced for all the C source code in a project, includ-
ing p-code based library code. This file will also contains some of the C initialization that
forms part of the runtime startup code. There will also be one file produced for each
assembly source file. There is typically at least one assembly file in each project, that
containing some of the runtime startup file, typically called startup.as.
6.6.1
General Format
The format of the main listing has the form as shown in Figure 6-1.
The line numbers purely relate to the assembly list file and are not associated with the
lines numbers in the C or assembly source files. Any assembly that begins with a semi-
colon indicates it is a comment added by the code generator. Such comments contain
either the original source code which corresponds to the generated assembly, or is a
comment inserted by the code generator to explain some action taken.
lines numbers in the C or assembly source files. Any assembly that begins with a semi-
colon indicates it is a comment added by the code generator. Such comments contain
either the original source code which corresponds to the generated assembly, or is a
comment inserted by the code generator to explain some action taken.
Before the output for each function there is detailed information regarding that function
summarized by the code generator. This information relates to register usage, local
variable information, functions called and the calling function.
summarized by the code generator. This information relates to register usage, local
variable information, functions called and the calling function.
FIGURE 6-1:
GENERAL FORM OF ASSEMBLY LISTING FILE
768
;sp2_inpADC.c: 119: void ADC_start(unsigned char chan)
769
;sp2_inpADC.c: 120: {
770 0243 _ADC_start:
771
771
; Regs used in _ADC_start: [reg0,reg3]
772 0243 00A3 instruction operands
773
773
;sp2_inpADC.c: 121: chan &= 0x07;
774 0244 3007 instruction operands
775 0245 05A3 instruction operands
776
775 0245 05A3 instruction operands
776
;sp2_inpADC.c: 128: }
777 0252 0008 instruction
778
778
; ========= function _ADC_start ends ========
1
2
3
4
5
=
=======
line number
address
op code
source comment
assembly