I read the intel manual for the AND command, but am having trouble understanding it's use.
I want to toggle a bit in order to change the video settings of Int 10.
For ex. toggle just the first bit in 000010001b
Thanks.
AND can only be used to clear bits
you want to use XOR - a very commonly used instruction in graphics
in your example XOR the byte with 80h - toggles the high order bit
XOR the byte with 1 - toggles the low order bit
btc also does the job, but it's one byte longer.
Hi,
AND is used to clear a bit. Or is used to set a bit. And
XOR "toggles" a bit.
MOV AL,00010001b ; Bit pattern in AL
AND AL,11111110b ; Clear low bit
; AL is now 00010000b
MOV AL,00010001b ; Bit pattern in AL
OR AL,10000000b ; Set high bit.
; AL is now 10010001b
MOV AL,00010001b ; Bit pattern in AL
XOR AL,10000001b ; Set high bit and low bit.
; AL is now 10010000b
Regards,
Steve