I already finished question 1 and i need help only for quest

I already finished question 1 and i need help only for question please and this the code

1#

.data
lower: .asciiz \"hola\"
upper: .asciiz \"XXXX\"

.text
loop: lb $t1, lower($t0)   
beq $t1, 0, exit
subi $t1, $t1, 32
sb $t1, upper($t0)
add $t0, $t0, 1
j loop

exit: li $v0, 10
syscall

2- Rewrite your program in #1 to use a procedure for the conversion. In other words, if you send “apple” to the procedure it will return “APPLE”. Leave the rest of the code in main. Test it on the source strings: “loop2:” and “Elephant!” In other words, code in your main program calls the procedure twice, once for each source string. You should print a memory screen shot after the program runs, showing that both strings were converted – check the ASCII box.

You should add code to check if each byte is in fact a lowercase letter, and only convert if it is; otherwise it should just copy it.

In the program for problem 1 you could use $tn registers but in this program you should follow the conventions for using $sn and $tn registers.

Also, use the directive .space for the upper case strings, reserving at least 10 bytes for each of the 2 upper strings.

Solution

int main()
{
    char str[10];
    int i=0;
    scanf(\"%s\", &str);
    while (str[i] !=0)
    {
        str[i] += -32;
        printf(\"%s\", str[i]);
    }
    return 0;
}

I already finished question 1 and i need help only for question please and this the code 1# .data lower: .asciiz \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site