funzione read()

Stato
Discussione chiusa ad ulteriori risposte.

Oromis92

Utente Silver
22 Dicembre 2007
102
12
2
84
salve.
vorrei scrivere un semplice programma in assembly (linux) che mi permetta di accettare un input da tastiera e successivamnte stampare a video il risultato. io ho scritto questo:

Codice:
section .data
msg1 db "Please insert a text: ",0x0a
msg1_len equ $ - msg1
msg2 db "You inserted: ",0x0a
msg2_len equ $ - msg2

section .data?
msg3
msg3_len equ $ - msg3

section .text
global _start
_start:

;write
mov eax,4
mov ebx,1
mov ecx,msg1
mov edx,msg1_len
int 0x80

;read
mov eax,3
mov ebx,0
mov ecx,msg3
mov edx,msg3_len
int 0x80

;write
mov eax,4
mov ebx,1
mov ecx,msg2
mov edx,msg2_len
int 0x80

;write
mov eax,4
mov ebx,1
mov ecx,msg3
mov edx,msg3_len
int 0x80

;exit
mov eax,1
mov ebx,0
int 0x80

ma quando lo compilo,linko ed eseguo, ottengo questo:
Codice:
oromis92@localhost:~/Scrivania$ ./input
Please insert a text:
You inserted:

in cosa sbaglio?
è la funzione read?
HELLLPPPP!
 
Stato
Discussione chiusa ad ulteriori risposte.