Cortex-M0+ Instructions Flashcards
What is the difference between ADD and ADDS?
ADDS will update the condition flags depending on the result of the ADD operation
R0: 4000
R1: 200
ADD R0, R0, R1
What values are in the registers?
R0: 4200
R1: 200
R0: 4000
R1: 200
SUB R0, R1, #100
What values are in the registers?
R0: 100
R1: 200
R0: 4
R1: 2
MULS R1, R0, R1
What values are in the registers?
R0: 4
R1: 8
R0: 4
R1: 2
CMP R0,R1
What are the condition flags?
N:0
Z:0
C:0
V:0
Note: R0-R1
R0: 4
R1: 2
CMP R1,R0
What are the condition flags?
N:1
Z:0
C:0
V:0
Note: R1-R0
When is the N condition flag set?
When the result of an operation is negative.
When is the Z condition flag set?
When the result of an operation is Zero.
When is the C condition flag set?
When an operation results in a carry.
1) When addition result is greater than 32 bits.
2) If subtraction result is zero or positive.
3) As a result of inline barrel shifter operation
When is the V condition flag set?
When an operation results in overflow. When the resulting sign is wrong.
1) If Neg+Neg=Pos
2) If Neg-Pos=Pos
3) If Pos+Pos=Neg
4) If Pos-Neg=Neg
When does the processor enter Handler mode?
When servicing an exception or interrupt.
Thumb Instructions
How long are Full ARM Instruction?
How long are Thumb Insruction?
Full ARM: 32 Bits
Thumb: 16 Bits
What is the difference between Machine Language and Assembly Language?
How do you convert between them?
In Machine Language instructions are represented by numerical values ready to be processed directly by the CPU.
Assembly language is a human readable representation of machine language where instructions have mnemonic names.
Usually we generate Machine language with the help of an Assembler (software tool)
True or False?
Only Load, Store, Pop and Push instructions can access memory.
True.
Other instructions must use operands in registers or using immediate values
True or False?
Immediate values can be any length?
False.
Only between 0 and 255.