eflags

Incomprehensible behavior of the CF flag

我的梦境 提交于 2020-12-23 18:10:42
问题 Let's say there is a piece of code: mov al, 12 mov bl, 4 sub al, bl In this case, the CF = 0 flag, but in my opinion it should be equal to 1, since the subtraction operation is implemented on an addition operation and the processor does not know what we are giving it as input, be it signed or unsigned numbers, it just does its job. That is, the code above is equivalent to the following: Enter the value 12 into the al register, i.e. 0000 1100 Enter the value 4 into the bl register, i.e. 0000

Incomprehensible behavior of the CF flag

我的未来我决定 提交于 2020-12-23 18:09:51
问题 Let's say there is a piece of code: mov al, 12 mov bl, 4 sub al, bl In this case, the CF = 0 flag, but in my opinion it should be equal to 1, since the subtraction operation is implemented on an addition operation and the processor does not know what we are giving it as input, be it signed or unsigned numbers, it just does its job. That is, the code above is equivalent to the following: Enter the value 12 into the al register, i.e. 0000 1100 Enter the value 4 into the bl register, i.e. 0000

Incomprehensible behavior of the CF flag

好久不见. 提交于 2020-12-23 18:01:02
问题 Let's say there is a piece of code: mov al, 12 mov bl, 4 sub al, bl In this case, the CF = 0 flag, but in my opinion it should be equal to 1, since the subtraction operation is implemented on an addition operation and the processor does not know what we are giving it as input, be it signed or unsigned numbers, it just does its job. That is, the code above is equivalent to the following: Enter the value 12 into the al register, i.e. 0000 1100 Enter the value 4 into the bl register, i.e. 0000

Incomprehensible behavior of the CF flag

你说的曾经没有我的故事 提交于 2020-12-23 17:58:51
问题 Let's say there is a piece of code: mov al, 12 mov bl, 4 sub al, bl In this case, the CF = 0 flag, but in my opinion it should be equal to 1, since the subtraction operation is implemented on an addition operation and the processor does not know what we are giving it as input, be it signed or unsigned numbers, it just does its job. That is, the code above is equivalent to the following: Enter the value 12 into the al register, i.e. 0000 1100 Enter the value 4 into the bl register, i.e. 0000

Incomprehensible behavior of the CF flag

北城余情 提交于 2020-12-23 17:58:26
问题 Let's say there is a piece of code: mov al, 12 mov bl, 4 sub al, bl In this case, the CF = 0 flag, but in my opinion it should be equal to 1, since the subtraction operation is implemented on an addition operation and the processor does not know what we are giving it as input, be it signed or unsigned numbers, it just does its job. That is, the code above is equivalent to the following: Enter the value 12 into the al register, i.e. 0000 1100 Enter the value 4 into the bl register, i.e. 0000

Incomprehensible behavior of the CF flag

半腔热情 提交于 2020-12-23 17:53:20
问题 Let's say there is a piece of code: mov al, 12 mov bl, 4 sub al, bl In this case, the CF = 0 flag, but in my opinion it should be equal to 1, since the subtraction operation is implemented on an addition operation and the processor does not know what we are giving it as input, be it signed or unsigned numbers, it just does its job. That is, the code above is equivalent to the following: Enter the value 12 into the al register, i.e. 0000 1100 Enter the value 4 into the bl register, i.e. 0000

What is the purpose of the Parity Flag on a CPU?

一个人想着一个人 提交于 2020-11-30 08:28:31
问题 Some CPUs (notably x86 CPUs) feature a parity flag on their status register. This flag indicates whether the number of bits of the result of an operation is odd or even. What actual practical purpose does the parity flag serve in a programming context? Side note: I'm presuming it's intended to be used in conjunction with a parity bit in order to perform basic error checking, but such a task seems to uncommon to warrant an entire CPU flag. 回答1: Back in the "old days" when performance was

What is the purpose of the Parity Flag on a CPU?

有些话、适合烂在心里 提交于 2020-11-30 08:23:12
问题 Some CPUs (notably x86 CPUs) feature a parity flag on their status register. This flag indicates whether the number of bits of the result of an operation is odd or even. What actual practical purpose does the parity flag serve in a programming context? Side note: I'm presuming it's intended to be used in conjunction with a parity bit in order to perform basic error checking, but such a task seems to uncommon to warrant an entire CPU flag. 回答1: Back in the "old days" when performance was

What is the purpose of the Parity Flag on a CPU?

家住魔仙堡 提交于 2020-11-30 08:22:45
问题 Some CPUs (notably x86 CPUs) feature a parity flag on their status register. This flag indicates whether the number of bits of the result of an operation is odd or even. What actual practical purpose does the parity flag serve in a programming context? Side note: I'm presuming it's intended to be used in conjunction with a parity bit in order to perform basic error checking, but such a task seems to uncommon to warrant an entire CPU flag. 回答1: Back in the "old days" when performance was

How can I set or clear overflow flag in x86 assembly?

谁说我不能喝 提交于 2019-12-29 01:49:06
问题 I want to write a simple code (or algorithm) to set/clear overflow flag. For setting OF, I know that I can use signed values. But how can I clear that? 回答1: There are many possible solutions. For instance, test al, al will clear the OF flag without affecting register contents. Or, if you don't want to affect the other flags, you can just directly modify the *FLAGS register. For example, in 32-bit, this would look like: pushfd ; Push EFLAGS onto the stack and dword [esp], ~0x800 ; Clear bit 11