MIPS代写

  1. Write a program in MIPS32 assembly language which reads a positive integer N and prints out the following:

1
12
123
1234
12345

1 2 3 4 5 6 … N

 

  1. Implement a program which prompts user two integers inputs x, y from the console and calculate the following expression in signed 32-bit arithmetic:

x3 +3x2y+3xy2 +9y3

Note that you are NOT allowed to use pseudo-instructions with overflow checking for the calculation (i.e. you can not use mulo). If an overflow occurs during any step of the calculation, you should print an error message instead, and stop the program.

Hint: You could simplify the expression before calculation. Please remember to test your program with a range of different inputs, e.g. x = 2,y = 3; x = −3, y = 4; x = 1 000, y = 150 000. . .

 

3.Write a program in MIPS32 assembly language which takes three arguments: register A will receive the initial address of a string, register B will receive a character and register C will receive another character. Within the string, your program should replace any occurrence of the char stored in B by the char stored in register C. For example:

Input string: Apple

Input character: p

Input character: q

Output: Aqqle