ASM question
Posted: Mon Jul 24, 2006 6:46 am
Fellow assembly programmers, have one variable and one register. I need to set the last bit of the variable to the last bit of the register. Not knowing a quick way of doing this, I came up with two codes. Which do you think is more efficient? If you know of something better, please post.
Method1:
mov ah,al
and ah,0x80
and byte [KBFlags],0x7f
or byte [KBFlags],ah
Method2:
test al,0x80
jz .setbit
and byte [KBFlags],0x7f
jz .done
.setbit:
or byte [KBFlags],0x80
.done:
Method1:
mov ah,al
and ah,0x80
and byte [KBFlags],0x7f
or byte [KBFlags],ah
Method2:
test al,0x80
jz .setbit
and byte [KBFlags],0x7f
jz .done
.setbit:
or byte [KBFlags],0x80
.done: