Problem 5 Write an assembly program to find the 2s Complemen
Problem 5: Write an assembly program to find the 2’s Complement of the value 85H. Notice that 85H is -123. Use the I/O view tool and PORTD as a destination to store your answer. Explain you answer. Hint: (Use instruction “NEG”)
Problem 6: Write an assembly program to show the output of the following Assembly code. Use the I/O view tool and PORTD as a destination to store your answer. Explain you answer.
LDI R0, 0X40
CLC
ROR R20
ROR R20
ROR R20
ROR R20
OUT PORTD, R20
Solution
5.
CLRF TRISD ; PORT D = OUTPUT
MYREG EQU 0x10
MOVLW 0x85
MOVWF MYREG
NEGF MYREG

