how is the combination of << and | gives us the 16-bit offset?
Take H
, an 8-bit register, where H7 is the most significant bit and H0 is the least significant bit:
H7H6H5H4H3H2H1H0
Take L
, an 8-bit register, where L7 is the most significant bit and L0 is the least significant bit:
L7L6L5L4L3L2L1L0
You now want to construct the 16-bit offset that results from combining H
(Highest 8-bits) and L
(Lowest 8-bits.) In C/C++/Java this can be achieved by an 8-bit shift-left <<
followed by a bitwise-or |
as follows:
H = H7H6H5H4H3H2H1H0 H<<8 = H7H6H5H4H3H2H1H00 0 0 0 0 0 0 0 H<<8|L = H7H6H5H4H3H2H1H0L7L6L5L4L3L2L1L0