2.3.1 Source File

The assembler accepts, as input, a source file that consists of 32-bit MCU device instructions, assembler directives and comments. A sample source file is shown below.

Note: Microchip Technology strongly suggests an .s extension for assembly source files. This will enable you to easily use the C compiler driver without having to specify the option to tell the driver that the file should be treated as an assembly file. See the MPLAB® XC32 C Compiler User’s Guide for PIC32A MCU (DS-50003831) for more details on the C compiler driver.

For more information, see Command-Line Syntax and Assembler Directives.

Sample Assembler Code

.title " Sample Assembler Source Code"
    .sbttl "  (for PIC32A devices)"
;;
;; ___delay32
;;
;; 32-bit cycle delay
;;
;; inputs:
;;   w0 = delay in cycles (min == 12, including call)
;;
;; outputs: none
;; registers used: w0
;;
    .section .libc.delay32, code
    .global ___delay32
___delay32:
    sub.l #3,w0
    bra lt, 1f
    repeat w0
    nop