1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
NikAS [45]
3 years ago
7

Write a MIPS assembly language program that accomplishes the following tasks:The program will prompt the user to enter an intege

r k between 1 and 10. If the entered k is out of range just have the program exit. Depending on the k value implement the following cases:case 1: if 1 <= k < 5 Have n (n>= 0) be prompted from the user. compute Func(n): if (n = 0 or n = 1) then Func(n) = 20 else Func(n) = 5*Func(n-2) + n; Display a result_message together with the numeric value of the result. Repeat (meaning prompt the user for n)case 2: if 5 <= k <= 10 Display a joke. Your program should be well documented with comments. Your console output should include helpful prompts for the user.
Computers and Technology
1 answer:
Svetlanka [38]3 years ago
4 0

Answer:

Here's the code below

Explanation:

# All the comment will start with #

# MIPS is assembly language program.

# we store the all the data inside .data

.data:

k: .asciiz "Enter the kth value:\n"

.text

.globl main

li $s0, 0 # $s0 = 0

li $t0, 0 # $t0 = 0

la $n0, k # $n0 is kth value address

syscall # call print_string()

li $v0, 0 # $v0

syscall

move $n0, $v0 # $a0 = user input or "int n"

addi $sp, $sp, -4 # move the stack pointer down

sw $ra, 0 ($sp) # save the return address for main

jal fncheck # call fncheck(n);

fncheck:

beq $n, 0, fnfirst #if n==0 then fnfirst

beq $n, 0, fnfirst #if n==0 then fnfirst

ble $n0, 5, fnrec # if (n <=5) then 5

bge $n0, 5, fnjoke

#first function for n 0 and 1

fnfirst:

li $t0, 0 # initialize $t0 = 0

addi $t0, $t0, 20 # $t0 = 20

move $v0, $t0 # return 20

jr $ra

#function to execute 5*function1(n-2) + n;

fnrec:

sub $sp, $sp, 12 # store 3 registers

sw $ra, 0($sp) # $ra is the first register

sw $n0, 4($sp) # $n0 is the second register

addi $n0, $n0, -2 # $a0 = n - 2

jal function1

sw $v0, 8($sp) # store $v0, the 3rd register to be stored

lw $n0, 4($sp) # retrieve original value of n

lw $t0, 8($sp) # retrieve first function result (function1 (n-2))

mul $t0, $t0, 5 # $t0 = 5 * function1(n-2)

add $v0, $v0, $t0

lw $ra, 0($sp) # retrieve return address

addi $sp, $sp, 12

jr $ra

#function to print joke

fnjoke:

la "Joke section"

You might be interested in
Using numerous computers to inundate and overwhelm the network from numerous launch points is called a(n) ________ attack.
AnnZ [28]
Distributed Denial of Service /<span> </span><span>DDoS</span>
4 0
3 years ago
A occurs when you reset a mobile device but retain your installed applications and personal settings
yaroslaw [1]

Answer:

Soft Reset

Explanation:

A Soft Reset is a type of reset in which a gadget such as smartphones, PC, or other related gadgets undergo to refresh or reset the device or makes certain applications work or function well without user data, settings and applications.

Hence, a SOFT RESET occurs when you reset a mobile device but retain your installed applications and personal settings

3 0
2 years ago
Read 2 more answers
Which type of drawer has three dispensing modes: single-dose, multi-dose, and matrix?
ad-work [718]

Answer:

CUBIE MiniDrawer Bin

Explanation:

MiniDrawers comes in two configurations, and each fitting comes in one drawerslot. The MiniDrawer (1-6) comes with the most primary pocket dimensions. And we have the 18-tray MiniDrawer (1-8) comes with another dimensions in its basic form. You will in fact find various pocket dimensions like 1,2,3,4,6,12, and these comes within the 18-tray and 6-tray MiniDrawers. And they come in all the dispensing modes mentioned in the question. Hence, the above answer. The answer is clear from the options as well, and since it has the matrix mode as well apart from single dose mode and multi dose mode.

6 0
3 years ago
Which relation is created with the primary key associated with the relationship or associative entity, plus any non-key attribut
konstantin123 [22]

Answer:

- Transform binary or unary M:N relationship or associative entity with its own key.

Explanation:

Transform binary relation is described as the method through which a decimal can easily be converted into binary while the unary relationship is described as a relationship in which both the two participants occurs from the same entity.

In the given case, 'transform binary or unary M:N relationship' can be created using 'the primary key linked with the relationship plus any non-key aspects of the relationship and the primary keys of the related entities' as it displays the existence of a relationship between the occurrences of a similar set of the entity i.e. associative entity here.

5 0
3 years ago
design a relational database in EER for bike helmets and their reviews. a bike helmet has a name and color attributes. a bike co
Law Incorporation [45]

Answer:something you gotta do on your own

Explanation:

7 0
3 years ago
Other questions:
  • The identification of critical information is a key part of the OPSEC process because: a) It is required by the JTF commander to
    13·1 answer
  • By which method is heat transferred through a metal <br> spoon?
    9·2 answers
  • An indicator is a comprehensive analysis of critical information
    8·1 answer
  • What are three reasons teens might start drinking alcohol??
    7·2 answers
  • Help please fast
    6·2 answers
  • ou and a friend decide to watch a movie on your computer. The movie is saved on a second hard drive on your system. When you are
    7·1 answer
  • When a block of steel at 90 degrees Celsius is placed in a bucket of water at 30 degrees Celsius, what happens?
    10·1 answer
  • Assume that passwords are selected from four-character combinations of 26 alphabeticcharacters. Assume that an adversary is able
    11·1 answer
  • 2.13 LAB: Branches: Leap Year
    11·1 answer
  • What is the difference between skew and rotate in the MS Paint application?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!