18周期,66字节 ;================================= Convert: mov r7,a mov r6,a anl a,#00001111b add a,#(Tab1-$-3) movc a,@a+pc xch a,r7 swap a anl a,#00001111b add a,#(Tab2-$-3) movc a,@a+pc add a,r7 movc a,@a+pc orl a,r6 ret
Tab0: db 00000000b,00000000b,00000000b,00000110b,00000000b,00011110b,00011000b,00011110b db 00000000b,01111110b,01111000b,01111110b,01100000b,01111110b,01111000b,01111110b Tab1: db 2,3,3,3,4,5,5,5,4,5,5,5,4,5,5,5 Tab2: db 0,4,4,4,8,12,12,12,8,12,12,12,8,12,12,12
20周期,54字节 ;============================== Convert: mov r7,a mov r6,a anl a,#00001111b add a,#(Tab1-$-3) movc a,@a+pc xch a,r7 swap a anl a,#00001111b add a,#(Tab1-$-3) movc a,@a+pc rl a rl a add a,r7 movc a,@a+pc orl a,r6 ret Tab1: db 4,5,5,5,6,7,7,7,6,7,7,7,6,7,7,7,0,0 Tab0: db 00000000b,00000000b,00000000b,00000110b,00000000b,00011110b,00011000b,00011110b db 00000000b,01111110b,01111000b,01111110b,01100000b,01111110b,01111000b,01111110b |