# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# MPLAB XC16 C-Compiler

- 1
- 2
…
- 206
- 207
- 208
- 209
- 210
…
- 365
- 366

MPLAB
®
XC16 C Compiler Users Guide
DS50002071C-page 208  2012-2013 Microchip Technology Inc.
16.3 USING INLINE ASSEMBLY LANGUAGE
Within a C function, the asm statement may be used to insert a line of assembly
language code into the assembly language that the compiler generates. Inline
assembly has two forms: simple and extended.
In the simple form, the assembler instruction is written using the syntax:
asm ("instruction");
where instruction is a valid assembly-language construct. If you are writing inline
assembly in ANSI C programs, write __asm__ instead of asm.
In an extended assembler instruction using asm, the operands of the instruction are
specified using C expressions. The extended syntax is:
asm("template" [ : [ "constraint"(output-operand) [ , ... ] ]
[ : [ "constraint"(input-operand) [ , ... ] ]
[ "clobber" [ , ... ] ]
]
]);
You must specify an assembler instruction template, plus an operand constraint
string for each operand. The template specifies the instruction mnemonic, and
optionally placeholders for the operands. The constraint strings specify operand
constraints, for example, that an operand must be in a register (the usual case), or that
an operand must be an immediate value.
Constraint letters and modifiers supported by the compiler are listed in Table 16-1 and
Table respectively.
TABLE 16-1: CONSTRAINT LETTERS SUPPORTED BY THE COMPILER
Note: Only a single string can be passed to the simple form of inline
assembly.
Letter Constraint
a Claims WREG
b Divide support register W1
c Multiply support register W2
d General purpose data registers W1-W14
e Non-divide support registers W2-W14
g Any register, memory or immediate integer operand is allowed, except for
registers that are not general registers.
i An immediate integer operand (one with constant value) is allowed. This
includes symbolic constants whose values will be known only at assembly time.
r A register operand is allowed provided that it is in a general register.
v AWB register W13
w Accumulator register A-B
x x prefetch registers W8-W9
y y prefetch registers W10-W11
z MAC prefetch registers W4-W7
0, 1,  ,
9
An operand that matches the specified operand number is allowed. If a digit is
used together with letters within the same alternative, the digit should come
last.
By default, %n represents the first register for the operand (n). To access the
second, third, or fourth register, use a modifier letter.
T A near or far data operand.
U A near data operand.

- 1
- 2
…
- 206
- 207
- 208
- 209
- 210
…
- 365
- 366