Reading an integer into a local variable in MIPS

Mojo_Jojo picture Mojo_Jojo · Aug 1, 2011 · Viewed 34.5k times · Source

How can I read an integer into a local variable in MIPS ? Is it possible? The problem asks me to use the concept of assigning integer variables as local variables. #A question from my text book. And by the way , not a homework!

Thanx in advance! :D

Answer

Patrik picture Patrik · Aug 1, 2011
li $v0, 5
syscall
move $t0, $v0

The value is now in $t0. This will read the integer from the console.