Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MIPS Assembly Language Programming Problem: For this exercise, you may not use s

ID: 3569074 • Letter: M

Question

MIPS Assembly Language Programming Problem:

For this exercise, you may not use syscall for input or output, because the program would then block on the input.
Instead, use an interrupt-driven I/O routine to handle all input and output. You must do ALL input and output through the memory-mapped input/output services, NOT through syscall. Nor may you poll for I/O, either.

Write a program that starts with two arrays of characters (.asciiz strings), of equal length (at least 25 characters), labeled 'source' and 'display'. Initially, the source array contains a character string with a ' ' before the terminating NUL. Include upper- and lower-case letters freely. Start your program by copying the source array into the display array. Use a subroutine to do this passing in the addresses of the two arrays on the stack. Use the "real-world" subroutine calling convention. Then set up (enable) interrupts, and then loop examining a variable (which may change inside the interrupt handler) until the user tells the program to quit. Whenever an output ready (transmitter)
interrupt occurs, the interrupt handler will print the next character from the display array, wrapping back to the beginning after it prints the ' '. Whenever the input interrupt (receiver) interrupt occurs, you will extract the user's input and do one of the following tasks depending on the user's input

's': sort the display array using any easy sort routine (bubble or ripple is fine).

't': toggle the case of every alphabetic character (for example, 'T' becomes 't', 't' becomes 'T' and all non-alphabetic characters stay unchanged).

'a': replace the display array elements with the source elements once again.

'r': reverse the elements in the display array (excluding the ' ').

'q': quit -- terminate program execution.

Ignore any other character in input. Handle the commands from the user inside the interrupt handler, not inside the main program.

The 'q' command should just set the variable being queried (repeatedly) by the main program, which will cause the main program to exit with a syscall 10.

Note: an interrupt could happen in the middle of displaying the array, so the characters being
displayed could change mid-line. The primary new feature is the interrupt driven input and output. Instead of reading until you have the entire string (up to NL or CR to stop), you will read and process each character as it arrives. Again, you MAY NOT use syscall for any I/O. This is about three or four pages of code in total.

Also, you should include these codes in your program:

.kdata

save_at: word 0

.ktext 0x80000080

.set noat

.move $k1, $at

.set at

sw $k1, save_at

eret

mfc0

jr $k0

Can someone give me the complete Assemly Language code for this problem?

Explanation / Answer

Microprocessor without Interlocked Pipeline Stages