linux - Reading from a file in assembly -


I am trying to learn assembly - the x86 most useful tutorial in Linux environment that I can find is the work that I Installing itself is simple: read a file and write it on stdout.

I have it:

  section .text; our. Announcement of the text volume global _start; Where should program start _start ;; This is where the code is being exec_ed; Get filename in Ebx pop ebx; Argeque Pop EBX; Argv [0] pop ebay; The first real AGR, a file name; Open file mov eax; 5; Open (mov ecx, 0; read-only mode int 80h;); ; File mov eax, 3; Read (mov ebx, eax; file_descriptor, mov ecx, buf; * buf, mov edx, bufsize; * bufsize int 80h;); ; Write STDOUT mov eax; 4; Write (mov ebay, 1; stdout, mov ecx, buf; * buf int 80h;); ; EX exit; 1; Exit (mov ebx, 0; 0 int 80h;);  

An important problem here is that the tutorial never mentions the formation of a buffer, bufsize variable, or absolutely variable.

How can I do this? (On one hand: At least one hour after the search, I feel surprised at the low quality of resources for learning assembly. The only document is the hearing on 'business on the net'?) << P>

You must declare your buffer in the BSS section and bufsize the data

 < Code> section .data bufsize dw 1024 section .bss buf resb 1024  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -