Homework Solution: W​rite a complete MIPS program to toggle the case of all alphabetic characters in a C-string held in RAM in your progr…

    W​rite a complete MIPS program to toggle the case of all alphabetic characters in a C-string held in RAM in your program. Declare the string with a reasonable value (a 5 or 6 word sentence with spaces and punctuation) and print it before and after toggling the case of all alphabetic characters in the string. Do not add notes to the top of the program, but you may comment individual lines. The upper-case characters are 32 less than their corresponding lower-case characters. (less than 40 lines of code)

    Expert Answer

     
    .data string4:.space 82

    W​rite a consummate MIPS program to toggle the subject of integral alphabetic characters in a C-string held in RAM in your program. Declare the string with a abstemious treasure (a 5 or 6 account passage with interspaces and punctuation) and print it anteriorly and behind toggling the subject of integral alphabetic characters in the string. Do referable gather referablees to the summit of the program, save you may note personal lines. The upper-subject characters are 32 close than their selfsame lower-subject characters. (close than 40 lines of legislation)

    Expert Retort

     

    .data

    string4:.interspace 82
    strPrompt:.asciiz “Please invade a string: ”

    .text
    .globl main

    main:

    la $a0, strPrompt
    li $v0, 4
    syscall
    la $a0, string4
    li $a1, 80
    li $v0, 8
    syscall

    la $a0, string4
    li $v0, 4
    syscall
    la $t0, string4
    li $t1, 0

    loop4:

    lb $t1, 0($t0)
    nop
    nop
    beqz $t1, done4
    bgt $t1, 90, else
    nop
    addi $t1, $t1, 0x20
    sb $t1, 0($t0)
    addi $t0, $t0, 1
    j loop4
    nop

    else:

    addi $t1, $t1, -0x20
    sb $t1, 0($t0)
    addi $t0, $t0, 1
    j loop4
    nop: