开发者

Reading an integer into a local variable in MIPS

开发者 https://www.devze.com 2023-03-25 15:08 出处:网络
How can I read an integer into a local varia开发者_如何学Pythonble in MIPS? The problem asks me to use the concept of assigning integer variables as local variables. (A question from my text book.)li

How can I read an integer into a local varia开发者_如何学Pythonble in MIPS?

The problem asks me to use the concept of assigning integer variables as local variables. (A question from my text book.)


li $v0, 5              # MARS/SPIM call number 5: read int
syscall                # return value in $v0
move $t0, $v0

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

"local variables" in asm can be registers or stack space.

MARS system-call documentation: http://courses.missouristate.edu/kenvollmar/mars/help/syscallhelp.html

0

精彩评论

暂无评论...
验证码 换一张
取 消