go to previous page   go to home page   go to next page

Answer:

Yes, but since much of the code is not from your program single stepping is less interesting.

Example Output

SPIM display

Here is SPIM with the example "hello.asm" program. The simulated console is in the background. In the forground window you can see the initialization code for the trap handler. The trap handler gets control when an executing program generates a trap. This is commonly done by dividing by zero, loading a word from a non-word-aligned address, and similar errors. If (in your actual SPIM window) you scroll down the forground window you will see the code corresponding to the source file "hello.asm". If you look in the DATA section you will see the ascii codes for the string.

QUESTION 7:

What happens if the program were slightly modified, as follows:

main:
        li      $v0,4       # code 4 == print string
        la      $a0,string  # $a0 == address of the string
        addiu   $a0,1       # add one to the address
        syscall             # Invoke the operating system.
        . . .
        .data
string: .asciiz      "Hello SPIM!\n"