Question

In: Computer Science

Assembly Language Coding Using MARS (MIPS) 1)Write a program that prints your name in a Triangle....

Assembly Language Coding

Using MARS (MIPS)

1)Write a program that prints your name in a Triangle. (NAME = John Doe)

2)Write a Program that intializes X to 10, Y to 20 and Z to -50, adds X and Y and Z and prints the following

the value of each variable, for example value of x is 10

as well as the result of the addition.

Solutions

Expert Solution

Please find the answer below.
Please do comments in case of any issue. Also, don't forget to rate the question. Thank You So Much.


.data
prompt: .asciiz "*\n*****\n* * * *\n* *\n* John Doe *\n* *\n******************\n"

.globl main
.text
main:
li $v0,4
la $a0,prompt #it will print prompt
syscall

2)

.data
prompt: .asciiz "\nThe value of x = "
prompt1: .asciiz "\nThe value of y = "
prompt2: .asciiz "\nThe value of z = "
prompt3: .asciiz "\nThe result of addition is : "
.text
li $t0,10 # load x=10
li $t1,20 # load x=10
li $t2,-50 # load x=10

li $v0,4
la $a0,prompt #it will print prompt
syscall
li $v0,1
move $a0,$t0
syscall


li $v0,4
la $a0,prompt1 #it will print prompt
syscall
li $v0,1
move $a0,$t1
syscall

li $v0,4
la $a0,prompt2 #it will print prompt
syscall
li $v0,1
move $a0,$t2
syscall

add $s0,$t0,$t1
add $s0,$s0,$t2


li $v0,4
la $a0,prompt3 #it will print prompt
syscall
li $v0,1
move $a0,$s0
syscall


Related Solutions

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....
Use MARS to write and simulate a MIPS assembly language program to implement the strlen function....
Use MARS to write and simulate a MIPS assembly language program to implement the strlen function. The program should ask for a user's input and print the length of the user's input. Write the main function to call strlen. The main function should: - Prompt the user for input - Pass that input to strlen using registers $a0. - Preserve (i.e. push onto the stack) any T registers that the main function uses. The strlen function should: - Preserve any...
Write an assembly language program that prints your first name in the output. Use immediate addressing...
Write an assembly language program that prints your first name in the output. Use immediate addressing with a hexadecimal constant to designate the operand of CHARO for each letter of your name. Comment each line except STOP and END. Cut and paste the Assembler Listing into your document and paste a screen shot of the Output area of the Pep8. Use the name "Kevin" as example Assembler Listing Screen Shot of Output area of the Pep8 program
Coding Problem 1: In this program, you are asked to write a program in assembly (MIPS)...
Coding Problem 1: In this program, you are asked to write a program in assembly (MIPS) which works as a simple calculator. The program will get two integer numbers, and based on the requested operation, the result should be shown to the user. a. The program should print a meaningful phrase for each input, and the result. i. “Enter the first number” ii. “Enter the second number” iii. “Enter the operation type” iv. “The result is” b. The user should...
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       ...
In MIPS Assembly Language in Mars, define a method 1 to check if a number is...
In MIPS Assembly Language in Mars, define a method 1 to check if a number is divisible by 4. Then, define a method 2 to generate a random number, call method 1, and return result(number, yes/no) to main. Lastly, have the main method call method 2, and display the results.
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 program in MIPS assembly language to perform the calculation of the following equation and...
Write a program in MIPS assembly language to perform the calculation of the following equation and save the result accordingly:    f = 5x + 3y + z Assumptions: - Registers can be used to represent variables x, y, z, and f - Initialize x, y, and z to values of your choice. f can be initialized to zero. - Use comments to specify your register usage and explain your logic
Using MIPS (MARS) - Assembly Language Assignment ( PLEASE USE COMMENTS TO DESCRIBE EACH STEP )...
Using MIPS (MARS) - Assembly Language Assignment ( PLEASE USE COMMENTS TO DESCRIBE EACH STEP ) Take input of name, the input of hours worked, and input of hourly wage, and use input of hourly wage and hours worked to calculate total paycheck and print Name, and paycheck.
MIPS ASSEMBLY LANGUAGE (I'm using MARS) Can you provide me with the code of this, without...
MIPS ASSEMBLY LANGUAGE (I'm using MARS) Can you provide me with the code of this, without using DIV (4a-b)%[(2+c)/d] (a,b,c,d are user inputs)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT