Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When working with QtSpim, where do I see the program output and where can I input values?

I have code that I know works (it was from my professor) but I don't really understand where I 'm supposed to see the program output. I see the registers changing and such (not that I follow it completely) but the program is supposed to ask the user to input a value and I see no way that it is doing this. There is no window popping up to ask me for a value, and QtSpim seems to just be sitting there. I hit run, and step through, but nothing happens.

Here is the code:

# Sample spim program
#

    .data
prompt: .asciiz "Enter in an integer: "
str1:   .asciiz "the answer is: "
newline: .asciiz    "\n"
bye:    .asciiz "Goodbye!\n"
    .globl  main

    .text
main:

    # initialize 
    li  $s0, 10

    # prompt for input
    li  $v0, 4
    la  $a0, prompt
    syscall

    # read in the value
    li  $v0, 5
    syscall
    move    $s0, $v0


loop:   
    # print str1
    li  $v0, 4
    la  $a0, str1
    syscall

    # print loop value
    li  $v0, 1
    move    $a0, $s0
    syscall

    # print newline
    li  $v0, 4
    la  $a0, newline
    syscall

    # decrement loop value and branch if not negative
    sub $s0, $s0, 1
    bgez    $s0, loop

    # print goodbye message
    li  $v0, 4
    la  $a0, bye
    syscall
    jr $ra          # retrun to caller

Screenshot of my QtSpim. Lower left hand corner says 'Running'.. but where?

Screenshot of my QtSpim. Lower left hand corner says 'Running'.. but where?

like image 605
pearbear Avatar asked Dec 28 '25 07:12

pearbear


1 Answers

There should have been a second window opened by default with the title "Console". If it didn't show up, or you accidentally closed it, you can open it up again by checking the Console option in the Window menu.

like image 108
Robert Rouhani Avatar answered Dec 30 '25 22:12

Robert Rouhani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!