Encode registers and flags properly.