"...but I do not know how to set the bit in position..."
Understandable. There are a zillion instructions.
The first one, SHR
(and SHL
, ignored for this discussion) which you have chosen to use, will fiddle the carry flag to contain the bit on the edge (of the source register) that you shifted out.
There is another instruction, RCL
(and RCR
, similarly ignored for this discussion) which will put the carry bit into the bit on the other edge (of the target register) which you will "shift in" so to speak
Do this eight times in a row and you'll have your "reverse-o-matic" procedure done.
Here are two pages that describe these two instructions, including a little picture...
Penguin Explains SHR instruction
Penguin Explains RCL instruction
Hey, this is easy, so, free code, just because I feel nice today...
Mov AL,Some_Number ;Define this somewhere
Sub AH,AH ;Not really needed, placed here to help newcomers understand
SHR AL,1 ;Get the bottom bit (bit #0) from AL
RCL AH,1 ;Put it into the top bit of AH
SHR AL,1 ;Now get bit #1
RCL AH,1 ;Put it into the top bit of AH
SHR AL,1 ;Now get bit #2
RCL AH,1 ;Put it into the top bit of AH
SHR AL,1 ;Now get bit #3
RCL AH,1 ;Put it into the top bit of AH
SHR AL,1 ;Now get bit #4
RCL AH,1 ;Put it into the top bit of AH
SHR AL,1 ;Now get bit #5
RCL AH,1 ;Put it into the top bit of AH
SHR AL,1 ;Now get bit #6
RCL AH,1 ;Put it into the top bit of AH
SHR AL,1 ;Now get bit #7
RCL AH,1 ;Put it into the top bit of AH
Mov Reverse_Pattern,AH ;The pattern is now exactly backwards
Tested it and let us know if this works