# An example of using the ADC instruction.
#
# ADC 执行两个无符号或者带符号整数值的加法,并且把前一个ADD产生的进位标志的值包含在其中。
#
.section .data
data1:
.quad 7252051615
data2:
.quad 5732348928
output:
.asciz "The result is %qd\n" # %qd 显示64位带符号整数值
.section .text
.globl main
main:
movl data1, %ebx # 使用变址寻址方式把64位值加载到EAX:EBX 和 ECX:EDX中。
movl data1+4, %eax # data1的低32加载到EBX中,高32位加载到EAX。
movl data2, %edx # data2的低32加载到EDX中,高32位加载到ECX。
movl data2+4, %ecx
addl %ebx, %edx
adcl %eax, %ecx
push %ecx
push %edx
push $output
call printf
addl $12, %esp
push $0
call exit
# gcc -g -o 04 04-adc.s -m32
#
# The result is 12984400543