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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:27:18+00:00 2026-06-02T09:27:18+00:00

Imagine that I have a function in C that has 5 parameter. sum(n1,n2,n3,n4,n5); In

  • 0

Imagine that I have a function in C that has 5 parameter.

sum(n1,n2,n3,n4,n5);

In assembly. I get the first four parameter from registers 4 to 7 and the last parameter is acceded like:

 lw $8, 16($29)

First question

If lw $8, 16($29) puts n5 in register $8, why doesn’t this

lw      $9, 0($29)
lw      $10, 4($29)
lw      $11, 8($29)
lw      $12, 12($29)

puts n1 to n4 in registers $9 to $12?

Second question

Since the parameters in sum(n1,n2,n3,n4,n5); are somewhere stored in memory and in assembly, the first parameter is in $4 how can I get the memory address of $4 to $7?

If i do this:

    .data
array:  .word 3,4,2,6,12,7,18,26,2,14,19,7,8,12,13
    .text
main:
    li  $8,1
    la  $9,array

the last instruction puts the address location of my array in $9. If I do

main:
    li  $4,1
    la  $9,0($4)

The value on $9is still 1 and not the address of $4

  • 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-02T09:27:20+00:00Added an answer on June 2, 2026 at 9:27 am

    First question

    To answer this, you need to understand how parameter-passing is generally handled. There are conventions for parameter passing. The first four parameters are always passed through registers $4 through $7, and the remaining parameters are passed through the stack. There’s no point in passing the first four parameters on the stack if they’re already passed by registers, right? So it only pushes to the stack what’s left after the first four.

    Second question

    There is a distinction between registers and memory. CPU registers aren’t mapped to any memory address. They are special “pieces” of memory that are separate from the rest of your RAM, ROM, etc. They are much faster than the memory in your RAM or ROM, and so there are MIPS instructions that operate directly on them, rather than indirectly through memory addresses.

    Think about exactly what you’re doing:

    main:
        li  $4,1
        la  $9,0($4)
    

    What’s the first instruction doing? It’s loading a value of 1 into register 4.

    What’s the second instruction doing? It’s treating the value inside of register 4 as a label (or an address), adding 0 to it, and storing the result in register 9. So of course register 9 will end up having a value of 1.

    In MIPS, and in nearly all architectures, there is no concept of addressing registers. You operate directly on them.

    EDIT: I should make a distinction between processor registers and hardware registers. Of course, I’m referring to the processor registers. Hardware registers (outside of the CPU) are a slightly different concept, and they explicitly are addressable. However, I think that’s beyond the scope of what Favolas is asking.

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

Sidebar

Related Questions

Imagine you have an entity that has some relations with other entities and you
Imagine that I have a nice Deck class, in the best OO fashion. It
Imagine that i have the following code: <a:repeat value=#{bean.getList()} var=x > <li class=la> <span>
imagine that I have a Form with 9 controls (TabbedStuffControl) in a 3x3 tile,
Let's imagine that I have list of files at host1 find /path/to -name *.jpg
Let's imagine that I have a result of evaluating XPath expression //node/@*. MSXML6 returns
Imagine that HTML page is a game surface (see picture). User can have n
Imagine for a moment that I have a system that allows users to take
Googling this does little good, as you can imagine. Does anyone have resources that
Imagine you have a large dataset that may or may not be filtered by

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.