bt assembly instruction
When the book says "bit one of location TestMe+8
", the "8
" refers to an address offset, which is measured in bytes. There are 64 bits in 8 bytes, so the 65th bit is bit one of 8 bytes past TestMe
.
- The byte at
TestMe
has bits 7..0 - The byte at
TestMe+1
has bits 15..8 - The byte at
TestMe+2
has bits 23..16 - ...
- The byte at
TestMe+8
has bits 71..64
So "65" refers to "bit 1" (the second counting from the right) of the byte at address TestMe+8
.
bt TestMe, bx
where bx contains 65
is an access 8 bytes (64 bits plus 1) beyond the address of TestMe
. It doesn't copy the byte there, only the second bit in that byte (to the carry flag, CF).