Question: Assembly Language (NASM) problem My teacher gave me a problem about using the same code from the previous assignment, which is read an input file,

Assembly Language (NASM) problem

My teacher gave me a problem about using the same code from the previous assignment, which is read an input file, and then output to a text file.

This time instead of input and output using int 80h, it should be replace by glibc functions, and other related changes should be made. Also print a character count. This problem requires character I/O, so putchar() and getchar() should be the functions to use. Notice that these functions use type int whereas a character is only one byte. Return values are always in EAX

This is my code for the last assignment:

section .bss Buff resb 1 section .data section .text global _start _start: nop ; This no-op keeps the debugger happy Read: mov eax,3 ; Specify sys_read call mov ebx,0 ; Specify File Descriptor 0: Standard Input mov ecx,Buff ; Pass address of the buffer to read to mov edx,1 ; Tell sys_read to read one char from stdin int 80h ; Call sys_read Exit: mov eax,1 ; Code for Exit Syscall mov ebx,0 ; Return a code of zero to Linux int 80H ; Make kernel call to exit program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!