Writing a Machine Language Program Write a TOY machine language program which calculates x3 by using repeated addition, where x is input by the user. This program has to work for positive integers only, and you can assume that is what will be entered as input. The flow of action must loop within the code. Your program should output the running total while it calculates it to Stdout. Notes: You will need to create your program using the Visual X-TOY simulator. Make sure that your program code begins at address 10. Run it, test it, then save it as a .toy file. For this question you must submit your program as a .toy file. Handwritten documents or other formats will not be accepted. You do not need to add any code comments of your own. A few common questions have popped up about assignment 5. So here are a few hints: To use the TOY simulator, first install Java JRE from here: https://www.java.com/en/download/manual.jsp. Make sure to select the download for your OS and version (ie, 32-bit or 64-bit OS). Then you can just double-click the toy.jar file, and it will open up. There are many built-in examples in the TOY environment. You are allowed to look at those and use them to help you answer question 4. Make sure you follow the instructions exactly for question 4. In particular, you need to use at least one loop, and you must output the results to STDOUT on each iteration
Operations
In mathematics and computer science, an operation is an event that is carried out to satisfy a given task. Basic operations of a computer system are input, processing, output, storage, and control.
Basic Operators
An operator is a symbol that indicates an operation to be performed. We are familiar with operators in mathematics; operators used in computer programming are—in many ways—similar to mathematical operators.
Division Operator
We all learnt about division—and the division operator—in school. You probably know of both these symbols as representing division:
Modulus Operator
Modulus can be represented either as (mod or modulo) in computing operation. Modulus comes under arithmetic operations. Any number or variable which produces absolute value is modulus functionality. Magnitude of any function is totally changed by modulo operator as it changes even negative value to positive.
Operators
In the realm of programming, operators refer to the symbols that perform some function. They are tasked with instructing the compiler on the type of action that needs to be performed on the values passed as operands. Operators can be used in mathematical formulas and equations. In programming languages like Python, C, and Java, a variety of operators are defined.
Writing a Machine Language Program
Write a TOY machine language program which calculates x3 by using repeated addition, where x is input by the user. This program has to work for positive integers only, and you can assume that is what will be entered as input. The flow of action must loop within the code. Your program should output the running total while it calculates it to Stdout.
Notes:
- You will need to create your program using the Visual X-TOY simulator.
- Make sure that your program code begins at address 10.
- Run it, test it, then save it as a .toy file.
- For this question you must submit your program as a .toy file. Handwritten documents or other formats will not be accepted.
- You do not need to add any code comments of your own.
A few common questions have popped up about assignment 5. So here are a few hints:
- To use the TOY simulator, first install Java JRE from here: https://www.java.com/en/download/manual.jsp. Make sure to select the download for your OS and version (ie, 32-bit or 64-bit OS). Then you can just double-click the toy.jar file, and it will open up.
- There are many built-in examples in the TOY environment. You are allowed to look at those and use them to help you answer question 4.
- Make sure you follow the instructions exactly for question 4. In particular, you need to use at least one loop, and you must output the results to STDOUT on each iteration.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps