Question

In: Computer Science

Write an assembly program that lets the user to input only the word MASM and displays...

Write an assembly program that lets the user to input only the word MASM and displays invalid input for any other user inputs.

Solutions

Expert Solution

.LC0:

        .string "%c"

.LC1:

        .string "MASM"

.LC2:

        .string "Invalid Input"

main:

        push    rbp

        mov     rbp, rsp

        sub     rsp, 16

        lea     rax, [rbp-4]

        mov     rsi, rax

        mov     edi, OFFSET FLAT:.LC0

        mov     eax, 0

        call    scanf

        lea     rax, [rbp-4]

        cmp     rax, OFFSET FLAT:.LC1

        je      .L2

        mov     edi, OFFSET FLAT:.LC2

        mov     eax, 0

        call    printf

.L2:

        mov     eax, 0

        leave

        ret


Related Solutions

Write a program, ArrayRange, that asks the user to input integers and that displays the difference...
Write a program, ArrayRange, that asks the user to input integers and that displays the difference between the largest and the smallest. You should ask the user the number of integers s/he would like to enter (this will allow you to set the length of the array). Allow the user to input all the numbers and then store them in the array. Search the array for the largest number, then search for the smallest, and finally compute the calculation. Display...
Assembly using x86 irvine (masm) Write a complete program that will input values for num1 ,num2,...
Assembly using x86 irvine (masm) Write a complete program that will input values for num1 ,num2, and num3 and display the value of the expression ( (num1 ^ 3) * num2 + 5 * ( num2 ^ 2) ) / num3. assume that the user enters only numbers that are greater than zero and the calculation never exceed 4 bytes size. Sample run: num1 = 1 num2 = 2 num3 = 3 ((num1 ^ 3) * num2 + 5 *...
Write a Python program that reads a file, input by the user, containing one word/token per...
Write a Python program that reads a file, input by the user, containing one word/token per line with an empty line between sentences. The program prints out the longest word found in the file along with its length.
Write a program that accepts a string and character as input, then counts and displays the...
Write a program that accepts a string and character as input, then counts and displays the number of times that character appears (in upper- or lowercase) in the string. Use C++ Enter a string: mallet Enter a character: a "A" appears 1 time(s) Enter a string: Racecar Enter a character: R "R" appears 2 time(s)
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....
How to write a C++ program that lets the user enter a string and checks if...
How to write a C++ program that lets the user enter a string and checks if it is an accepted polynomial. Accepted polynomials need to have one term per degree, no parentheses, spaces ignored.
Write a program that will ask for the user to input a filename of a text...
Write a program that will ask for the user to input a filename of a text file that contains an unknown number of integers. And also an output filename to display results. You will read all of the integers from the input file, and store them in an array. (You may need to read all the values in the file once just to get the total count) Using this array you will find the max number, min number, average value,...
Fraction calculator: Write a program that lets the user perform arithmetic operations on fractions.
Fraction calculator: Write a program that lets the user perform arithmetic operations on fractions. Fractions are of the form a / b, in which a and b are integers and b != 0.Your program must:be menu driven, allowing the user to select the operation (+, -, *, or /) and input the numerator and denominator of each fraction.The input must be validated for correct operation (+, -, *, or /) and b != 0. If any of these cases are...
C++ Write a program that lets the user enter a two letters which are f and...
C++ Write a program that lets the user enter a two letters which are f and s with a length of 5. And outputs how many times it was occurred and lists the 2 most repeating pattern with 5lengths of f and s. The output display should always start at three-f(s) .Include an option where user can retry the program. Example: Input: sssfsfsfssssfffsfsssssfffsffffsfsfssffffsfsfsfssssfffffsffffffffffffssssssssfffsffffsssfsfsfsfssssfffsssfsfsffffffssssssffffsssfsfsfsss Output: The most repeating 5lengths of pattern is: fffsf and occurred 6times. Output2: The second most repeating...
Write a C++ program that lets the user enter the total rainfall for each of 12...
Write a C++ program that lets the user enter the total rainfall for each of 12 months (starting with January) into an array of doubles. The program should calculate and display (in this order): the total rainfall for the year,     the average monthly rainfall,     and the months with the highest and lowest amounts. Months should be expressed as English names for months in the Gregorian calendar, i.e.: January, February, March, April, May, June, July, August, September, October, November,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT