Question

In: Computer Science

Write a mips assembly language program that asks the user to enter an alphabetic character (either...

Write a mips assembly language program that asks the user to enter an alphabetic character (either lower or upper case)and change the case of the character from lower to upper and from upper to lower and display it.

Solutions

Expert Solution

MIPS

  The MIPS, or Microprocessor without Interlocked Pipeline Stages, assembly code was developed by MIPS Computer Systems. There are six major implementations of the code. The two current implementations are MIPS32 and MIPS64, which support 32-bit and 64-bit operating instructions, respectively. MIPS uses a two-character alphanumeric codes to represent different letters and characters such as operands.

Steps for program:

Step 1 :

Open the MIPS code

Step 2 :

Locate the code containing lowercase and vice versa.The numbers are used to represent letters.For example, letters "a" to "i" are represented by numbers from 61 to 69.The letters "j" through "o" are represented by 6A to 6F. The letters "p" through "y" are represented by 70 to 79. The letter z is represented by 7A.

Program :

.data

lower: .ascii "aaaa"

upper: .ascii "xxxx"

.text

loop:

lb $t1, lower($t0)

beq $t1, 0, exit

sub $t1, $t1, 32

sb $t1, lower($t0)

add $t0, $t0, 1

.j loop

lb $t1, upper($t0)

beq $t2, 0, exit

sub $t2, $t2, 32

sb $t2, upper($t0)

add $t0, $t0, 2

.j loop

exit :

lw $t1, lower

sw $t2, upper

li $v0, 10

syscal

Note : Programming in assembly language is easy for memory swapping and memory related purposes.


Related Solutions

Write a mips assembly language program that asks the user to enter an unsigned number and...
Write a mips assembly language program that asks the user to enter an unsigned number and read it. Then swap the bits at odd positions with those at even positions and display the resulting number. For example, if the user enters the number 9, which has binary representation of 1001, then bit 0 is swapped with bit 1, and bit 2 is swapped with bit 3, resulting in the binary number 0110. Thus, the program should display 6.
MIPS Assembly LanguageWrite a MIPS assembly language program that asks the user toinput an...
MIPS Assembly LanguageWrite a MIPS assembly language program that asks the user to input an integer and then prints out a string that shows how that integer should be encoded using 16 bits. Your program should handle both positive and negative valued inputs. Your program should also print out an error message if the given input cannot be expressed as a 16 bit signed integer.As an example, if the input is 12, your program should output “0000000000001100”. If the input...
Write a mips assembly language program to ask the user to enter two integers A and...
Write a mips assembly language program to ask the user to enter two integers A and B and then display the result of computing the expression: A + 2B - 5.
Write a mips program that would function in QTSPIM that asks the user to enter a...
Write a mips program that would function in QTSPIM that asks the user to enter a list of integer values, one per line, with the last value being a negative. The program should read in these integers until a negative number is entered. Afterwards the program should print 1) sum, 2) minimum value, 3) max value, 4) mean and 5) variance value. of the numbers that were entered.
Write a mips assembly code program that ask the user to enter an integer value, and...
Write a mips assembly code program that ask the user to enter an integer value, and then print the result of doubling that number.
PYTHON: Write a program that asks the user to enter a 10-character telephone number in the...
PYTHON: Write a program that asks the user to enter a 10-character telephone number in the format XXX-XXX-XXXX. The application should display the telephone number with any alphabetic characters that appeared in the original translated to their numeric equivalent. For example, if the user enters 555-GET-FOOD, the application should display 555-438-3663. This is my code, but I cannot figure out where to go from here. #set new number new_number = "" #split number split_num = phone.split("-") for char in split_num[1:2]:...
Write a mips assembly language program. Ask the user whether he wants to repeat the program:...
Write a mips assembly language program. Ask the user whether he wants to repeat the program: "\nRepeat [y/n]? ". Use service code 12 to read a character and the branch instruction to repeat the main function if the user input is character 'y'.
Write a MIPS Assembly language program to request a file name from the user, open the...
Write a MIPS Assembly language program to request a file name from the user, open the file, read the contents, and write out the contents to the console. This is what I have so far: .data    fileName:   .space 100    prompt1:   .asciiz "Enter the file name: "    prompt2:    .asciiz ""    prompt3:   .asciiz "\n"    buffer:    .space 4096 .text    main:        #        li $v0, 4        la $a0, prompt1       ...
Using MARS write a MIPS assembly language program to prompt the user to input two 32-bit...
Using MARS write a MIPS assembly language program to prompt the user to input two 32-bit integers X and Y (X and Y can be prompted separately or at the same time), get them from the user then store them in memory locations labeled X and Y respectively. The program then loads X and Y from the main memory to registers, calculates the sum of them (i.e. X + Y) and store the sum into a memory location labeled S....
Write a MIPS assembly program that prompts the user first for a string, then for a...
Write a MIPS assembly program that prompts the user first for a string, then for a character. The program should then search the string for the character and print out the number of times the character appears in the string. You can use as many restrictions as you want, just be sure to list them. You must allocate space in the .data segment of your program for the user string.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT