With regards to the 2 shifts, couldn't you save the flags register in some other register and then or it back with the flags and look if either set the overflow? Maybe that requires pushing it on the stack?