Variable help
TC
Posts: 1,019
Hello all,
First, please excuse my vagueness of my question. I can see what I need to do in my head, but it is hard for me to explain what I am talking about.
I am trying to find a way to change the value of a byte sized variable. I have (4) 2-bit sized values that need to make up that byte sized variable.
For example: value_A (2-bits), value_B (2-bits), value_C (2-bits), value_D (2-bits)
I was thinking of along the lines of using "<<=2" to shift the bits 2 places to the left after each value is loaded, but I don't know how I can load my value without changing what I already loaded into the variable.
I hope this makes sense.
Thank you in advance.
First, please excuse my vagueness of my question. I can see what I need to do in my head, but it is hard for me to explain what I am talking about.
I am trying to find a way to change the value of a byte sized variable. I have (4) 2-bit sized values that need to make up that byte sized variable.
For example: value_A (2-bits), value_B (2-bits), value_C (2-bits), value_D (2-bits)
I was thinking of along the lines of using "<<=2" to shift the bits 2 places to the left after each value is loaded, but I don't know how I can load my value without changing what I already loaded into the variable.
I hope this makes sense.
Thank you in advance.
Comments
I can guarantee they are 2-bit values.
start off with
%00000000
load value_A
%00000011
shift to the left 6 places
%11000000
"OR" Value_B
%11000010
shift to the left 4 places
%00100000
Value_A is gone.
Again, I might be over thinking this.
Thank You