1

How to take input in main function in mips?

Paul R
  • 208,748
  • 37
  • 389
  • 560
Yanh Huan
  • 153
  • 2
  • 3
  • 6

1 Answers1

1

It depends. If you are going to ask for an integer it should be

li $v0, 5
syscall

If you are going to ask for a float should be

li $v0, 6
syscall

If you are going to ask for a double it should be

li $v0, 7
syscall

And if you are going to ask for an string it should be

li $v0, 8
syscall

But, if you are going to ask for an string and the input is going to take maximum number of characters, then you should use $a1instead of $a0 when printing it.

Ashir
  • 511
  • 2
  • 8
  • 24