Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is a question for my assignment, please respond with the correct answers. Use the Arc Tool for this question. Will upvote definitely, thanks! Doing
This is a question for my assignment, please respond with the correct answers. Use the Arc Tool for this question. Will upvote definitely, thanks!
Doing I/O using ARC Memory Mapped I/O ARC does not have any explicit I/O instructions. I/O is then done by reading from and writing to pre-defined memory locations in the memory which are assigned to I/O devices. This is known as memory mapped I/O. Each I/O device has a data port. Similarly, each device has a status port that is used to test the readiness status of the I/O device. For the purpose of this lab, we are interested in using the ARC simulator to use: The console output port to display characters The keyboard input port to read characters 1) Please provide comments for all instructions. 2) What is the memory mapped address for the console output and keyboard input? 3) Please identify the specific line of code that prints to console and reads the keystroke. PART A- Output: Printing character to the display The memory addresses associated with the console output I/O device are: Oxffff0000 is the console (output) data port Oxffff004 is the console (output) status port where bit 7 is the ready flag (0: not ready, 1: ready) Printing a character is achieved by: Checking the ready flag to see if device is ready for printing, i.e., check if the bit 7 of the output status port is set to 1 Storing the character to the output data port ! Prints "Hello, world! " in the message area. .begin BASE COUT .equ Ox3fffco .egu .equ Ox4 !Starting point of the memory mapped region !Oxffff000 Console Data Port !Oxffff0004 Console Status Port COSTAT .org 2048 add %ro, %ro, %r2 add %ro, %ro. %r4 sethi BASE, %r4 Loop: Id [%r2+ String), %3 !Load next char into r3 addcc%r3,%ro,%r3 be End ! stop if null Wait Id [%r4+COSTAT], %r1 andcc%r1, 0x80, %r1 be Wait stb %r3, [%r4+COUT] !Print to console add %r2.4. %r2 !increment String offset (2) ba Loop End: halt !A non-standard instruction to stop the simulator .org 3000 ! The "Hellow, world!" string 0x48, Ox65, Ox6c, Ox6c. Ox6f Ox2c, Ox20, 0x77, 0x6f, Ox72 Ox6c, Ox64, 0x21, Oxoa, o .end String Doing I/O using ARC Memory Mapped I/O ARC does not have any explicit I/O instructions. I/O is then done by reading from and writing to pre-defined memory locations in the memory which are assigned to I/O devices. This is known as memory mapped I/O. Each I/O device has a data port. Similarly, each device has a status port that is used to test the readiness status of the I/O device. For the purpose of this lab, we are interested in using the ARC simulator to use: The console output port to display characters The keyboard input port to read characters 1) Please provide comments for all instructions. 2) What is the memory mapped address for the console output and keyboard input? 3) Please identify the specific line of code that prints to console and reads the keystroke. PART A- Output: Printing character to the display The memory addresses associated with the console output I/O device are: Oxffff0000 is the console (output) data port Oxffff004 is the console (output) status port where bit 7 is the ready flag (0: not ready, 1: ready) Printing a character is achieved by: Checking the ready flag to see if device is ready for printing, i.e., check if the bit 7 of the output status port is set to 1 Storing the character to the output data port ! Prints "Hello, world! " in the message area. .begin BASE COUT .equ Ox3fffco .egu .equ Ox4 !Starting point of the memory mapped region !Oxffff000 Console Data Port !Oxffff0004 Console Status Port COSTAT .org 2048 add %ro, %ro, %r2 add %ro, %ro. %r4 sethi BASE, %r4 Loop: Id [%r2+ String), %3 !Load next char into r3 addcc%r3,%ro,%r3 be End ! stop if null Wait Id [%r4+COSTAT], %r1 andcc%r1, 0x80, %r1 be Wait stb %r3, [%r4+COUT] !Print to console add %r2.4. %r2 !increment String offset (2) ba Loop End: halt !A non-standard instruction to stop the simulator .org 3000 ! The "Hellow, world!" string 0x48, Ox65, Ox6c, Ox6c. Ox6f Ox2c, Ox20, 0x77, 0x6f, Ox72 Ox6c, Ox64, 0x21, Oxoa, o .end StringStep 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