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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:51:58+00:00 2026-06-12T11:51:58+00:00

So I am working on a project right now where we have to take

  • 0

So I am working on a project right now where we have to take in a string and convert it to all uppercase letters and then to lowercase letters if either the toUpper or toLower byte is anything but 0. Right now I am still working on the uppercase portion (guessing the lowercase will be almost the same) but I am getting stuck either when I am going through the string to find the letters that are uppercase or when I am calling the syscall to print. Any help would be great. Here’s what I have so far:

    .data

    toUpper: .byte   1
    toLower: .byte   0

    string:
        .asciiz "   A long time ago in a Galaxy far, far away...."

# Your code goes below this line

    origString:
        .asciiz "Original string:\n"

    toUpForwardStr:
        .asciiz "\nConverted to upper-case:\nForward:\n"

    toLowerForwardStr:
        .asciiz "\nConverted to lower-case:\nForward:\n"

    backwardStr:
        .asciiz "Backward:"

.text



main:   
    # Function prologue
    subu    $sp, $sp, 24                    # allocate stack space -- default of 24 here
    sw      $fp, 0($sp)                     # save caller's frame pointer
    sw      $ra, 4($sp)                     # save return address
    addiu   $fp, $sp, 20                    # setup main's frame pointer

    la      $a0, origString             #Print "Original String:"
    addi    $v0, $zero, 4
    syscall

    la      $a0, string                 #Print string
    addi    $v0, $zero, 4
    syscall

    la      $s0, toUpper
    sb      $s1, 0($s0)                 #toUpper stored in $s1

    la      $s0, toLower
    sb      $s2, 0($s0)                 #toLower stored in $s2

    bne     $s1, $zero, toUpperCase     #Jump toUpperCase if toUpper ≠ 0



    toUpperCase:
        la      $a0, toUpForwardStr     #Print "Converted to upper-case:"
        addi    $v0, $zero, 4               #      "Forward:"
        syscall

        la      $s3, string             #$s3 holds address to string

        addi    $s1, $zero, 0               #$s1 = i = 0

        j   upperCaseLoop                   #Goto upperCaseLoop

        upperCaseLoop:

            # Compute address of string[i]

            add     $t2, $s3, $s1           # $t2 = address of string[i]
            lb      $t3, 8($t2)             # $t3 = elements[i]

            beq     $t3, $zero, upperDone   # test if for loop is done

            addi    $t6, $zero, 96          #$t6 = 96 (lowercase letters)
            bgt     $t3, $t6, isLowercase1#If letter is lowercase goto isLowercase1

            comeBackFromLowercaseIfs:

            move    $t3, $a0
            addi    $v0, $zero, 11
            syscall




            addi    $s1, $s1, 1             # i++
            j       upperCaseLoop

    upperDone:

    bne     $s2, $zero, toLowerCase     #Jump toLowerCase if toLower ≠ 0


    toLowerCase:

        la      $a0, toLowerForwardStr  #Print "Converted to lower-case:"
        addi    $v0, $zero, 4               #      "Forward:"
        syscall
        j       done                        #The END!!







    isLowercase1:
        addi    $t7, $zero, 123         #$t7 = 123
        blt     $t3, $t7, isLowercase2  #Goto isLowercase2
        j       comeBackFromLowercaseIfs    #Go back to uppercaseLoop

    isLowercase2:
        addi    $t3, $zero, -30         #changes letter to lowercase
        j       comeBackFromLowercaseIfs    #Go back to uppercaseLoop



done:       
    # Epilogue for main -- restore stack & frame pointers and return
    lw    $ra, 4($sp)     # get return address from stack
    lw    $fp, 0($sp)     # restore the caller's frame pointer
    addiu $sp, $sp, 24    # restore the caller's stack pointer
    jr    $ra             # return to caller's code
  • 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-12T11:52:00+00:00Added an answer on June 12, 2026 at 11:52 am

    1 This

    move    $t3, $a0
    

    should be

    move    $a0, $t3
    

    2 This

    lb      $t3, 8($t2)
    

    should be

    lb      $t3, 0($t2)
    

    3 This

    addi    $t3, $zero, -30         #changes letter to lowercase
    

    should be

    addi    $t3, $t3, -32         #changes letter to lowercase
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a project right now where we have to implement all communications
I'm working on a project right now where I have been slowly accumulating a
I am working on an android project right now and have a question about
I'm working on a project right now that is a shoutbox. Since I have
Right now I'm working on my project and I have a question about initialization
I'm working on a little project right now in ActionScript 3. The project is
Right now I am working on a dll project with several handy .net tools.
Right now I am working on a stub of a project. In the course
In the .net 3.5 project that I am working on right now, I was
I'm having an Android GPS project for my CS class. Right now I'm working

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.