MIPS with Mars sim. - how to read a value from a keyboard input automatically (i.e. - no pressing enter to get the value)
Is there a specific sys开发者_开发知识库call or something I am missing in order to accomplish this?
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
精彩评论