Answered step by step
Verified Expert Solution
Question
1 Approved Answer
To allow you to get your feet wet with assembly, here is our first group project: Write an assembly program which prompts the user for
To allow you to get your feet wet with assembly, here is our first group project: Write an assembly program which prompts the user for their name, printing What is your name? and then accepts up to 255 characters of input, and then prints out Hello, name, nice to meet you! followed bya newline. Here's an example transcript: What is your name? Andy Hello, Andy, nice to meet you! You'll have to use both the (=1) and (=0) syscalls. Use the following section (do not modify the section): section . data prompt: db "What is your name? " prompt_len: equ \$-prompt buffer: times 255db '!' resp1: db "Hello, " resp1_len: equ \$-resp1 resp2: db ", nice to meet you!", 10 resp2_len: equ \$-resp2 buffer is the input buffer to pass to the SYS_READ call; it consists of 255 ! characters. Note that will "return" the actual number of bytes read in rax, which you will then have to use when you print out the contents of the buffer. (If you get the length of the input wrong, you'll see either the user's name cut off, or with !!!! s added onto the end of it.) The "fd" parameter to both and is a file descriptor, a number which identifies a file or stream. The standard file descriptors which are always available are You'll have to use both the SYS_WRITE (=1) and SYS_READ (=0) syscalls. Use the following .data section (do not modify the section): buffer is the input buffer to pass to the SYS_READ call; it consists of 255 ! characters. Note that SYS_READ will "return" the actual number of bytes read in rax, which you will then have to use when you print out the contents of the buffer. (If you get the length of the input wrong, you'll see either the user's name cut off, or with !!!! s added onto the end of it.) The "fd" parameter to both SYS_READ and SYS_WRITE is a file descriptor, a number which identifies a file or stream. The standard file descriptors which are always available are So you'll from FD \#O, and to FD \#1 (as we did before). Don't forget to end your program with a (=60) syscall, to gracefully end your program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started