.section .data .equ SYS_READ, 3 .equ SYS_WRITE, 4 .equ SYS_OPEN, 5 .equ SYS_CLOSE, 6 .equ SYS_EXIT, 1
.equ O_READ, 0 .equ O_WRITE, 03101 .equ END_FILE, 0
.equ LINUX_CALL,0x80
.section .bss .lcomm BUFF_DATA, 16
.section .text .globl _start _start: movl %esp, %ebp subl $8, %esp movl $SYS_OPEN, %eax movl 8(%ebp), %ebx movl $O_READ, %ecx movl $0666, %edx int $LINUX_CALL movl %eax, -4(%ebp) movl $SYS_OPEN, %eax movl 12(%ebp), %ebx movl $O_WRITE, %ecx movl $0666, %edx int $LINUX_CALL movl %eax, -8(%ebp) start_loop: movl $SYS_READ, %eax movl -4(%ebp), %ebx movl $BUFF_DATA, %ecx movl $16, %edx int $LINUX_CALL cmpl $END_FILE, %eax jle end_loop movl $SYS_WRITE, %eax movl -8(%ebp), %ebx movl $BUFF_DATA, %ecx int $LINUX_CALL jmp start_loop end_loop: movl $SYS_CLOSE, %eax movl -4(%ebp), %ebx int $LINUX_CALL movl $SYS_CLOSE, %eax movl -8(%ebp), %ebx int $LINUX_CALL movl $1, %eax int $LINUX_CALL
|