Arm Quick Reference

© Timothy Roddis

ARM Instruction Formats
31302928 27262524 23222120 19181716 15141312 11100908 07060504 03020100
Conditional 00I Opcode SRn Rd Operand 2 ALU
Conditional 0000 00AS Rd Rn Rs 1001 Rm Multiply
Conditional 0001 0B00 RsRd 0000 1001 Rm Swap
Conditional 0001 0PS00 1111 Rd 0000 0000 0000 MRS
Conditional 0001 0PS10 1001 1111 0000 0000 Rm MSR(all)
Conditional 00I1 0PS10 1001 1111 Source Operand MSR(flag)
Conditional 01IPr UBWLS Rn Rd Offset LDR/STR
Conditional 011X XXXX XXXX XXXX XXXX XXX1 XXXX Undefined
Conditional 100Pr USWLS Rn Registers (R15-R0) LDM/STM
Conditional 101Ln Offset Branch
Co-processor instructions
Conditional 110Pr UNWLS Rn CRd CP# Offset Transfer
Conditional 1110 CP Op CRn CRd CP# CP0 CRm Op
Conditional 1110 CP OpLS CRn CRd CP# CP1 CRm RTransfer
Conditional 1111 Ignored By ARM SWI
31302928 27262524 23222120 19181716 15141312 11100908 07060504 03020100

Bit fields
AAccumulate - multiply and accumulate
BByte/Word bit - set for byte transfer
IImmediate flag
LnLink bit for branches - set for link
LSLoad/Store bit - set for Load
Bit fields
PrPre/Post incrementing bit - set for pre
PSSR selection bit - set for SPSR_, clear for CPSR
SSet condition flags - PSR bits modified or force user mode if set
UUp/Down bit - set for increment, clear for decrement
WWrite back bit - set for write back into base register

Condition Codes
0000EQEqualZZ=1
0001NENot Equal¬ZZ=0
0010CSCarry SetCC=1
0011NECarry Clear¬CC=0
0100MIMInusNN=1
0101PLPLus¬NN=0
0110VSoVerflow SetVV=1
0111VCoVerflow Clear¬VV=0
Condition Codes
1000HIHIgherC & ¬ZC=1 and Z=0
1001LSLower or Same¬C | ¬ZC=0 or Z=1
1010GEGreater or Equal¬(N ^ V)N=V
1011LTLess ThanN ^ VN<>V
1100GTGreater Than¬Z & ¬(N ^ V)Z=0 and N=V
1101LELess or EqualZ | (N ^ V)Z=1 or N<>V
1110ALALwaysTRUE
1111NVNeVerFALSE

NB: HS (Higher or Same) and LO (LOwer) are synonyms of CS and CC respectively
ALU Operations Codes
0000ANDRd=RnANDOp2Logical ops:
V unaffected
C last bit shifted out
Z if zero
N bit 31
0001EORRd=RnEOROp2
0010SUBRd=Rn-Op2
0011RSBRd=Op2-Rn
0100ADDRd=Rn+Op2
0101ADCRd=Rn+Op2+C
0110SBCRd=Rn-Op2+C-1
0111RSCRd=Op2-Rn+C-1
1000TSTRnANDOp2Arithmetic ops:
V signed overflow
C (addition) carry out of bit 31
C (subtraction) NOT borrow
Z result is zero
N bit 31
1001TEQRnEOROp2
1010CMPRn-Op2
1011CMNRn+Op2
1100ORRRd=RnOROp2
1101MOVRd=Op2
1110BICRd=RnAND¬Op2
1111MVNRd=¬Op2

In ALU Ops
Operand 2
11100908 07060504 03020100
ShiftRmI = 0
RotateImmediateI = 1
In LDR & STR
Offset
11100908 07060504 03020100
ImmediateI = 0
ShiftRmI = 1
In MSR(flags)
Source operand
11100908 07060504 03020100
00000000RmI = 0
RotateImmediateI = 1

Shifts
Shift field
11100908 07060504
Rs0Type0 Bottom byte of Rs specifies shift amount
Shift amountType1 Shift amount is a 5-bit unsigned integer
Type
00logical left
00logical right
00arithmetic right
00rotate right

Registers
26-bit PC and PSRs
31302928 27262524 23222120 19181716 15141312 11100908 07060504 03020100
NZCV IF Program Counter Mode 26-bit
NZCV   IF  Mode xPSR

Processor Modes
M4M3M2M1M0Mode
00000User26
00001FIQ26
00010IRQ26
00011SVC26
00000User
00001FIQ
00010IRQ
00011SVC
00100ABT
00101UND