16 bit Assembly

Home   Site Map   Instruction Index  


SHR   - Shift Right Instruction

The SHR instruction is used to perform a logical shift right, resulting in a division.

This command has 3 part the Instruction, A Register or memory address, and the number of bits to shift right.

As each bit is shifted, it passes in to the Carry flag, where it can be assessed using a conditional jump JC or JNC.

As each bit moves right the highest bit becomes zero.

Assembly Sample Description 16 bit
Machine Code
SHR AL, 1;  Shift AL right by 1 bit   D0 E8
SHR AL, CL;  Shift AL right by value of CL   D2 E8
SHR AL, 0x03 ;  Shift AL right by 8 bit immediate   C0 E8 03
SHR AX, 1;  Shift AL right by 1 bit   D1 E8
SHR AX, CL ;  Shift AL right by value of CL   D3 E8
SHR AX, 0x03 ;  Shift AL right by 8 bit immediate   C1 E8 03
SHR [BX], 1;  Shift memory address right by 1 bit   D0 2F
SHR [BX], CL;  Shift memory address right by value of CL   D2 2F
SHR [BX], 0x03 ;  Shift memory address right by 8 bit immediate   C1 2F 03
SHR [BX+2], 1;  Shift memory address right by 1 bit   D1 6F 02
SHR [BX+2], CL ;  Shift memory address right by value of CL   D3 6F 02
SHR [BX+2], 0x03 ;  Shift memory address right by 8 bit immediate   C1 6F 02 03




Last Update 11/02/2023