I'm learning 8086 assembly using emu8086, I was playing around with some rotate instructions, and as for my question I know that for more than 1 bit shifts/rotations, the behaviour of the overflow flag OF is undefined.
But when I tried the following code
MOV BH,72H
MOV CL,4
ROL BH,CL
The result is 27H in the BH register, and as for the flags the carry and overflow flag get set to 1, even though the OF shouldnt get set since it's undefined.
Can someone explain how and why the OF got set here please
A flag being undefined means that it is not specified whether it'll be cleared or set. Your emulator decides to set the flag. Another x86 CPU might clear the flag. The behaviour might even vary depending on the operands used or be different each time the instruction is executed. Do not depend on the value of the overflow flag after a
rolinstruction.