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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:09:07+00:00 2026-05-17T23:09:07+00:00

I have the following question here .data a: .asciiz 2021 x: .byte 7,2,12 .text

  • 0

I have the following question here

.data
a: .asciiz "2021"
x: .byte 7,2,12
.text
main: addi $t2, $0, 1
lb $t3, a($t2)

Can someone explain to me, HOW the value of $t3 is 48?

thanks
EDIT this is an another question which is similiar, and is confusing.

.data
a: .word 12,-5,4,0
x: .byte 5
.text
main: addi $t1, $0, 8
lw $t2, a($0)
lw $t3, a($t1)

How will you load word, from index 8, when ‘a’ has a length 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-05-17T23:09:08+00:00Added an answer on May 17, 2026 at 11:09 pm

    Yes, when you add $0 and 1, you get 1, which is put into $t2.

    Then, when you evaluate a($t2), that’s the second byte (offset 1 since it’s based at offset 0) of a which is the “0”, ASCII code 0x30 or 48.


    From various pieces of information:

    ADDI -- Add immediate (with overflow)
    Description:
        Adds a register and a sign-extended immediate value
        and stores the result in a register
    Operation:
        $t = $s + imm; advance_pc (4);
    Syntax:
        addi $t, $s, imm
    
    LB -- Load byte
    Description:
        A byte is loaded into a register from the specified address.
    Operation:
        $t = MEM[$s + offset]; advance_pc (4);
    Syntax:
        lb $t, offset($s)
    

    Register $0 always contains the hardwired value 0. MIPS has established a set of conventions as to how registers should be used. These suggestions are guidelines, which are not enforced by the hardware. However a program that violates them will not work properly with other software.

    Those little snippets should hopefully be enough to explain what it’s doing.


    And, regarding your edit, you’re incorrectly thinking that .word 12,-5,4,0 has a length of 4 bytes. In fact it has a length of 16 bytes since words in MIPS are 32 bits (four bytes) wide.

    So when you load from byte offset 8, you will get the word 4.

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

Sidebar

Related Questions

This is probably a silly question, but here it goes.Imagine you have the following
Probably a stupid question, but here goes. In my view, I have the following
A little stuck here. I have a simple question I guess. Given the following
I have the following question about JPA: Can I save the order of the
Dear g++ hackers, I have the following question. When some data of an object
I have the following question on boost::iostreams . If someone is familiar with writing
this my first question on here. I hope someone can help. It is to
I have a complicated MYSQL query question here. I try my best to explain
Another newbie question here, I have the following Select: SELECT DATEADD(dd, 0, DATEDIFF(dd, 0,
currently I have following code: home.php <form name='myformname' id='myformid'> <input type='text' name='mytext1' value='abc'> <input

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.