Write an assembly language program to swap the contents of r
Write an assembly language program to swap the contents of register r0 and r1.
Solution
Assembly language program to swap the contents of register r0 and r1:
start
MOV r2, r0 ; the content of r0 is moved to r2, so that r0 is empty now
MOV r0, r1 ; the content of r1 is moved to r0, so that r1 is empty now
MOV r1, r2 ; now move the content of r2 to r1
stop
