Menu

Two Ascii Strings Trying Convert Bit String Mips Qtspim Converting Ascii Strings Bit Strin Q43783675

I have two ASCII strings and I am trying to convert them into abit string in MIPS QtSpim. Converting the ASCII strings into bitstring are already done in one of the subprograms called Binary.However, I need help with printing the bit strings that aregenerated in the Binary subprogram. Here are the ASCII strings:

HELLO WORLD#!3 (str1 in the code)

CRLEO93 (str2 in the code)

.data

wrd1: .word 0

wrd2: word 0

main:

        la $a0, str1 # Loadand print string asking for string
       li $v0, 4
       syscall

       li $v0, 8 # take in input

       la $a0, str2
       jal Binary
       sw $v0, wrd1

la $a0, str4

jal Binary

   sw $v0, wrd2

Binary:

           # $a0 parameter contains string

           # $v0 used for the BinarySet

           # $t0 used to hold nextChar in the string

           # $t3 used to hold the mask for the str[j] character

                       li $v0, 0   # BinarySet is set as empty set

outer: lb $t0, 0($a0)

                       beq $t0, 0, end_outer #end of string

inner: blt $t0, 97, end_inner # ‘a’ value is 97

                       bgt $t0, 122, end_inner # ‘z’ is 122

                       addi $t0, $t0, -32    # capitalize ASCIIcharacter

end_inner:

inner2: blt $t0, 65, end_if_2   # ‘A’ is 65

                       bgt $t0, 90, end_if_2 # ‘Z’ is 90

                       addi $t8, $t0, -65 # determine bit position

                       li $t3, 1 # Build mask

                       sllv $t3, $t3, $t8 # Continue to build mask

                       or $v0, $v0, $t3 # update BinarySet by bitwise OR

end_inner2:

                       addi $a0, $a0,1           #walk-pointer to str[index+1]

                       j outer

end_outer:

                       jr $ra

Expert Answer


Answer to I have two ASCII strings and I am trying to convert them into a bit string in MIPS QtSpim. Converting the ASCII strings …

OR