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 8886387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:32:48+00:00 2026-06-14T21:32:48+00:00

I made this code for finding LCM of two numbers. It is the starting

  • 0

I made this code for finding LCM of two numbers. It is the starting chunk which is having problems. I tried to find the problem but couldn’t figure it out. It is giving me error of unaligned address and other exceptions when I try to Load word or Store word. Here is the code:

.data

user: .asciiz "enter first number\n"
user2: .asciiz "enter second number\n"

array1: .space 500
array2: .space 500
array3: .space 500

.text

main:

la $a0,user
li $v0,4
syscall

li $v0,5
syscall

move $s0,$v0

la $a0,user2
li $v0,4
syscall

li $v0,5
syscall

move $s1,$v0

li $t0,0
li $t1,0
li $t2,2    
li $t3,3
li $t4,0
li $t5,5
li $t6,7
li $t7,0
li $t8,0
li $t9,0
li $s8,0

la $t8,array1
la $t9,array2

j Loop1



Loop1:

div $s0,$t2

mflo $s2
mfhi $s3 # remainder

beq $s2,1,Loop2

xor $s5,$s3,$0

beq $s5,1,Odd3

add $t4,$t7,$t8

sw $t2,0($t4)  # error

addi $t7,$t7,4


j Loop1

Regards

  • 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. Editorial Team
    Editorial Team
    2026-06-14T21:32:51+00:00Added an answer on June 14, 2026 at 9:32 pm

    If it complains about unaligned address, then you should go look why it’s unaligned. Assemblers are typically smart enough to align data as appropriate, but you are using the .space directive which doesn’t have any type (and hence alignment) information. By chance your strings make the arrays unaligned. You can fix this by manually adding a .align 2 directive before array1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem, and I made this test code to show you my
I have a line, which is a sprite made by using this code CGPoint
I have made this code: var foo=document.createElement(div); var childs=foo.getElementsByTagName(*); console.log(childs.length);//0 OK var a=document.createElement(a); foo.appendChild(a);
I have made this code to open a database(created in SQLite browser) stored in
How can I improve this code? What has made this long winded is the
I am pretty new at C# and .NET, but I've made this code to
I've made this piece of code, it will re-size images on the fly, if
Ok. I've made this awe-crap-code Exporting table to XLS (but still no idea how
I made this little function from code snippets around the net. It does what
I already spent hours on this problem, but I didn't succeed in finding a

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.