As discussed in class, the keyboard and display are separate devices, as far as your
MIPS programs are concerned. Each has a status register and a data register. The keyboard
device base address is 0xFFFF0000 and the display device is at
0xFFFF0008. For each device the
status register is at the base address and the data register is in the next word. The ready
bit is the low-order bit (bit 0) of the status register and the interrupt-enable bit is bit 1.
Values that are to be read or written pass through the low-order byte of the data registers.
These are the only bits that are significant in any of the device registers.
typingtest. Prompt the user with the
string Please type: The quick brown fox and all of that.
Read characters from the keyboard and
echo them to the display. If any character is typed incorrectly, immediately start a new
line of output saying Sorry! Try again. and on the next line
display the prompt again. When the
user has correctly typed the string, display Congratulations! on a line
by itself and return from the typingtest function.
Implement functions putchar(c) and getchar()
following the usual MIPS calling convention.
Implement function putstr(s, n) using putchar. (s
is a pointer to a string and n is the number
of characters to display). Use these functions to implement function typingtest().
Do NOT use the syscalls to perform I/O anywhere in this assignment.
putstring(s, n). The
goal is that putstring should return immediately to its caller allowing the
output interrupt handler to write the characters to the display. In
function part2(),
use busy-waiting I/O to read keys from the keyboard. Each time a key is read call
putstring("NN characters have been read so far\n.", len) where NN and len are
filled in with the appropriate values, UNLESS the character is q in which case
return from part2.
You will need to write a decimal conversion function for this part.
Your main program, then, consists of a single call to typingtest() followed by a single call
to part2() followed by an exit syscall.