rmorris7
2014-12-01 12:42:15
Create a MIPS function sendchar that outputs a single character to the secondary UART on our backend machines. The UART (Universal Asynchronous Receiver / Transmitter, aka "serial port") is a member of the venerable 16550 family of UARTs, documented here. Of particular interest to us is section 8 of the specification, starting on page 14, which describes the registers accessible to programmers. The UART control and status registers are memory-mapped, starting with base address 0xB8000400. The second UART is available through the XINU console daemon system by running xinu-console with the name of your mips-console backend followed by a "2". Thus, if running mips-console gave you backend "voc", running xinu-console voc2 in a second terminal window will give you access to voc's secondary UART interface. This main.S calls sendchar function, for which you will implement at the end of the file.
I have this so far
Any help is much appreciated
I have this so far
#include <mips.h>
.text
.globl main
main:
/* Function prolog. */
/* Sets up environment for user program to execute. */
addiu sp, sp, -32 /* Make room on Stack for O/S values. */
sw ra, 28(sp) /* Store O/S return address on Stack. */
/* Start of your program. */
li s0, 0xB8000400 #base address for UART
jal getchar
move s1, v0
move a0, s1
jal sendchar
done: /* End of your program. */
/* Function epilogue. */
/* Restores the environment from the O/S. */
lw ra, 28(sp) /* Restore O/S return address. */
addiu sp, sp, 32 /* Restore O/S stack pointer. */
li v0, 0 /* Return value of 0 (normal exit). */
jr ra /* Return to Operating System. */
//sends character to UART2
//implement the sendchar function below
sendchar:
Any help is much appreciated