WhiteTherewasproblem
WhiteTherewasproblem

Reputation: 170

x86 assembly: How does the 'subl' command work in AT&T syntax

%edx has a value of 0x3, and %eax has a value of 0x100. Then we have the instruction: subl %edx, %eax What's the result value of %eax?

Upvotes: 2

Views: 14605

Answers (1)

zx485
zx485

Reputation: 29042

You have

movl $3, %edx
movl $0x100, %eax

as input values. The instruction

subl %edx, %eax

just subtracts 3(dec) in EDX from 100(hex) in EAX resulting in 100h-3h=0FDh.

Upvotes: 11

Related Questions