How to print to the screen from MIPS assembly

user977154 picture user977154 · Apr 26, 2012 · Viewed 7.2k times · Source
.text
emitchar:   

lui $t0,0xffff
polling:
lw  $t1,8($t0)  
andi    $t1,$t1,0x0001
beq $t1,$zero,polling
sw  $a0,0xc($t0)    

.data

I was told this is how to do it but when I run the simulator with the display and keyboard add in I still get not output on the screen. What am I doing wrong?

Answer

Jeff picture Jeff · Apr 26, 2012

Did you click "Connect to MIPS" in the Keyboard window after starting your code? From the Help button:

IMPORTANT NOTE: The Transmitter Controller Ready bit is set to its initial value of 1 only when you click the tool's 'Connect to MIPS' button ('Assemble and Run' in the stand-alone version) or the tool's Reset button! If you run a MIPS program and reset it in MARS, the controller's Ready bit is cleared to 0! Configure the Data Segment Window to display the MMIO address range so you can directly observe values stored in the MMIO addresses given above.