MIPS with Mars sim. – how to read a value from a keyboard input automatically (i.e. – no pressing enter to get the value)

assembly, io, mips

Is there a specific syscall or something I am missing in order to accomplish this?

Best Solution

You have to use syscall #12 to read a character.See the MARS syscall sheet for further details.Here goes an example that reads a character from console and prints the next ASCII code char

loop:    li   $v0, 12         syscall            # Read Character  addiu $a0, $v0, 1  # $a0 gets the next char  li   $v0, 11         syscall            # Write Character  b loop  nop