16 bit Assembly
Home Site Map Instruction Index
The SAR instruction is used to perform an arithmetic shift right, resulting in a signed 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 |
---|---|---|
SAR AL, 1 | ; Shift AL right by 1 bit | D0 F8 |
SAR AL, CL | ; Shift AL right by value of CL | D2 F8 |
SAR AL, 0x03 | ; Shift AL right by 8 bit immediate | C0 F8 03 |
SAR AX, 1 | ; Shift AL right by 1 bit | D1 F8 |
SAR AX, CL | ; Shift AL right by value of CL | D3 F8 |
SAR AX, 0x03 | ; Shift AL right by 8 bit immediate | C1 F8 03 |
SAR [BX], 1 | ; Shift memory address right by 1 bit | D1 3F |
SAR [BX], CL | ; Shift memory address right by value of CL | D3 3F |
SAR [BX], 0x03 | ; Shift memory address right by 8 bit immediate | C1 3F 03 |
SAR [BX+2], 1 | ; Shift memory address right by 1 bit | D1 7F 02 |
SAR [BX+2], CL | ; Shift memory address right by value of CL | D2 7F 02 |
SAR [BX+2], 0x03 | ; Shift memory address right by 8 bit immediate | C1 7F 02 03 |