This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Procedure for swapping bits in R0

Good day! Can someone check my code for mistakes? And, if there are mistakes, help me to fix it. This procedure should swap bits in R0 and be 'effective'.

//'n' is bit, that procedure should swap with 'm'
n equ 1
m equ 4
push R0
call swap
swap:
pop R0
push A
mov 20h, R0
mov C, 20h.n
mov 21h.0, C
mov C, 20h.m
mov 20h.n, C
mov C, 21h.0
mov 20h.m, C
mov R0, 20h
pop A
RET

Parents
  • Have you checked it yourself?

    eg, Have you run it in the Simulator to see that it does what you wanted ?

    If you want others to check it, you should provide comments which describe what you expect it to do.

Reply
  • Have you checked it yourself?

    eg, Have you run it in the Simulator to see that it does what you wanted ?

    If you want others to check it, you should provide comments which describe what you expect it to do.

Children