Cannot print out integer in MIPS Assembly program -


I am using QTSpim as my MIPS simulator and I find it difficult to find out that user input . So far, my code is:

  .data prompt: .asciiz "Please enter an integer:" .text main: li $ v0, 4 la $ a0, prompt solicitor $ v0, 5 moves $ s0, $ v0 syscall li $ v0, 5 steps $ s1, $ v0 syscall li $ v0, 5 steps $ s2, $ v0 syscall jal order 3 li $ v0, move $ a0, $ s0 syscall li $ v0 , 10 Syscall Swap: Take $ T, Move $ a0 moves $ a0, $ a1 move $ a1, $ t0 jr $ ra Swap 1: $ $ move, $ a1 move $ a1, $ a2 moves $ a2, $ t0 Jr $ ra order 3: bgt $ a0, $ a1, swap bgt $ a1, $ a2, swap 1 bgt $ a0, $ a1, swap jr $ ra   

Try to print the first integer So I, so it prints a 5 out who should do it. I do not know why this is happening if someone can point out the flaw in my code which is great.

Thank you.

before you syscall the result of syscall Trying to use:

  li $ v0, 5 $ S0, $ v0 syscall   

should be taken: < Pre> li $ v0, 5 syscall $ s0 moves, $ v0

for the other two read_int syscalls too.

Still the fact that your order3 routing is being checked / changed $ a0 .. $ a2 , while your number is $ s0 .. $ s2 is in.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -