Instruction Set
The assembler instruction set includes arithmetic, logical, control, and input/output operations. Arithmetic instructions include addition, subtraction, multiplication, and division. Logical instructions include operations such as AND, OR, XOR, and NOT. Control instructions include jumps, loops, and conditions. Input/output instructions include operations on ports and registers. Understanding the instruction set is crucial for effective programming in assembler. This course will discuss the most commonly used instructions and their application in assembler code. Practical examples will show how to use instructions in AVR programming. The instruction set allows full control over the processor and its functions.
Basic commands
Data Transfer |
ldi | load immediate |
mov | copy register |
movw | copy register pair |
Logical Instructions |
and | logical AND |
andi | logical AND with immediate |
or | logical OR |
ori | logical OR with immediate |
eor | exclusive OR |
com | one's complement |
neg | two's complement |
Arithmetic Instructions |
add | add without carry |
adc | add with carry |
adiw | add immediate to word |
sub | subtract without carry |
subi | subtract immediate |
sbc | subtract with carry |
sbci | subtract immediate with carry |
sbiw | subtract immediate from word |
inc | increment |
dec | decrement |
mul | multiply unsigned(1) |
muls | multiply signed(1) |
mulsu | multiply signed with unsigned(1) |
fmul | fractional multiply unsigned(1) |
fmuls | fractional multiply signed(1) |
fmulsu | fractional multiply signed with unsigned(1) |
(1) Not all processors support commands
Bit Shifts |
lsl | logical shift left |
lsr | logical shift Right |
rol | rotate left through carry |
ror | rotate right through carry |
asr | arithmetic shift right |
Bit Manipulation |
sbr | set bit(s) in register |
cbr | clear bit(s) in register |
ser | set register |
clr | clear register |
swap | swap nibbles |