You have 3 variables X,Y and Z stored in the following locations X @ 0 times 30 in bank 0 and Y ox31 also in bank 0 and Z at 0 times A0 in bank 1. Earlier in the program X and Y have been loaded with data. That part of the program has already been written and debugged. Now, you have to write a segment of code that will switch X and Y. You may use location Z if you need to without having to save Z.
Expert Answer
;X contains A,Y contains B and W contains M
movwf Z
movf Y,W
movf X,Y
movwf X
movf Z,W
X contains B,Y contains A and W contains M
All others values remain the same except for X and Y as they got switched