Question

In: Computer Science

This is to be done using MIPS assembly language. Display the following menus, ask user to...

This is to be done using MIPS assembly language.

Display the following menus, ask user to select one item. If 1-3 is selected, display message “item x is selected”, (x is the number of a menu item), display menus again; if 0 is selected, quit from the program.

1. Menu item 1

2. Menu item 2

3. Menu item 3

0. Quit

Please select from above menu (1-3) to execute one function. Select 0 to quit

Solutions

Expert Solution

.section        .rodata
.LC0:
        .string "\n1.Menu Item 1"
.LC1:
        .string "\n2.Menu Item 2"
.LC2:
        .string "\n3.Menu Item 3"
.LC3:
        .string "\n4.Quit"
        .align 8
.LC4:
        .string "\nPlease select from above menu (1-3) to execute one function. Select 0 to quit"
.LC5:
        .string "%d"
        .text
        .globl  main
        .type   main, @function
main:
.LFB2:
        .cfi_startproc
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        subq    $16, %rsp
        movl    $.LC0, %edi
        movl    $0, %eax
        call    printf
        movl    $.LC1, %edi
        movl    $0, %eax
        call    printf
        movl    $.LC2, %edi
        movl    $0, %eax
        call    printf
        movl    $.LC3, %edi
      movl    $0, %eax
        call    printf
        movl    $.LC4, %edi
        movl    $0, %eax
        call    printf
        leaq    -4(%rbp), %rax
        movq    %rax, %rsi
        movl    $.LC5, %edi
        movl    $0, %eax
        call    __isoc99_scanf
        movl    -4(%rbp), %eax
        testl   %eax, %eax
        jne     .L2
        movl    $0, %edi
        call    exit
.L2:
        movl    $0, %eax
        leave
        .cfi_def_cfa 7, 8
        ret
        .cfi_endproc
.LFE2:

Related Solutions

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.
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...
This is to be done with MIPS assembly language. Write MIPS code which is equivalent to...
This is to be done with MIPS assembly language. Write MIPS code which is equivalent to the follow java program: int day = (int)(Math.random() * 7); switch (day) { case 1: System.out.println(“Monday”); break case 2: System.out.println(“Tuesday”); break case 3: System.out.println(“Wednesday”); break case 4: System.out.println(“Thursday”); break case 5: System.out.println(“Friday”); break case 6: System.out.println(“Saturday”); break case 0: System.out.println(“Sunday”); break }
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'.
using MIPs assembly, ask the user to enter two numbers. Then multiply the two numbers using...
using MIPs assembly, ask the user to enter two numbers. Then multiply the two numbers using bit shifting (not 'mul'). This should work multiplying 2 positive numbers, 2 negative numbers, and a positive/negative number. Then output the result and ask user if he/she has more calculations to complete.
In MIPS assembly language, write a function that will display the max and min value in...
In MIPS assembly language, write a function that will display the max and min value in an array. Then write a function to calculate and display the average of all values in an array. This must be done in MIPS assembly language.
The following are to be completed using MIPS Assembly code. A.   Using syscall #4, display a...
The following are to be completed using MIPS Assembly code. A.   Using syscall #4, display a prompt for the user to enter a number. Then using syscall #5, get a decimal number from the user and save it to data memory (not into a register). After you have stored the number, display it back to the user as a 32-bit binary value. B.   Prompt the user to enter a decimal number and save it to data memory. Using addition and/or...
in MIPS assembly, ask a user for two numbers and to either enter a '1' for...
in MIPS assembly, ask a user for two numbers and to either enter a '1' for addition or '2' for subtraction. using jal, jump to the appropriate procedure for additing or subtracting. then print out result and ask if there is another calculation (terminate program if 'no').
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.
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....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT