Loops Invert the order of number in base 2 Write an assembly
Loops: Invert the order of number in base 2.
Write an assembly program (PIC18FXX2) that takes a variable A and save into B in inverted bit order. For example, if A= 11001010_2, then program finishes with B = 01010011_2. 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 of Assembly Language.Solution
MOV AL, 10001011B ; MOV CL, 7 MOV DH, 1 MOV DL, 0 loop1: PUSH AX AND AL, DH PUSH CX MOV CL, DL SHR AL, CL POP CX MOV BH, AL SHL BH,CL OR CH,BH DEC CL INC DL SHL DH, 1 POP AX CMP DL, 8 JE END JMP LOOP1 END: