codice:
.section .data
nomefile:
.string "testinput.txt"
buff:
.long 1
fd:
.long 0
fd_len:
.long .-fd
hello:
.ascii "Prova"
hello_len:
.long .-hello
.section .text
.global _start
_start:
#Apertura file per lettura
movl $5, %eax
movl $nomefile, %ebx
movl $0, %ecx
int $0x80
movl %eax, fd
#Controllo corretta apertura
cmp $0, %eax
jl end
#Lettura carattere per carattere e scrittura
#loop:
movl $3, %eax
movl fd, %ebx
movl $buff, %ecx
movl $1, %edx
int $0x80
movl %eax, %esi
cmp $0, $buff #Il valore che leggo dalla read lo verrei confronatare con zero
je end
prova:
movl $4, %eax
movl $1 , %ebx
leal hello, %ecx
movl hello_len, %edx
int $0x80
#Chiusura file
end:
movl $1, %eax
movl $0, %ebx
int $0x80