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

  • Home
  • SEARCH
  • 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 8672047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:06:15+00:00 2026-06-12T19:06:15+00:00

The Background I am a student just beginning to learn MIPS for one of

  • 0

The Background

I am a student just beginning to learn MIPS for one of my courses, and my professor is not allowing the usage of pseudo-instructions such as Load Address (la) in our code. I am wondering what an example of the correct usage of standard instructions would look like to store the address of a declared variable into a register for use later in the code.

My Solution

I have currently been attempting to use this code, though I am getting a syntax error in the lui instruction.

main:
.data
    Array:
    .space 80             #Declares that Array will hold 20 integers
.text
    lui  $s0, Array       #loads most significant bits into $s0
    ori  $s0, $s0, Array  #loads least significant bits into $s0

My Question

From what I understand, this should result in the address of Array being placed into $s0. However, as that does not seem to be the case, I’m wondering if anyone would be able to help me out on what I should be doing here.

  • 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-12T19:06:16+00:00Added an answer on June 12, 2026 at 7:06 pm

    You need to refer to a label in the data section in the lui and ori instructions. The following works for gnu assembler (as):

        .data
        Array:
        .space 80             #Declares that Array will hold 20 integers
    ...
    .text
        lui $s0, %hi(Array)
        ori $s0, %lo(Array)
        lw  $s1, 0($s0)       # load 1st word of Array
    ...
    

    The %hi and %lo directives tell the linker what is going on, so that it can put the address of the label “Array” in the machine code. (NOTE: this likely doesn’t work for SPIM or MARS.)

    See this question.

    See MIPS Run is the canonical book on MIPS CPUs. This book explains the MIPS instruction set, CPU architecture and how they relate to MIPS Linux.

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

Sidebar

Related Questions

The Issue Just to give you some background, I'm currently enrolled as a student
I'm just beginning to learn about the differences between how css (and html) is
I am a student with a mainly electronics background getting into programing. The more
Background I am working with a monad built of a stack of transformers one
First a little background: - I'm a first time poster, a student in university
I am a student attempting to learn VB.NET on my own. Today I wanted
I'm starting to learn Lisp with a Java background. In SICP's exercise there are
Background I'm a first year CS student and I work part time for my
In my iPhone application, there is one options to pick a student name from
Just a background since I am used to using JDBC since I worked on

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.