x86

How does comparing the Sign and Overflow Flag determine operand relationships?

喜你入骨 提交于 2020-11-28 02:19:27
问题 Jump's based on comparing signed integers use the Zero, Sign, and Overflow flag to determine the relationship between operands. After CMP with two signed operands, there are three possible scenario's: ZF = 1 - Destination = Source SF = OF - Destination > Source SF != OF - Destination < Source I'm having trouble understanding scenario 2 and 3. I've worked through the possible combinations and see that they do work - but I still can't figure out why they work. Can anyone explain why a

x86 assembly programming loops with ecx and loop instruction versus jmp + j<condition>

坚强是说给别人听的谎言 提交于 2020-11-27 04:58:29
问题 i'm currently learning x86 assembly language and wondered what is the better way for implementing loops. One way would be to mov a value to ecx register and use the loop instruction and the other way would be using a jmp instruction and then comes the loop body and then a conditional jumping eventually to the beginning of the loop body. I guess the first one will has a better readability but other then that i don't know why to use it. 回答1: When you mention jmp+body+test, I believe you are

x86 assembly programming loops with ecx and loop instruction versus jmp + j<condition>

我们两清 提交于 2020-11-27 04:57:52
问题 i'm currently learning x86 assembly language and wondered what is the better way for implementing loops. One way would be to mov a value to ecx register and use the loop instruction and the other way would be using a jmp instruction and then comes the loop body and then a conditional jumping eventually to the beginning of the loop body. I guess the first one will has a better readability but other then that i don't know why to use it. 回答1: When you mention jmp+body+test, I believe you are

x86 assembly programming loops with ecx and loop instruction versus jmp + j<condition>

核能气质少年 提交于 2020-11-27 04:57:49
问题 i'm currently learning x86 assembly language and wondered what is the better way for implementing loops. One way would be to mov a value to ecx register and use the loop instruction and the other way would be using a jmp instruction and then comes the loop body and then a conditional jumping eventually to the beginning of the loop body. I guess the first one will has a better readability but other then that i don't know why to use it. 回答1: When you mention jmp+body+test, I believe you are

x86 assembly programming loops with ecx and loop instruction versus jmp + j<condition>

孤人 提交于 2020-11-27 04:57:13
问题 i'm currently learning x86 assembly language and wondered what is the better way for implementing loops. One way would be to mov a value to ecx register and use the loop instruction and the other way would be using a jmp instruction and then comes the loop body and then a conditional jumping eventually to the beginning of the loop body. I guess the first one will has a better readability but other then that i don't know why to use it. 回答1: When you mention jmp+body+test, I believe you are

x86 assembly programming loops with ecx and loop instruction versus jmp + j<condition>

心不动则不痛 提交于 2020-11-27 04:57:10
问题 i'm currently learning x86 assembly language and wondered what is the better way for implementing loops. One way would be to mov a value to ecx register and use the loop instruction and the other way would be using a jmp instruction and then comes the loop body and then a conditional jumping eventually to the beginning of the loop body. I guess the first one will has a better readability but other then that i don't know why to use it. 回答1: When you mention jmp+body+test, I believe you are

Subtracting registers with an LEA instruction?

岁酱吖の 提交于 2020-11-25 02:22:44
问题 Does the LEA instruction support negative displacement? mov rax, 1 lea rsi, [rsp - rax] When I use the above code in my asm file I got the error: $ nasm -f macho64 test.asm $ error: invalid effective address I Know that we can do pointer arithmetic like this in C: void foo(char *a, size_t b) { *(a - b) = 1; } then I assume that: lea rsi, [rsp - rax] will work. And I also try to see what the GCC compiler do by using: $ gcc -S foo.c // foo.c has the function foo(above) in it but my asm

Subtracting registers with an LEA instruction?

老子叫甜甜 提交于 2020-11-25 02:22:26
问题 Does the LEA instruction support negative displacement? mov rax, 1 lea rsi, [rsp - rax] When I use the above code in my asm file I got the error: $ nasm -f macho64 test.asm $ error: invalid effective address I Know that we can do pointer arithmetic like this in C: void foo(char *a, size_t b) { *(a - b) = 1; } then I assume that: lea rsi, [rsp - rax] will work. And I also try to see what the GCC compiler do by using: $ gcc -S foo.c // foo.c has the function foo(above) in it but my asm

Subtracting registers with an LEA instruction?

大城市里の小女人 提交于 2020-11-25 02:18:48
问题 Does the LEA instruction support negative displacement? mov rax, 1 lea rsi, [rsp - rax] When I use the above code in my asm file I got the error: $ nasm -f macho64 test.asm $ error: invalid effective address I Know that we can do pointer arithmetic like this in C: void foo(char *a, size_t b) { *(a - b) = 1; } then I assume that: lea rsi, [rsp - rax] will work. And I also try to see what the GCC compiler do by using: $ gcc -S foo.c // foo.c has the function foo(above) in it but my asm

Subtracting registers with an LEA instruction?

时间秒杀一切 提交于 2020-11-25 02:18:21
问题 Does the LEA instruction support negative displacement? mov rax, 1 lea rsi, [rsp - rax] When I use the above code in my asm file I got the error: $ nasm -f macho64 test.asm $ error: invalid effective address I Know that we can do pointer arithmetic like this in C: void foo(char *a, size_t b) { *(a - b) = 1; } then I assume that: lea rsi, [rsp - rax] will work. And I also try to see what the GCC compiler do by using: $ gcc -S foo.c // foo.c has the function foo(above) in it but my asm