【发布时间】:2015-03-06 01:04:12
【问题描述】:
这是我的工作代码:
.section .data
prompt:
.asciz "Please input value:\n"
input:
.asciz "%d"
output:
.asciz "output: %d\n"
integer:
.int
.section .text
.globl main
main:
nop
pushl $prompt
call printf
addl $8, %esp
pushl $integer
pushl $input
call scanf
addl $8, %esp
movl integer, %ecx
pushl %ecx
pushl $output
call printf
add $8, %esp
pushl $0
call exit
如果我改变顺序,为什么会这样:
input:
.asciz "%d"
output:
.asciz "output: %d\n"
integer:
.int
到(其中integer 高于其input)
integer:
.int
input:
.asciz "%d"
output:
.asciz "output: %d\n"
...然后它不再打印出您扫描的整数?是不是因为我们先引用了$integer,然后把它压入栈中?
【问题讨论】:
标签: assembly x86 gnu-assembler att