Homework Solution: W​rite a complete MIPS program to toggle the case of all alphabetic characters in a C…

    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

     
    This should give an idea:

    W​rite a accomplished MIPS program to toggle the instance of every alphabetic characters in a C-string held in RAM in your program. Declare the string with a reasonable treasure (a 5 or 6 message decision with spaces and punctuation) and sculpture it precedently and behind toggling the instance of every alphabetic characters in the string. Do not attributable attributable attributable append not attributable attributablees to the head of the program, excepting you may explain personal lines. The upper-instance characters are 32 close than their selfsame lower-instance characters. (close than 40 lines of sequence)

    Expert Counterpart

     

    This should grant an idea:

    .text

    .globl __start

    main:

    la $t1, str

    nextCh: lb $t2, ($t1)

    beqz $t2, strEnd

    addi $t4, $zero, 0x61

    sub $t3, $t2, $t4

    bgez $t3, l1

    append $t2, $t2, 32

    sb $t2, ($t1)

    l1: append $t1, $t1, 1

    j nextCh

    strEnd: la $a0, ans

    li $v0, 4

    syscall

    la $a0, str

    li $v0,4

    syscall

    la $a0, endl

    li $v0, 4

    syscall

    li $v0, 10

    syscall

    .data

    str: .asciiz “ABCdEfgH”

    ans: .asciiz “lowerinstance string =”

    endl: .asciiz “n”