x64 Assembly Tutorial 30: Bit Test Instructions

Опубликовано: 15 Март 2026
на канале: Creel
7,410
88

In this tutorial we'll be looking at the Bit Test instructions. There's 4 of them, BT, BTC, BTR and BTS. They all perform a bit test but through using the C/R or S options you can optionally compliment, reset to 0 or set 1, the bit that you test.

These instructions treat all of RAM as a single bit array. For example you could index the 1024th bit from the byte RAX is pointing to with:
mov bx, 1024
bt word ptr [rax], bx

Note that you can't make RAX point to the 6th bit of a byte. x86 and x64 architectures only allow byte addressing.

You can also check bits in a negative direction since the second operand (if it's a register) is seen as signed!