carryflag

Assembly x86-64 setting carry flag for sub instruction

人走茶凉 提交于 2021-01-28 18:00:25
问题 I am working through Richard Detmer's Assembly Language book. The first chapter states: A borrow occurs in the subtraction a - b when b is larger than a as unsigned numbers. Computer hardware can detect a borrow in subtraction by looking at whether a carry occurred in the corresponding addition. If there is no carry in the addition, then there is a borrow in the subtraction. If there is a carry in the addition, then there is no borrow in the subtraction. The carry flag is the 0th bit of the

Assembly x86-64 setting carry flag for sub instruction

老子叫甜甜 提交于 2021-01-28 18:00:19
问题 I am working through Richard Detmer's Assembly Language book. The first chapter states: A borrow occurs in the subtraction a - b when b is larger than a as unsigned numbers. Computer hardware can detect a borrow in subtraction by looking at whether a carry occurred in the corresponding addition. If there is no carry in the addition, then there is a borrow in the subtraction. If there is a carry in the addition, then there is no borrow in the subtraction. The carry flag is the 0th bit of the

Assembly x86-64 setting carry flag for sub instruction

有些话、适合烂在心里 提交于 2021-01-28 17:51:02
问题 I am working through Richard Detmer's Assembly Language book. The first chapter states: A borrow occurs in the subtraction a - b when b is larger than a as unsigned numbers. Computer hardware can detect a borrow in subtraction by looking at whether a carry occurred in the corresponding addition. If there is no carry in the addition, then there is a borrow in the subtraction. If there is a carry in the addition, then there is no borrow in the subtraction. The carry flag is the 0th bit of the

What is the difference between “4 - 12” and “4 + (-12)”? [duplicate]

可紊 提交于 2020-12-26 12:03:20
问题 This question already has answers here : Incomprehensible behavior of the CF flag (2 answers) Why is the Carry Flag set during a subtraction when zero is the minuend? (2 answers) Assembly x86-64 setting carry flag for sub instruction (1 answer) Why does CMP (compare) sometimes sets a Carry Flag in 8086 assembly? (4 answers) Closed last month . I try to compare the next expressions: 1) mov al, 4 mov bl, 12 sub al, bl ; CF == 1 0000 0100 (4) + 1111 0100 (-12) = 1111 1000 (-8 == 248) 2) mov al,

How can i add two numbers with 12 bytes each-one?

有些话、适合烂在心里 提交于 2020-12-26 11:02:10
问题 I want to add two numbers that have 12 bytes and to store the result in a 16 bytes var. How can i do this? section .data big_num1 dd 0x11111111, 0x22222222, 0x33333333 big_num2 dd 0xffffffff, 0x22222222, 0x33333333 section .bss result_4word resd 4 I think i can add the first 4 bytes number from number 1 with the other first 4 bytes from number 2 and so on.. but i don't know how to concatenate results in in my result variable. How should i do the carry,if it's needed? Is this solution the

How can i add two numbers with 12 bytes each-one?

血红的双手。 提交于 2020-12-26 11:00:20
问题 I want to add two numbers that have 12 bytes and to store the result in a 16 bytes var. How can i do this? section .data big_num1 dd 0x11111111, 0x22222222, 0x33333333 big_num2 dd 0xffffffff, 0x22222222, 0x33333333 section .bss result_4word resd 4 I think i can add the first 4 bytes number from number 1 with the other first 4 bytes from number 2 and so on.. but i don't know how to concatenate results in in my result variable. How should i do the carry,if it's needed? Is this solution the

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