Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a PIC18Fxx2 assembly program that takes the variable A and save into B in

ID: 3839213 • Letter: W

Question

Write a PIC18Fxx2 assembly program that takes the variable A and save into B in inverted the bit order. For example, if A 110010102, then the program finishes with B 010100112. The variable A shall preserve the original value at the end of the program execution. The program shall be implemented using any of the loop and shift techniques discussed in class Write a PIC18Fxx2 assembly program that makes the calculus of the first ten (10) terms of the Fibonacci series. This is define by F_n = F_n-1 F_n-2, with initial values F_0 = 0, and F_1 = 1. If the following code implements de series in C language This program calculates Fibonacci numbers within an 8-bit range. #include unsigned char fibo;//fn-2 unsigned char fibl//fn-1 unsigned char fib2//fn unsigned char n;//series current value void main (void) loop: fib = 0 fib1 = 1; n = 2;//the first two numbers are known, so start at n = 2 do {fib2 = fib1 = fib0; printf ("Values: n:/%u, fn-2:/%u, fn-1: %u, fn:/%u/n", n, fibo, fibl, fib2); n + =1;//update numbers held discarding f_n-2 fibo = fibli;//first overwrite f_n-2 fib1 = fib2;} while (n0); goto loop;}

Explanation / Answer

.LC0:
.string "Enter the limit : "
.LC1:
.string "%d"
.LC2:
.string " The fibonacci series is : "
.LC3:
.string "%d "
.LC4:
.string " The sum of the fibonacci series is : %d"
main:
push rbp
mov rbp, rsp
sub rsp, 32
mov DWORD PTR [rbp-4], -1
mov DWORD PTR [rbp-8], 1
mov DWORD PTR [rbp-20], 0
mov DWORD PTR [rbp-16], 0
mov edi, OFFSET FLAT:.LC0
mov eax, 0
call printf
lea rax, [rbp-24]
mov rsi, rax
mov edi, OFFSET FLAT:.LC1
mov eax, 0
call scanf
mov edi, OFFSET FLAT:.LC2
call puts
mov DWORD PTR [rbp-12], 1
.L3:
mov eax, DWORD PTR [rbp-24]
cmp DWORD PTR [rbp-12], eax
jg .L2
mov edx, DWORD PTR [rbp-4]
mov eax, DWORD PTR [rbp-8]
add eax, edx
mov DWORD PTR [rbp-20], eax
mov eax, DWORD PTR [rbp-20]
mov esi, eax
mov edi, OFFSET FLAT:.LC3
mov eax, 0
call printf
mov eax, DWORD PTR [rbp-20]
add DWORD PTR [rbp-16], eax
mov eax, DWORD PTR [rbp-8]
mov DWORD PTR [rbp-4], eax
mov eax, DWORD PTR [rbp-20]
mov DWORD PTR [rbp-8], eax
add DWORD PTR [rbp-12], 1
jmp .L3
.L2:
mov eax, DWORD PTR [rbp-16]
mov esi, eax
mov edi, OFFSET FLAT:.LC4
mov eax, 0
call printf
mov eax, 0
leave
ret

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote