Bit-reverse a byte on 68HC12

前端 未结 9 1600
挽巷
挽巷 2021-01-18 02:03

I\'m in a microprocessors class and we are using assembly language in Freescale CodeWarrior to program a 68HCS12 micro controller. Our assignment this week is to revers a by

9条回答
  •  粉色の甜心
    2021-01-18 03:03

    For example, if you have in al the byte number the easiest way is

    mov al, 10101110
    mov ecx, 8
    

    we put 8 in ecx for loop

    mov ebx, 0 
    

    In bl we will havee the result, we will make ebx, only to see what happens better

    loop1:
    sal al, 1;           
    

    In carry flag now you have the last bit from left

    rcr bl, 1;           
    

    now you add in bl what you have in carry

    loop loop1
    

    and that's all

提交回复
热议问题