Write PIC24 assembly language equivalents for the following

Write PIC24 assembly language equivalents for the following C code fragments. Assume variables u16_i, u16_J, u16_k are unit16 variables, while u8_p is uint8 variable. u8_p = (u8_p + 0x20) 4 & 0x0F u16_i = ((u16_k - (unit16)u8_p) >> 4) & 0x0F

Solution

Answer:

1)

mov eax, DWORD PTR [rbp-4]
add eax, 32
sal eax, 2
mov DWORD PTR [rbp-4], eax

2)

mov eax, DWORD PTR [rbp-8]
lea edx, [0+rax*4]
mov eax, DWORD PTR [rbp-12]
add eax, edx
sub eax, 48
mov DWORD PTR [rbp-16], eax

3)

mov eax, DWORD PTR [rbp-8]
sar eax
mov edx, eax
mov eax, DWORD PTR [rbp-4]
add eax, edx
sub eax, 48
mov DWORD PTR [rbp-16], eax

4)

mov eax, DWORD PTR [rbp-16]
sub eax, DWORD PTR [rbp-8]
sar eax, 4
and eax, 15
mov DWORD PTR [rbp-12], eax

5)

mov eax, DWORD PTR [rbp-16]
sub eax, DWORD PTR [rbp-4]
sar eax, 4
and eax, 15
mov DWORD PTR [rbp-12], eax

 Write PIC24 assembly language equivalents for the following C code fragments. Assume variables u16_i, u16_J, u16_k are unit16 variables, while u8_p is uint8 va

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site