mips - Syscall print int -


i wondering why doesn't work:

print integer:   li $v0, 1              li, $a0, $v0     #with $v0 being added value              syscall 

but, works:

print integer:  li $v0, 1         li, $a0, 100         syscall 

is there register can use print integer has been altered algorithm? thought $v0 register stores returns.

first of all, you've got syntax error here:

li, $a0, $v0 

there should no comma after li.

secondly, purpose of li pseudo-instruction load immediates (e.g. 1, 0x42, or 12345). if want move (copy) contents of 1 register another, use move (as in move $a0, $v0).

and finally, assigned $v0 value 1 on first line of code, if correctly said move $a0, $v0 you'd $a0 = 1. if want previous value of $v0 have move $a0, $v0 before li $v0, 1.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -