Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 166429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:05:47+00:00 2026-05-11T12:05:47+00:00

I’m working on some MIPS code for my Computer Organizations class, and well I

  • 0

I’m working on some MIPS code for my Computer Organizations class, and well I just can’t seem to get the MIPS to work correctly and there’s not that many MIPS resources online. I’m running the code on PCSPIM. The code is supposed to add 10 to the contents of array2 and store them in array1 and then print array 1. Reworked the code works properly now.

.text main:     la $t0, array1     la $t1, array2     la $s0, valuec     li $s2, 6     add $t6, $zero, 1 #i = 1  Loop:     addi $t6, $t6, 1 #i++      lw  $t2, ($t0)     lw  $t5, ($t1)     lw  $s1, ($s0)     addu $t2, $t5, $s1     sw  $t2, ($t0)     add $t0, $t0, 4     add $t1, $t1, 4     li $v0, 1     move $a0, $t2     syscall     blt $t6, $s2, Loop      li $v0, 10     syscall .data     array1: .space 20     array2: .word 1,2,3,5,9     valuec: .word 10 

PCSPIM prints 0 5 times and returns Exception 7 [Bad data Address] occured and ignored

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T12:05:47+00:00Added an answer on May 11, 2026 at 12:05 pm

    This is homework so I’m only going to give you clues for now and add to it as you go. A couple of things:

    1/ You need to tell us what it’s supposed to do. That’s the most important thing.

    2/ You store array1 address into t0 then reuse t0 within the first loop.

    3/ You appear to be confused about addresses and the contents of those addresses ('la $s0, valuec' and 'addu $t0, $t1, $s0').

    UPDATE:

    Actually I have to sign off for a while, so I’ll post my solution so as to not leave you in the lurch.

    The confusion I referred to before was the fact that you’re loading up two addresses into $t1 and $s0, then adding them together to get another address – this is likely to be well beyond your data area (you should really be adding an address and an offset).

    That’s basically the problem you have with your code (both the zeros being printed and the crash). Your best bet would be to fix that and refer to my code below only as a last resort to see how I would have done it. Copying code will not help you in the long term and you would be wise to assume your educator is also checking all web sites for plagiarism.

    This is the code I’ve come up with (quickly, so you’ll need to test it – it may have bugs). I suggest you read the comments in great detail to understand what it’s doing.

    I’ll be back in a few hours to see how you’re doing. Cheers.

    .text main:  # Initialization of array pointers and loop      la      $t0, array1       # address of array 1     la      $t1, array2       # address of array 2     li      $t2, 1            # element number     li      $t3, 6            # upper limit of elements  # Process each word in array 2, adding 10 and placing # into array 1.  Loop:     lw      $t3, 0($t1)       # get word from array 2     addi    $t3, $t3, 10      # add 10 to word     sw      $t3, 0($t0)       # store word into array 1     addi    $t0, $t0, 4       # move to next entry in array 1 and 2     addi    $t1, $t1, 4     addi    $t2, $t2, 1       # increment element number     blt     $t2, $t3, Loop    # loop until all elements done  # Initialize printing loop by going back to start of array 1      la      $t0, array1       # address of array 1     li      $t2, 1            # element number  # Loop through array 1, printing each element.  pLoop:       lw      $t2, 0($t0)       # get word from array 1     li      $v0, 1            # 'print' command code     move    $a0, $t2          # needs value in $a0     syscall                   # print it     addi    $t0, $t0, 4       # move to next entry in array 1     addi    $t2, $t2, 1       # increment element number     blt     $t2, $t3, Loop    # loop until all elements done      li      $v0, 10           # 'terminate' command code     syscall                   # exit  # Data arrays for array 1 and 2  .data array1: .word 0,0,0,0,0 array2: .word 1,2,3,4,5 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try setting the wmode parameter to transparent swfobject.embedSWF("open-flash-chart.swf", "Dashboard_Chart","800", "400",… May 11, 2026 at 11:40 pm
  • Editorial Team
    Editorial Team added an answer If inheriting doesn't work out, you could also use jQuery… May 11, 2026 at 11:40 pm
  • Editorial Team
    Editorial Team added an answer Specific concepts like, Endianness (this link is to an old… May 11, 2026 at 11:40 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.