You are getting the idea. However, there are a few details worth bearing in mind:
- Addresses can and usually are greater than what 8 bits can hold (
cl
is 8-bit,cx
is 16-bit,ecx
is 32-bit,rcx
is 64-bit). So,cl
is likely going to be unequal to the address of the variablebuffer
. It'll only have the least significant 8 bits of the address. - If there are interrupt routines or threads that can preempt the above code and/or access
buffer
, the value inbl
may differ from 5. Broken interrupt routines may actually affect any register when they fail to preserve register values.