Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Produce a program in this assembly language that "coughs" (i

Produce a program in this assembly language that "coughs" (i

Computer Science

Produce a program in this assembly language that "coughs" (i.e., prints cough) some number of times. Your program should first prompt the user for a number and then print cough exactly that many times. You may assume the user will input a non-negative number.

 

Additional info:

Consider a simplified assembly language wherein there are four registers (i.e., locations to store values) called r1, r2, r3, and r4. This assembly language supports the following instructions, wherein R, Rx, Ry, and Rz represent (any of those) registers, V represents a literal value (an integer or a string), and L represents a line number:

1)PRINT R prints the value in register R.

2)INPUT R prompts the user for input and stores it in register R.

  •  
  • You may assume that if the input looks like an integer (i.e., it consists of only digits), it will be stored as an integer; otherwise, it will be stored as a string.
  •  
  • SET R V stores the value V in register R.
  •  
  • For example, SET r1 50 would store the value 50 in register r1.
  •  
  • ADD Rz Rx Ry adds the value stored in register Rx to the value stored in register Ry and stores the result in register Rz.
  •  
  • JUMPEQ Rx Ry L checks if the values stored at registers Rx and Ry are equal to one another. If so, the program jumps to line L. Otherwise, the program continues to the next instruction.
  •  
  • JUMPLT Rx Ry L checks if the values stored at register Rx is less than the value stored at register Ry. If so, then the program jumps to line L. Otherwise, the program continues to the next instruction.
  •  
  • EXIT exits the program.

Every line of code in this assembly language consists of a line number followed by a single instruction. No parentheses, curly braces, semicolons, or any other syntax other than the above instructions!

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions