Question: entry: ldi r 1 6 , 0 xFF mov r 1 , r 1 6 ldi r 2 2 , 0 x 1 0 ldi
entry:
ldi rxFF
mov r r
ldi rx
ldi rxCC
mov r r
DO NOT EDIT ABOVE THIS LINE
WARNING:
Do not modify the data in the following registers unless specified
by the exercise:
REx
REx
REx
REx
EX:
TASK: Write assembly code to add the numbers and together and
store the resulting sum in register R
CODE: Write your code for Ex above this line.
mov r r
call avremurout
EX:
TASK: Using the "and" instruction, clear only bits and of
register R
CODE: Write your code for Ex above this line.
mov r r
call avremurout
EX:
TASK: Using the "ori" instruction, set only bits and of
register R
CODE: Write your code for Ex above this line.
mov r r
call avremurout
EX:
TASK: Using exactly one instruction, add to the value of R
See AVR Instruction Set Manual Table Arithmetic and Logic
Instructions on p
CODE: Write your code for Ex above this line.
mov r r
call avremurout
EX:
TASK: Write assembly code to add to storing the resulting
sum in register pair R:Rlow byte in R
CODE: Write your code for Ex above this line.
mov r r
call avremurout
mov r r
call avremurout
EX:
TASK: Follow the steps below to complete this exercise.
Encode the decimal value as a two's complement bit number.
Express the result from step as a hexadecimal literal.
Swap the two nibbles of the result from step
Load the result of step into register R
CODE: Write your code for Ex above this line.
mov r r
call avremurout
EX:
TASK: Write assembly code to subtract the value in R from using
the "add" instruction, storing the resulting value in R
CODE: Write your code for Ex above this line.
mov r r
call avremurout
EX:
TASK: Write assembly code to multiply the number by using the
lsl instruction, storing the resulting value in R
CODE: Write your code for Ex above this line.
mov r r
call avremurout
EX:
TASK: Write assembly code to divide the number by using the
"asr" instruction, storing the resulting value in R
CODE: Write your code for Ex above this line.
mov r r
call avremurout
EX:
TASK: Write assembly code to toggle the most significant bit, and
least significant bits of R
CODE: Write your code for Ex above this line.
mov r r
call avremurout
END OF TUTORIAL EXERCISES
DO NOT EDIT BELOW THIS LINE
ldi rx DISPEN PB DISPDP PB
sts x r Set as outputs
sts x r Drive high
break
ldi rx DISPDP PB
ldi rx
loop:
Delay
com r
brne loop
inc r
brne loop
inc r
brne loop
Toggle DP LED
sts x r
rjmp loop Loop indefinitely
This procedure outputs the contents of R when using the emulator.
Address x is reserved in the memory map so this procedure has
no effect when running on the ATtiny hardware.
avremurout:
sts x r
ret
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
