/*
表达式格式:base_address (offset_address, index, size)
计算方法:base_address + offset_address + index * size
注意:offset_address和index的值必须是寄存器
*/
.section .data
output:
.asciz "The value is %d\n"
values:
.int 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60
.section .text
.globl _start
_start:
movl $0, %edi
loop:
movl values(, %edi, 4), %eax
pushl %eax
pushl $output
call printf
addl $8, %esp
inc %edi
cmpl $11, %edi
jne loop
movl $0, %ebx
movl $1, %eax
int $0x80
/*
$ as -o move.o move.s
$ ld -dynamic-linker /lib/ld-linux.so.2 -lc -o move move.o
$ ./move
The value is 10
The value is 15
The value is 20
The value is 25
The value is 30
The value is 35
The value is 40
The value is 45
The value is 50
The value is 55
The value is 60
*/